Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions browser/base/content/browser-siteIdentity.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ var gIdentityHandler = {
"identity-popup-clear-sitedata-button": event => {
this.clearSiteData(event);
},
"identity-popup-allow-sitedata-button": () => {
this.toggleSiteData();
},
"identity-popup-remove-cert-exception": () => {
this.removeCertException();
},
Expand Down Expand Up @@ -463,6 +466,33 @@ var gIdentityHandler = {
event.stopPropagation();
},

async refreshSiteData() {
document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute(
"pressed",
Services.perms.testExactPermissionFromPrincipal(
gBrowser.contentPrincipal,
"cookie"
) === Services.perms.ALLOW_ACTION
);
},

async toggleSiteData() {
const pressed = document.getElementById("identity-popup-allow-sitedata-toggle").toggleAttribute(
"pressed"
);

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.
Expand Down Expand Up @@ -1190,6 +1220,8 @@ var gIdentityHandler = {
this._identityPopupContentOwner.textContent = owner;
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;

this.refreshSiteData();
},

setURI(uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<toolbarbutton id="identity-popup-clear-sitedata-button"
data-l10n-id="identity-clear-site-data"
class="subviewbutton"/>
<toolbarbutton id="identity-popup-allow-sitedata-button"
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>
</vbox>
</panelview>

Expand Down
1 change: 1 addition & 0 deletions browser/locales/en-US/browser/browser.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,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 = 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:
Expand Down