mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-22 13:43:04 -05:00
Add toggle to allow_cookies_for_site.patch
This commit is contained in:
parent
feb2835b3f
commit
1c8a036435
2 changed files with 44 additions and 36 deletions
|
@ -1,68 +1,76 @@
|
||||||
diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js
|
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
|
--- a/browser/base/content/browser-siteIdentity.js
|
||||||
+++ b/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();
|
event.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
+ /**
|
+ async refreshSiteData() {
|
||||||
+ * Handles clicks on the "ALLOW Cookies and Site Data" button.
|
+ document.getElementById("identity-popup-allow-sitedata-toggle").setAttribute(
|
||||||
+ */
|
+ "pressed",
|
||||||
+ async allowSiteData(event) {
|
+ Services.perms.testExactPermissionFromPrincipal(
|
||||||
+ // Hide the popup before showing the removal prompt, to
|
+ gBrowser.contentPrincipal,
|
||||||
+ // avoid a pretty ugly transition. Also hide it even
|
+ "cookie"
|
||||||
+ // if the update resulted in no site data, to keep the
|
+ ) === Services.perms.ALLOW_ACTION
|
||||||
+ // 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;
|
|
||||||
+
|
+
|
||||||
+ // Get base domain
|
+ async toggleSiteData() {
|
||||||
+ if (!this._uriHasHost) { return }
|
+ const pressed = document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute(
|
||||||
+ let baseDomain = SiteDataManager.getBaseDomainFromHost(this._uri.host);
|
+ "pressed"
|
||||||
|
+ );
|
||||||
+
|
+
|
||||||
+ // Set variables and call addFromPrincipal()
|
+ if (pressed) {
|
||||||
+ const type = 'cookie';
|
+ Services.perms.addFromPrincipal(
|
||||||
+ const capability = Ci.nsIPermissionManager.ALLOW_ACTION;
|
+ gBrowser.contentPrincipal,
|
||||||
+ let uri = Services.io.newURI('https://' + baseDomain);
|
+ "cookie",
|
||||||
+ let principal = Services.scriptSecurityManager.createContentPrincipal(uri,{});
|
+ Services.perms.ALLOW_ACTION,
|
||||||
+ Services.perms.addFromPrincipal(principal, type, capability);
|
+ Services.perms.EXPIRE_NEVER
|
||||||
+
|
+ );
|
||||||
+ // Stop propagating the event and exit.
|
+ } else {
|
||||||
+ event.stopPropagation();
|
+ Services.perms.removeFromPrincipal(gBrowser.contentPrincipal, "cookie");
|
||||||
|
+ }
|
||||||
+ },
|
+ },
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
* Handler for mouseclicks on the "More Information" button in the
|
* Handler for mouseclicks on the "More Information" button in the
|
||||||
* "identity-popup" panel.
|
* "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
|
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
|
--- a/browser/components/controlcenter/content/identityPanel.inc.xhtml
|
||||||
+++ b/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"
|
data-l10n-id="identity-clear-site-data"
|
||||||
class="subviewbutton"
|
class="subviewbutton"
|
||||||
oncommand="gIdentityHandler.clearSiteData(event);"/>
|
oncommand="gIdentityHandler.clearSiteData(event);"/>
|
||||||
+ <toolbarbutton id="identity-popup-allow-sitedata-button"
|
+ <toolbarbutton id="identity-popup-allow-sitedata-button"
|
||||||
+ data-l10n-id="identity-allow-site-data"
|
|
||||||
+ class="subviewbutton"
|
+ class="subviewbutton"
|
||||||
+ oncommand="gIdentityHandler.allowSiteData(event);"/>
|
+ oncommand="gIdentityHandler.toggleSiteData();">
|
||||||
|
+ <label data-l10n-id="identity-allow-site-data" flex="1"></label>
|
||||||
|
+ <html:moz-toggle id="identity-popup-allow-sitedata-toggle" style="pointer-events: none;"></html:moz-toggle>
|
||||||
|
+ </toolbarbutton>
|
||||||
</vbox>
|
</vbox>
|
||||||
</panelview>
|
</panelview>
|
||||||
|
|
||||||
diff --git a/browser/locales/en-US/browser/browser.ftl b/browser/locales/en-US/browser/browser.ftl
|
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
|
--- a/browser/locales/en-US/browser/browser.ftl
|
||||||
+++ b/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-permissions-reload-hint = You may need to reload the page for changes to apply.
|
||||||
identity-clear-site-data =
|
identity-clear-site-data =
|
||||||
.label = Clear cookies and site data…
|
.label = Clear cookies and site data…
|
||||||
+identity-allow-site-data =
|
+identity-allow-site-data = LibreWolf: Always store cookies/data for this site
|
||||||
+ .label = LibreWolf: Always store cookies/data for this site
|
|
||||||
identity-connection-not-secure-security-view = You are not securely connected to 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-connection-verified = You are securely connected to this site.
|
||||||
identity-ev-owner-label = Certificate issued to:
|
identity-ev-owner-label = Certificate issued to:
|
||||||
|
|
2
settings
2
settings
|
@ -1 +1 @@
|
||||||
Subproject commit 9dac02778ebed3e2614da52c36b7cede45f4f602
|
Subproject commit b587388bdbe63511c478cb8b5f82c2e80040414c
|
Loading…
Reference in a new issue