From 55f1807765d9078c57084657c155de0e20d0bc79 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Thu, 12 Aug 2021 08:39:36 +0000 Subject: [PATCH] Bug 1723496: Update tests within caps/ to work with https-first enabled r=nika Differential Revision: https://phabricator.services.mozilla.com/D121529 --- caps/tests/mochitest/browser_checkloaduri.js | 7 +++++++ caps/tests/unit/test_precursor_principal.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/caps/tests/mochitest/browser_checkloaduri.js b/caps/tests/mochitest/browser_checkloaduri.js index 3f114427335d7..724fdc6769473 100644 --- a/caps/tests/mochitest/browser_checkloaduri.js +++ b/caps/tests/mochitest/browser_checkloaduri.js @@ -293,6 +293,13 @@ function testURL( } add_task(async function() { + // In this test we want to verify both http and https load + // restrictions, hence we explicitly switch off the https-first + // upgrading mechanism. + await SpecialPowers.pushPrefEnv({ + set: [["dom.security.https_first", false]], + }); + await kAboutPagesRegistered; let baseFlags = ssm.STANDARD | ssm.DONT_REPORT_ERRORS; for (let [sourceString, targetsAndExpectations] of URLs) { diff --git a/caps/tests/unit/test_precursor_principal.js b/caps/tests/unit/test_precursor_principal.js index 9d1491b2e0505..3b7dd9b737246 100644 --- a/caps/tests/unit/test_precursor_principal.js +++ b/caps/tests/unit/test_precursor_principal.js @@ -95,6 +95,9 @@ server.registerPathHandler("/client_replace", (request, response) => { }); add_task(async function sandboxed_precursor() { + // Bug 1725345: Make XPCShellContentUtils.createHttpServer support https + Services.prefs.setBoolPref("dom.security.https_first", false); + let extension = await ExtensionTestUtils.loadExtension({ manifest: { permissions: ["webRequest", "webRequestBlocking", ""], @@ -253,4 +256,5 @@ add_task(async function sandboxed_precursor() { await page.close(); } + Services.prefs.clearUserPref("dom.security.https_first"); });