diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js')
-rw-r--r-- | toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js index 578e69ebdf..ef07817d00 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js @@ -63,7 +63,7 @@ server.registerPathHandler("/authenticate.sjs", (request, response) => { } }); -function getExtension(bgConfig) { +function getExtension(bgConfig, permissions = ["webRequestBlocking"]) { function background(config) { let path = config.path; browser.webRequest.onBeforeRequest.addListener( @@ -125,18 +125,18 @@ function getExtension(bgConfig) { return ExtensionTestUtils.loadExtension({ manifest: { - permissions: ["webRequest", "webRequestBlocking", bgConfig.path], + permissions: [bgConfig.path, "webRequest", ...permissions], }, background: `(${background})(${JSON.stringify(bgConfig)})`, }); } -add_task(async function test_webRequest_auth() { +async function test_webRequest_auth(permissions) { let config = { path: `${BASE_URL}/*`, realm: `webRequest_auth${Math.random()}`, onBeforeRequest: { - extra: ["blocking"], + extra: permissions.includes("webRequestBlocking") ? ["blocking"] : [], }, onAuthRequired: { extra: ["blocking"], @@ -149,7 +149,7 @@ add_task(async function test_webRequest_auth() { }, }; - let extension = getExtension(config); + let extension = getExtension(config, permissions); await extension.startup(); let requestUrl = `${BASE_URL}/authenticate.sjs?realm=${config.realm}`; @@ -174,6 +174,14 @@ add_task(async function test_webRequest_auth() { await contentPage.close(); await extension.unload(); +} + +add_task(async function test_webRequest_auth_with_webRequestBlocking() { + await test_webRequest_auth(["webRequestBlocking"]); +}); + +add_task(async function test_webRequest_auth_with_webRequestAuthProvider() { + await test_webRequest_auth(["webRequestAuthProvider"]); }); add_task(async function test_webRequest_auth_cancelled() { |