diff --git a/patches/ui-patches/allow_cookies_for_site.patch b/patches/ui-patches/allow_cookies_for_site.patch index c5607f0..7f68b80 100644 --- a/patches/ui-patches/allow_cookies_for_site.patch +++ b/patches/ui-patches/allow_cookies_for_site.patch @@ -1,68 +1,76 @@ diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js -index 4efbba2324..a35021b0c6 100644 +index 4efbba2..1bc6b5b 100644 --- a/browser/base/content/browser-siteIdentity.js +++ b/browser/base/content/browser-siteIdentity.js -@@ -414,6 +414,35 @@ var gIdentityHandler = { +@@ -414,6 +414,33 @@ var gIdentityHandler = { event.stopPropagation(); }, -+ /** -+ * Handles clicks on the "ALLOW Cookies and Site Data" button. -+ */ -+ async allowSiteData(event) { -+ // Hide the popup before showing the removal prompt, to -+ // avoid a pretty ugly transition. Also hide it even -+ // if the update resulted in no site data, to keep the -+ // illusion that clicking the button had an effect. -+ let hidden = new Promise(c => { -+ this._identityPopup.addEventListener("popuphidden", c, { once: true }); -+ }); -+ PanelMultiView.hidePopup(this._identityPopup); -+ await hidden; ++ async refreshSiteData() { ++ document.getElementById("identity-popup-allow-sitedata-toggle").setAttribute( ++ "pressed", ++ Services.perms.testExactPermissionFromPrincipal( ++ gBrowser.contentPrincipal, ++ "cookie" ++ ) === Services.perms.ALLOW_ACTION ++ ); ++ }, + -+ // Get base domain -+ if (!this._uriHasHost) { return } -+ let baseDomain = SiteDataManager.getBaseDomainFromHost(this._uri.host); ++ async toggleSiteData() { ++ const pressed = document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute( ++ "pressed" ++ ); + -+ // Set variables and call addFromPrincipal() -+ const type = 'cookie'; -+ const capability = Ci.nsIPermissionManager.ALLOW_ACTION; -+ let uri = Services.io.newURI('https://' + baseDomain); -+ let principal = Services.scriptSecurityManager.createContentPrincipal(uri,{}); -+ Services.perms.addFromPrincipal(principal, type, capability); -+ -+ // Stop propagating the event and exit. -+ event.stopPropagation(); ++ if (pressed) { ++ Services.perms.addFromPrincipal( ++ gBrowser.contentPrincipal, ++ "cookie", ++ Services.perms.ALLOW_ACTION, ++ Services.perms.EXPIRE_NEVER ++ ); ++ } else { ++ Services.perms.removeFromPrincipal(gBrowser.contentPrincipal, "cookie"); ++ } + }, + /** * Handler for mouseclicks on the "More Information" button in the * "identity-popup" panel. +@@ -1151,6 +1178,8 @@ var gIdentityHandler = { + this._identityPopupContentOwner.textContent = owner; + this._identityPopupContentSupp.textContent = supplemental; + this._identityPopupContentVerif.textContent = verifier; ++ ++ this.refreshSiteData(); + }, + + setURI(uri) { diff --git a/browser/components/controlcenter/content/identityPanel.inc.xhtml b/browser/components/controlcenter/content/identityPanel.inc.xhtml -index 8bc64faa1e..0768ff1520 100644 +index 8bc64fa..4a4a1af 100644 --- a/browser/components/controlcenter/content/identityPanel.inc.xhtml +++ b/browser/components/controlcenter/content/identityPanel.inc.xhtml -@@ -96,6 +96,10 @@ +@@ -96,6 +96,12 @@ data-l10n-id="identity-clear-site-data" class="subviewbutton" oncommand="gIdentityHandler.clearSiteData(event);"/> + ++ oncommand="gIdentityHandler.toggleSiteData();"> ++ ++ ++ diff --git a/browser/locales/en-US/browser/browser.ftl b/browser/locales/en-US/browser/browser.ftl -index 0dbdc78eda..3ced42d39f 100644 +index 0dbdc78..e183f1a 100644 --- a/browser/locales/en-US/browser/browser.ftl +++ b/browser/locales/en-US/browser/browser.ftl -@@ -402,6 +402,8 @@ identity-permissions-storage-access-learn-more = Learn more +@@ -402,6 +402,7 @@ identity-permissions-storage-access-learn-more = Learn more identity-permissions-reload-hint = You may need to reload the page for changes to apply. identity-clear-site-data = .label = Clear cookies and site data… -+identity-allow-site-data = -+ .label = LibreWolf: Always store cookies/data for this site ++identity-allow-site-data = LibreWolf: Always store cookies/data for this site identity-connection-not-secure-security-view = You are not securely connected to this site. identity-connection-verified = You are securely connected to this site. identity-ev-owner-label = Certificate issued to: diff --git a/settings b/settings index 9dac027..b587388 160000 --- a/settings +++ b/settings @@ -1 +1 @@ -Subproject commit 9dac02778ebed3e2614da52c36b7cede45f4f602 +Subproject commit b587388bdbe63511c478cb8b5f82c2e80040414c