From 7d7daf8766b250d1359b900cdc78e95f5caaf08a Mon Sep 17 00:00:00 2001 From: Goloman Adrian Date: Mon, 24 Mar 2025 11:54:54 +0200 Subject: [PATCH] Backed out 2 changesets (bug 1954940, bug 1955438) for causing bc failures @exceptionDialog.xhtml. CLOSED TREE Backed out changeset cbf1b21a62af (bug 1955438) Backed out changeset e77512e4c8fb (bug 1954940) --- dom/security/nsContentSecurityUtils.cpp | 3 ++- security/manager/pki/pippki.sys.mjs | 10 ---------- .../pki/resources/content/exceptionDialog.js | 17 ++++++----------- .../pki/resources/content/exceptionDialog.xhtml | 9 +++++---- .../pki/resources/content/setp12password.js | 8 +------- .../pki/resources/content/setp12password.xhtml | 11 +++++++---- .../browser/browser_exportP12_passwordUI.js | 4 ++-- 7 files changed, 23 insertions(+), 39 deletions(-) diff --git a/dom/security/nsContentSecurityUtils.cpp b/dom/security/nsContentSecurityUtils.cpp index 96e281e20fc8..bb198d9246fb 100644 --- a/dom/security/nsContentSecurityUtils.cpp +++ b/dom/security/nsContentSecurityUtils.cpp @@ -1297,7 +1297,6 @@ static nsLiteralCString sStyleSrcUnsafeInlineAllowList[] = { "chrome://pippki/content/downloadcert.xhtml"_ns, "chrome://pippki/content/editcacert.xhtml"_ns, "chrome://pippki/content/load_device.xhtml"_ns, - "chrome://pippki/content/setp12password.xhtml"_ns, }; // img-src data: blob: static nsLiteralCString sImgSrcDataBlobAllowList[] = { @@ -1944,6 +1943,8 @@ void nsContentSecurityUtils::AssertChromePageHasCSP(Document* aDocument) { "chrome://global/content/win.xhtml"_ns, "chrome://global/skin/in-content/info-pages.css"_ns, "chrome://layoutdebug/content/layoutdebug.xhtml"_ns, + "chrome://pippki/content/exceptionDialog.xhtml"_ns, + "chrome://pippki/content/setp12password.xhtml"_ns, // Test files "chrome://mochikit/"_ns, "chrome://mochitests/"_ns, diff --git a/security/manager/pki/pippki.sys.mjs b/security/manager/pki/pippki.sys.mjs index 7693b299a6b0..18c4635aaded 100644 --- a/security/manager/pki/pippki.sys.mjs +++ b/security/manager/pki/pippki.sys.mjs @@ -298,13 +298,3 @@ function getChainForUsage(results, usage) { } return null; } - -// Performs an XMLHttpRequest because the script for the dialog is prevented -// from doing so by CSP. -export async function checkCertHelper(uri, grabber) { - let req = new XMLHttpRequest(); - req.open("GET", uri.prePath); - req.onerror = grabber.bind(null, req); - req.onload = grabber.bind(null, req); - req.send(null); -} diff --git a/security/manager/pki/resources/content/exceptionDialog.js b/security/manager/pki/resources/content/exceptionDialog.js index 2f8d66d1eb27..b764751ad5f8 100644 --- a/security/manager/pki/resources/content/exceptionDialog.js +++ b/security/manager/pki/resources/content/exceptionDialog.js @@ -4,7 +4,7 @@ "use strict"; -const { setText, viewCertHelper, checkCertHelper } = ChromeUtils.importESModule( +const { setText, viewCertHelper } = ChromeUtils.importESModule( "resource://gre/modules/psm/pippki.sys.mjs" ); @@ -28,13 +28,6 @@ function initExceptionDialog() { let l10nUpdatedElements = [confirmButton, warningText]; confirmButton.disabled = true; - document - .getElementById("locationTextBox") - .addEventListener("input", () => handleTextChange()); - document - .getElementById("viewCertButton") - .addEventListener("input", () => viewCertButtonClick()); - var args = window.arguments; if (args && args[0]) { if (args[0].location) { @@ -124,7 +117,11 @@ async function checkCert() { let uri = getURI(); if (uri) { - checkCertHelper(uri, grabCert); + let req = new XMLHttpRequest(); + req.open("GET", uri.prePath); + req.onerror = grabCert.bind(this, req); + req.onload = grabCert.bind(this, req); + req.send(null); } else { gChecking = false; await document.l10n.translateElements(updateCertStatus()); @@ -327,5 +324,3 @@ function addException() { function inPrivateBrowsingMode() { return PrivateBrowsingUtils.isWindowPrivate(window); } - -window.addEventListener("load", () => initExceptionDialog()); diff --git a/security/manager/pki/resources/content/exceptionDialog.xhtml b/security/manager/pki/resources/content/exceptionDialog.xhtml index 430c764ff261..95ce272531e2 100644 --- a/security/manager/pki/resources/content/exceptionDialog.xhtml +++ b/security/manager/pki/resources/content/exceptionDialog.xhtml @@ -3,14 +3,13 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - + data-l10n-id="exception-mgr" + onload="initExceptionDialog();">