From 9707849e5be21418f480165d456918ff7ff83390 Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Thu, 27 May 2021 19:03:46 +0300 Subject: [PATCH] Backed out changeset ccdbd76fc479 (bug 1662710) for Browser-chrome failures in toolkit/components/passwordmgr/test/browser/browser_exceptions_dialog.js. CLOSED TREE --- .../preferences/dialogs/permissions.js | 73 +---- .../preferences/dialogs/permissions.xhtml | 7 +- .../components/preferences/privacy.inc.xhtml | 12 - browser/components/preferences/privacy.js | 29 -- .../components/preferences/tests/browser.ini | 1 - .../tests/browser_cookies_exceptions.js | 48 +++ .../tests/browser_https_only_exceptions.js | 274 ------------------ ...r_permissions_checkPermissionsWereAdded.js | 2 +- browser/components/preferences/tests/head.js | 56 ---- .../en-US/browser/preferences/permissions.ftl | 20 -- .../test/browser/browser_exceptions_dialog.js | 22 +- 11 files changed, 68 insertions(+), 476 deletions(-) delete mode 100644 browser/components/preferences/tests/browser_https_only_exceptions.js diff --git a/browser/components/preferences/dialogs/permissions.js b/browser/components/preferences/dialogs/permissions.js index bfb8404d86cfb..e8a3954678a59 100644 --- a/browser/components/preferences/dialogs/permissions.js +++ b/browser/components/preferences/dialogs/permissions.js @@ -24,10 +24,6 @@ const permissionExceptionsL10n = { window: "permissions-exceptions-saved-logins-window", description: "permissions-exceptions-saved-logins-desc", }, - "https-only-load-insecure": { - window: "permissions-exceptions-https-only-window", - description: "permissions-exceptions-https-only-desc", - }, install: { window: "permissions-exceptions-addons-window", description: "permissions-exceptions-addons-desc", @@ -70,11 +66,9 @@ var gPermissionManager = { this._removeButton = document.getElementById("removePermission"); this._removeAllButton = document.getElementById("removeAllPermissions"); - this._btnCookieSession = document.getElementById("btnCookieSession"); + this._btnSession = document.getElementById("btnSession"); this._btnBlock = document.getElementById("btnBlock"); this._btnAllow = document.getElementById("btnAllow"); - this._btnHttpsOnlyOff = document.getElementById("btnHttpsOnlyOff"); - this._btnHttpsOnlyOffTmp = document.getElementById("btnHttpsOnlyOffTmp"); let permissionsText = document.getElementById("permissionsText"); @@ -95,15 +89,7 @@ var gPermissionManager = { ]); document.getElementById("btnBlock").hidden = !params.blockVisible; - document.getElementById("btnCookieSession").hidden = !( - params.sessionVisible && this._type == "cookie" - ); - document.getElementById("btnHttpsOnlyOff").hidden = !( - this._type == "https-only-load-insecure" - ); - document.getElementById("btnHttpsOnlyOffTmp").hidden = !( - params.sessionVisible && this._type == "https-only-load-insecure" - ); + document.getElementById("btnSession").hidden = !params.sessionVisible; document.getElementById("btnAllow").hidden = !params.allowVisible; this.onHostInput(this._urlField); @@ -181,38 +167,26 @@ var gPermissionManager = { return ( capability == Ci.nsIPermissionManager.ALLOW_ACTION || capability == Ci.nsIPermissionManager.DENY_ACTION || - capability == Ci.nsICookiePermission.ACCESS_SESSION || - capability == Ci.nsIHttpsOnlyModePermission.LOAD_INSECURE_ALLOW_SESSION + capability == Ci.nsICookiePermission.ACCESS_SESSION ); }, _getCapabilityL10nId(capability) { - // HTTPS-Only Mode phrases exceptions as turning it off - if (this._type == "https-only-load-insecure") { - return this._getHttpsOnlyCapabilityL10nId(capability); - } - + let stringKey = null; switch (capability) { case Ci.nsIPermissionManager.ALLOW_ACTION: - return "permissions-capabilities-listitem-allow"; + stringKey = "permissions-capabilities-listitem-allow"; + break; case Ci.nsIPermissionManager.DENY_ACTION: - return "permissions-capabilities-listitem-block"; + stringKey = "permissions-capabilities-listitem-block"; + break; case Ci.nsICookiePermission.ACCESS_SESSION: - return "permissions-capabilities-listitem-allow-session"; + stringKey = "permissions-capabilities-listitem-allow-session"; + break; default: throw new Error(`Unknown capability: ${capability}`); } - }, - - _getHttpsOnlyCapabilityL10nId(capability) { - switch (capability) { - case Ci.nsIPermissionManager.ALLOW_ACTION: - return "permissions-capabilities-listitem-off"; - case Ci.nsIHttpsOnlyModePermission.LOAD_INSECURE_ALLOW_SESSION: - return "permissions-capabilities-listitem-off-temporarily"; - default: - throw new Error(`Unknown HTTPS-Only Mode capability: ${capability}`); - } + return stringKey; }, _addPermissionToList(perm) { @@ -402,19 +376,12 @@ var gPermissionManager = { document.getElementById("btnAllow").click(); } else if (!document.getElementById("btnBlock").hidden) { document.getElementById("btnBlock").click(); - } else if (!document.getElementById("btnHttpsOnlyOff").hidden) { - document.getElementById("btnHttpsOnlyOff").click(); } } }, onHostInput(siteField) { - this._btnCookieSession.disabled = - this._btnCookieSession.hidden || !siteField.value; - this._btnHttpsOnlyOff.disabled = - this._btnHttpsOnlyOff.hidden || !siteField.value; - this._btnHttpsOnlyOffTmp.disabled = - this._btnHttpsOnlyOffTmp.hidden || !siteField.value; + this._btnSession.disabled = this._btnSession.hidden || !siteField.value; this._btnBlock.disabled = this._btnBlock.hidden || !siteField.value; this._btnAllow.disabled = this._btnAllow.hidden || !siteField.value; }, @@ -463,21 +430,7 @@ var gPermissionManager = { } for (let p of this._permissionsToAdd.values()) { - // If this sets the HTTPS-Only exemption only for this - // session, then the expire-type has to be set. - if ( - p.capability == - Ci.nsIHttpsOnlyModePermission.LOAD_INSECURE_ALLOW_SESSION - ) { - Services.perms.addFromPrincipal( - p.principal, - p.type, - p.capability, - Ci.nsIPermissionManager.EXPIRE_SESSION - ); - } else { - Services.perms.addFromPrincipal(p.principal, p.type, p.capability); - } + Services.perms.addFromPrincipal(p.principal, p.type, p.capability); } }, diff --git a/browser/components/preferences/dialogs/permissions.xhtml b/browser/components/preferences/dialogs/permissions.xhtml index 34ee97300a3bd..55e3f150dead9 100644 --- a/browser/components/preferences/dialogs/permissions.xhtml +++ b/browser/components/preferences/dialogs/permissions.xhtml @@ -24,7 +24,6 @@ data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept"> - @@ -47,14 +46,10 @@