0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00
LibreWolf/patches/ui-patches/allow_cookies_for_site.patch

74 lines
2.6 KiB
Diff
Raw Normal View History

2023-12-04 14:36:22 -05:00
diff --git a/browser/base/content/browser-siteIdentity.js b/browser/base/content/browser-siteIdentity.js
2024-11-01 09:23:08 -05:00
index d0ba6ac670f4..a7dc8393e9de 100644
2023-12-04 14:36:22 -05:00
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
2024-10-31 03:20:11 -05:00
@@ -204,6 +204,9 @@ var gIdentityHandler = {
"identity-popup-clear-sitedata-button": event => {
this.clearSiteData(event);
},
2024-11-01 09:23:08 -05:00
+ "identity-popup-allow-sitedata-button": () => {
2024-10-31 03:20:11 -05:00
+ this.toggleSiteData();
+ },
"identity-popup-remove-cert-exception": () => {
this.removeCertException();
},
@@ -457,6 +460,33 @@ var gIdentityHandler = {
2023-12-04 14:36:22 -05:00
event.stopPropagation();
},
+ async refreshSiteData() {
2023-12-06 17:09:17 -05:00
+ document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute(
+ "pressed",
+ Services.perms.testExactPermissionFromPrincipal(
+ gBrowser.contentPrincipal,
+ "cookie"
+ ) === Services.perms.ALLOW_ACTION
+ );
+ },
2023-12-04 14:36:22 -05:00
+
+ async toggleSiteData() {
+ const pressed = document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute(
+ "pressed"
+ );
2023-12-04 14:36:22 -05:00
+
+ if (pressed) {
+ Services.perms.addFromPrincipal(
+ gBrowser.contentPrincipal,
+ "cookie",
+ Services.perms.ALLOW_ACTION,
+ Services.perms.EXPIRE_NEVER
+ );
+ } else {
+ Services.perms.removeFromPrincipal(gBrowser.contentPrincipal, "cookie");
+ }
2023-12-04 14:36:22 -05:00
+ },
+
/**
* Handler for mouseclicks on the "More Information" button in the
* "identity-popup" panel.
2024-10-31 03:20:11 -05:00
@@ -1217,6 +1247,8 @@ var gIdentityHandler = {
this._identityPopupContentOwner.textContent = owner;
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;
+
+ this.refreshSiteData();
},
setURI(uri) {
2023-12-04 14:36:22 -05:00
diff --git a/browser/components/controlcenter/content/identityPanel.inc.xhtml b/browser/components/controlcenter/content/identityPanel.inc.xhtml
2024-10-31 03:20:11 -05:00
index 768768c7d448..08602d9460c6 100644
2023-12-04 14:36:22 -05:00
--- a/browser/components/controlcenter/content/identityPanel.inc.xhtml
+++ b/browser/components/controlcenter/content/identityPanel.inc.xhtml
2024-10-31 03:20:11 -05:00
@@ -98,6 +98,11 @@
<toolbarbutton id="identity-popup-clear-sitedata-button"
2023-12-04 14:36:22 -05:00
data-l10n-id="identity-clear-site-data"
2024-10-31 03:20:11 -05:00
class="subviewbutton"/>
2023-12-04 14:36:22 -05:00
+ <toolbarbutton id="identity-popup-allow-sitedata-button"
2024-10-31 03:20:11 -05:00
+ class="subviewbutton">
+ <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>
2023-12-04 14:36:22 -05:00
</vbox>
</panelview>