diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /security/manager/ssl/tests | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'security/manager/ssl/tests')
7 files changed, 77 insertions, 6 deletions
diff --git a/security/manager/ssl/tests/mochitest/browser/browser.toml b/security/manager/ssl/tests/mochitest/browser/browser.toml index 433fffa4ac..ffa0e39d36 100644 --- a/security/manager/ssl/tests/mochitest/browser/browser.toml +++ b/security/manager/ssl/tests/mochitest/browser/browser.toml @@ -33,6 +33,8 @@ skip-if = [ "socketprocess_networking", ] +["browser_clientAuth_fetch_from_extension.js"] + ["browser_clientAuth_speculative_connection.js"] skip-if = ["socketprocess_networking"] diff --git a/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_fetch_from_extension.js b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_fetch_from_extension.js new file mode 100644 index 0000000000..4f9a45f03c --- /dev/null +++ b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_fetch_from_extension.js @@ -0,0 +1,59 @@ +/* Any copyright is dedicated to the Public Domain. + * https://creativecommons.org/publicdomain/zero/1.0/ */ + +/* global browser */ + +"use strict"; + +let certDialogShown = false; +function onCertDialogLoaded(subject) { + certDialogShown = true; + // eslint-disable-next-line mozilla/no-arbitrary-setTimeout + setTimeout(() => { + subject.acceptDialog(); + }, 0); +} + +Services.obs.addObserver(onCertDialogLoaded, "cert-dialog-loaded"); + +function clearClientCertsDecision() { + let cars = Cc["@mozilla.org/security/clientAuthRememberService;1"].getService( + Ci.nsIClientAuthRememberService + ); + cars.clearRememberedDecisions(); +} + +registerCleanupFunction(() => { + Services.obs.removeObserver(onCertDialogLoaded, "cert-dialog-loaded"); + // Make sure we don't affect other tests. + clearClientCertsDecision(); +}); + +add_task(async function () { + await SpecialPowers.pushPrefEnv({ + set: [["security.default_personal_cert", "Ask Every Time"]], + }); + + clearClientCertsDecision(); + + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + permissions: ["<all_urls>"], + }, + + async background() { + try { + await fetch("https://requireclientcert.example.com/"); + browser.test.notifyPass("cert_dialog_shown"); + } catch (error) { + browser.test.fail(`${error} :: ${error.stack}`); + browser.test.notifyFail("cert_dialog_shown"); + } + }, + }); + + await extension.startup(); + await extension.awaitFinish("cert_dialog_shown"); + await extension.unload(); + ok(certDialogShown, "Cert dialog was shown"); +}); diff --git a/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js index 9bf961250a..2e9ff0557e 100644 --- a/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js +++ b/security/manager/ssl/tests/mochitest/browser/browser_clientAuth_ui.js @@ -14,6 +14,11 @@ const TEST_PORT = 123; var certDB = Cc["@mozilla.org/security/x509certdb;1"].getService( Ci.nsIX509CertDB ); + +ChromeUtils.defineESModuleGetters(this, { + PromptUtils: "resource://gre/modules/PromptUtils.sys.mjs", +}); + /** * Test certificate (i.e. build/pgo/certs/mochitest.client). * @@ -34,11 +39,16 @@ var cert; function openClientAuthDialog(cert) { let certArray = [cert]; let retVals = { cert: undefined, rememberDecision: undefined }; + let args = PromptUtils.objectToPropBag({ + hostname: TEST_HOSTNAME, + certArray, + retVals, + }); let win = window.openDialog( "chrome://pippki/content/clientauthask.xhtml", "", "", - { hostname: TEST_HOSTNAME, certArray, retVals } + args ); return TestUtils.topicObserved("cert-dialog-loaded").then(() => { return { win, retVals }; diff --git a/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js b/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js index 4b7b78df8d..8b65d1e411 100644 --- a/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js +++ b/security/manager/ssl/tests/mochitest/browser/browser_loadPKCS11Module_ui.js @@ -290,7 +290,7 @@ async function testModuleNameHelper(moduleName, acceptButtonShouldBeDisabled) { let dialogNode = win.document.querySelector("dialog"); Assert.equal( dialogNode.getAttribute("buttondisabledaccept"), - acceptButtonShouldBeDisabled ? "true" : "", // it's a string + acceptButtonShouldBeDisabled ? "true" : null, `dialog accept button should ${ acceptButtonShouldBeDisabled ? "" : "not " }be disabled` diff --git a/security/manager/ssl/tests/unit/test_der.js b/security/manager/ssl/tests/unit/test_der.js index 2d125488e9..b68449f261 100644 --- a/security/manager/ssl/tests/unit/test_der.js +++ b/security/manager/ssl/tests/unit/test_der.js @@ -3,9 +3,9 @@ "use strict"; -// Tests DER.jsm functionality. +// Tests DER.sys.mjs functionality. -// Until DER.jsm is actually used in production code, this is where we have to +// Until DER.sys.mjs is actually used in production code, this is where we have to // import it from. var { DER } = ChromeUtils.importESModule( "resource://gre/modules/psm/DER.sys.mjs" diff --git a/security/manager/ssl/tests/unit/test_x509.js b/security/manager/ssl/tests/unit/test_x509.js index 89fd01e819..010a89e419 100644 --- a/security/manager/ssl/tests/unit/test_x509.js +++ b/security/manager/ssl/tests/unit/test_x509.js @@ -3,7 +3,7 @@ "use strict"; -// Tests X509.jsm functionality. +// Tests X509.sys.mjs functionality. function stringToArray(s) { let b = []; diff --git a/security/manager/ssl/tests/unit/xpcshell.toml b/security/manager/ssl/tests/unit/xpcshell.toml index 6cfab1a043..82abfcb858 100644 --- a/security/manager/ssl/tests/unit/xpcshell.toml +++ b/security/manager/ssl/tests/unit/xpcshell.toml @@ -336,7 +336,7 @@ skip-if = ["condprof"] # Bug 1769154 - as designed ["test_sss_sanitizeOnShutdown.js"] firefox-appdir = "browser" # Sanitization works differently on Android - this doesn't apply. -# browser/modules/Sanitizer.jsm used by the test isn't available in Thunderbird. +# browser/modules/Sanitizer.sys.mjs used by the test isn't available in Thunderbird. skip-if = [ "os == 'android'", "appname == 'thunderbird'" |