diff options
Diffstat (limited to 'toolkit/components/extensions/test/xpcshell')
32 files changed, 125 insertions, 42 deletions
diff --git a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js b/toolkit/components/extensions/test/xpcshell/test_csp_validator.js index 011628f027..0e665b9730 100644 --- a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js +++ b/toolkit/components/extensions/test/xpcshell/test_csp_validator.js @@ -202,8 +202,8 @@ add_task(async function test_csp_validator_extension_pages() { let checkPolicy = (policy, expectedResult) => { info(`Checking policy: ${policy}`); - // While Schemas.jsm uses Ci.nsIAddonContentPolicy.CSP_ALLOW_WASM, we don't - // pass that here because we are only verifying that remote scripts are + // While Schemas.sys.mjs uses Ci.nsIAddonContentPolicy.CSP_ALLOW_WASM, we + // don't pass that here because we are only verifying that remote scripts are // blocked here. let result = cps.validateAddonCSP(policy, 0); equal(result, expectedResult); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_private_field_xrays.js b/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_private_field_xrays.js index 2d8b02bcd9..76b6644d44 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_private_field_xrays.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_private_field_xrays.js @@ -1,6 +1,6 @@ "use strict"; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); const server = createHttpServer(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_xrays.js b/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_xrays.js index 9655c157d1..b909223302 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_xrays.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_adoption_with_xrays.js @@ -1,6 +1,6 @@ "use strict"; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); const server = createHttpServer(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_clear_cached_resources.js b/toolkit/components/extensions/test/xpcshell/test_ext_clear_cached_resources.js index 95bef23383..bd05398736 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_clear_cached_resources.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_clear_cached_resources.js @@ -297,7 +297,7 @@ add_task( // This temporary directory is going to be removed from the // cleanup function, but also make it unique as we do for the // other temporary files (e.g. like getTemporaryFile as defined - // in XPInstall.jsm). + // in XPIInstall.sys.mjs). const random = Math.round(Math.random() * 36 ** 3).toString(36); const tmpDirName = `xpcshelltest_unpacked_addons_${random}`; let tmpExtPath = FileUtils.getDir("TmpD", [tmpDirName]); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_dynamic_registration.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_dynamic_registration.js index 0133b5d86c..20f6ece95a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_dynamic_registration.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_dynamic_registration.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, to use +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, to use // the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js index 4ebe6df636..ce7f293142 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js @@ -30,7 +30,7 @@ Services.prefs.setBoolPref( false ); -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xorigin_frame.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xorigin_frame.js index 8a58b2475c..420fa7689c 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xorigin_frame.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xorigin_frame.js @@ -5,6 +5,12 @@ const server = createHttpServer({ }); server.registerDirectory("/data/", do_get_file("data")); +// By default, fission.webContentIsolationStrategy=1 (IsolateHighValue). When +// Fission is enabled on Android, the pref value 2 (IsolateHighValue) will be +// used instead. Set to 1 (IsolateEverything) to make sure the subframe in this +// test gets its own process, independently of the default prefs on Android. +Services.prefs.setIntPref("fission.webContentIsolationStrategy", 1); + add_task(async function test_process_switch_cross_origin_frame() { const extension = ExtensionTestUtils.loadExtension({ manifest: { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xrays.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xrays.js index 7b92d5c4b7..30ec8ceced 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xrays.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_xrays.js @@ -1,6 +1,6 @@ "use strict"; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js b/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js index 2a36f51637..b6f955f7ba 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js index 4b7bebe188..df9e9d77ef 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js @@ -29,6 +29,7 @@ server.registerPathHandler("/echoheaders", (req, res) => { dropDefaultHeader("accept-language"); dropDefaultHeader("accept-encoding"); dropDefaultHeader("connection"); + dropDefaultHeader("priority"); res.write(JSON.stringify(headers)); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_file_access.js b/toolkit/components/extensions/test/xpcshell/test_ext_file_access.js index c05188cd38..bea1e76c0f 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_file_access.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_file_access.js @@ -4,7 +4,7 @@ const FILE_DUMMY_URL = Services.io.newFileURI( do_get_file("data/dummy_page.html") ).spec; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js b/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js index 1e46e19527..69ba326f75 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js @@ -4,7 +4,7 @@ const { Preferences } = ChromeUtils.importESModule( "resource://gre/modules/Preferences.sys.mjs" ); -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_ipcBlob.js b/toolkit/components/extensions/test/xpcshell/test_ext_ipcBlob.js index dd90d9bbc8..2c5b3378fd 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_ipcBlob.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_ipcBlob.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js index 948b75978a..ae6ce3d27e 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js @@ -12,8 +12,8 @@ const { ExtensionPermissions } = ChromeUtils.importESModule( Services.prefs.setBoolPref("extensions.manifestV3.enabled", true); -// ExtensionParent.jsm is being imported lazily because when it is imported Services.appinfo will be -// retrieved and cached (as a side-effect of Schemas.jsm being imported), and so Services.appinfo +// ExtensionParent.sys.mjs is being imported lazily because when it is imported Services.appinfo will be +// retrieved and cached (as a side-effect of Schemas.sys.mjs being imported), and so Services.appinfo // will not be returning the version set by AddonTestUtils.createAppInfo and this test will // fail on non-nightly builds (because the cached appinfo.version will be undefined and // AddonManager startup will fail). @@ -704,6 +704,7 @@ const GRANTED_WITHOUT_USER_PROMPT = [ "theme", "unlimitedStorage", "webRequest", + "webRequestAuthProvider", "webRequestBlocking", "webRequestFilterResponse", "webRequestFilterResponse.serviceWorkerScript", @@ -1058,3 +1059,47 @@ add_task(async function test_internal_permissions() { await extension.unload(); }); + +add_task(function test_normalizeOptional() { + const optional1 = { + origins: ["*://site.com/", "*://*.domain.com/"], + permissions: ["downloads", "tabs"], + }; + + function normalize(perms, optional) { + perms = { origins: [], permissions: [], ...perms }; + optional = { origins: [], permissions: [], ...optional }; + return ExtensionPermissions.normalizeOptional(perms, optional); + } + + normalize({ origins: ["http://site.com/"] }, optional1); + normalize({ origins: ["https://site.com/"] }, optional1); + normalize({ origins: ["*://blah.domain.com/"] }, optional1); + normalize({ permissions: ["downloads", "tabs"] }, optional1); + + Assert.throws( + () => normalize({ origins: ["http://www.example.com/"] }, optional1), + /was not declared in the manifest/ + ); + Assert.throws( + () => normalize({ permissions: ["proxy"] }, optional1), + /was not declared in optional_permissions/ + ); + + const optional2 = { + origins: ["<all_urls>", "*://*/*"], + permissions: ["idle", "clipboardWrite"], + }; + + normalize({ origins: ["http://site.com/"] }, optional2); + normalize({ origins: ["https://site.com/"] }, optional2); + normalize({ origins: ["*://blah.domain.com/"] }, optional2); + normalize({ permissions: ["idle", "clipboardWrite"] }, optional2); + + let perms = normalize({ origins: ["<all_urls>"] }, optional2); + equal( + perms.origins.sort().join(), + optional2.origins.sort().join(), + `Expect both "all sites" permissions` + ); +}); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_permissions_api.js b/toolkit/components/extensions/test/xpcshell/test_ext_permissions_api.js index 0211787fee..97db78cf81 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_permissions_api.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_permissions_api.js @@ -58,6 +58,7 @@ add_task(async function setup() { "search", "tabHide", "tabs", + "webRequestAuthProvider", "webRequestBlocking", "webRequestFilterResponse", "webRequestFilterResponse.serviceWorkerScript", diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js index 4b1128a349..719fd219fe 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js @@ -251,7 +251,7 @@ add_task(async function test_webRequest_auth_proxy_system() { () => { browser.test.sendMessage("onAuthRequired"); // cancel is silently ignored, if it were not (e.g someone messes up in - // WebRequest.jsm and allows cancel) this test would fail. + // WebRequest.sys.mjs and allows cancel) this test would fail. return { cancel: true, authCredentials: { username: "puser", password: "ppass" }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_manifest_permissions.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_manifest_permissions.js index 85e645e67b..e5fc746e60 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_manifest_permissions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_manifest_permissions.js @@ -86,7 +86,7 @@ add_task(async function () { a_manifest_property: {}, }, background() { - // Test hasPermission method implemented in ExtensionChild.jsm. + // Test hasPermission method implemented in ExtensionChild.sys.mjs. browser.test.assertTrue( "testManifestPermission" in browser, "The API namespace is defined as expected" @@ -105,7 +105,7 @@ add_task(async function () { "test-extension-manifest-without-nested-prop" ); - // Test hasPermission method implemented in Extension.jsm. + // Test hasPermission method implemented in Extension.sys.mjs. equal( extension.extension.hasPermission("manifest:a_manifest_property"), true, @@ -129,7 +129,7 @@ add_task(async function () { }, }, background() { - // Test hasPermission method implemented in ExtensionChild.jsm. + // Test hasPermission method implemented in ExtensionChild.sys.mjs. browser.test.assertTrue( "testManifestPermission" in browser, "The API namespace is defined as expected" @@ -146,7 +146,7 @@ add_task(async function () { async extension => { await extension.awaitFinish("test-extension-manifest-with-nested-prop"); - // Test hasPermission method implemented in Extension.jsm. + // Test hasPermission method implemented in Extension.sys.mjs. equal( extension.extension.hasPermission("manifest:a_manifest_property"), true, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js index 14cbca7443..496607968e 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js @@ -144,7 +144,7 @@ add_task( } ); -// Test that Extension.jsm and schema correctly match. +// Test that Extension.sys.mjs and schema correctly match. add_task(function test_privileged_permissions_match() { const { PRIVILEGED_PERMS } = ChromeUtils.importESModule( "resource://gre/modules/Extension.sys.mjs" diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts.js b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts.js index a06f34a1b4..c47cdcad4d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, to use +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, to use // the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_css.js b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_css.js index 21190d2d59..a3c79b1cc0 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_css.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_css.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, to use +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, to use // the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_file.js b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_file.js index 3c806439ce..02ef9b0fa5 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_file.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_contentScripts_file.js @@ -4,7 +4,7 @@ const FILE_DUMMY_URL = Services.io.newFileURI( do_get_file("data/dummy_page.html") ).spec; -// ExtensionContent.jsm needs to know when it's running from xpcshell, to use +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, to use // the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_updateContentScripts.js b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_updateContentScripts.js index 9d3bf1576c..85c2376715 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_updateContentScripts.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_updateContentScripts.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`; -// ExtensionContent.jsm needs to know when it's running from xpcshell, to use +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, to use // the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_shadowdom.js b/toolkit/components/extensions/test/xpcshell/test_ext_shadowdom.js index 626d8de22d..e8316aa652 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_shadowdom.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_shadowdom.js @@ -1,6 +1,6 @@ "use strict"; -// ExtensionContent.jsm needs to know when it's running from xpcshell, +// ExtensionContent.sys.mjs needs to know when it's running from xpcshell, // to use the right timeout for content scripts executed at document_idle. ExtensionTestUtils.mockAppInfo(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_userScripts.js b/toolkit/components/extensions/test/xpcshell/test_ext_userScripts.js index 3108c7b9b4..57ca08aca3 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_userScripts.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_userScripts.js @@ -200,7 +200,7 @@ add_task(async function test_userScripts_no_webext_apis() { let script = await browser.userScripts.register(userScriptOptions); // Unregister and then register the same js code again, to verify that the last registered - // userScript doesn't get assigned a revoked blob url (otherwise Extensioncontent.jsm + // userScript doesn't get assigned a revoked blob url (otherwise Extensioncontent.sys.mjs // ScriptCache raises an error because it fails to compile the revoked blob url and the user // script will never be loaded). script.unregister(); 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() { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js index 17c22e156d..97e44498c1 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js @@ -18,6 +18,18 @@ function sendMessage(page, msg, data) { return MessageChannel.sendMessage(page.browser.messageManager, msg, data); } +add_setup(() => { + // Make sure to invalidate WebExtensions API schemas that may be cached + // in the StartupCache when this test runs with conditioned-profiles. + // + // These tests are subject to be hitting failures consistently on + // landing API schema changes to the WebExtensions API permissions. + // or other API schema properties that are explicitly covered by + // this tests (e.g. errors expected to be emitted by postprocess + // helper functions). + Services.obs.notifyObservers(null, "startupcache-invalidate"); +}); + add_task(async function test_permissions() { function background() { browser.webRequest.onBeforeRequest.addListener( @@ -113,11 +125,14 @@ add_task(async function test_permissions() { await contentPage.close(); }); -add_task(async function test_no_webRequestBlocking_error() { +add_task(async function test_missing_required_perm_for_blocking_error() { function background() { const expectedError = "Using webRequest.addListener with the blocking option " + "requires the 'webRequestBlocking' permission."; + const expectedErrorOnAuthRequired = + "Using webRequest.onAuthRequired.addListener with the blocking option " + + "requires either the 'webRequestBlocking' or 'webRequestAuthProvider' permission."; const blockingEvents = [ "onBeforeRequest", @@ -135,7 +150,9 @@ add_task(async function test_no_webRequestBlocking_error() { ["blocking"] ); }, - expectedError, + eventName === "onAuthRequired" + ? expectedErrorOnAuthRequired + : expectedError, `Got the expected exception for a blocking webRequest.${eventName} listener` ); } diff --git a/toolkit/components/extensions/test/xpcshell/test_load_all_api_modules.js b/toolkit/components/extensions/test/xpcshell/test_load_all_api_modules.js index 32299fb04e..3d28971352 100644 --- a/toolkit/components/extensions/test/xpcshell/test_load_all_api_modules.js +++ b/toolkit/components/extensions/test/xpcshell/test_load_all_api_modules.js @@ -18,7 +18,7 @@ let schemaURLs = new Set(); schemaURLs.add("chrome://extensions/content/schemas/experiments.json"); // Helper class used to load the API modules similarly to the apiManager -// defined in ExtensionParent.jsm. +// defined in ExtensionParent.sys.mjs. class FakeAPIManager extends ExtensionCommon.SchemaAPIManager { constructor(processType = "main") { super(processType, Schemas); @@ -102,7 +102,8 @@ class FakeAPIManager extends ExtensionCommon.SchemaAPIManager { } // Specialized helper class used to test loading "child process" modules (similarly to the -// SchemaAPIManagers sub-classes defined in ExtensionPageChild.jsm and ExtensionContent.jsm). +// SchemaAPIManagers sub-classes defined in ExtensionPageChild.sys.mjs and +// ExtensionContent.sys.mjs). class FakeChildProcessAPIManager extends FakeAPIManager { constructor({ processType, categoryScripts }) { super(processType, Schemas); diff --git a/toolkit/components/extensions/test/xpcshell/test_native_manifests.js b/toolkit/components/extensions/test/xpcshell/test_native_manifests.js index 1f5bc88740..d4f3ae7243 100644 --- a/toolkit/components/extensions/test/xpcshell/test_native_manifests.js +++ b/toolkit/components/extensions/test/xpcshell/test_native_manifests.js @@ -248,7 +248,7 @@ add_task( "lookupApplication returns the correct path with platform-native slash" ); // Side note: manifest.path does not contain a platform-native path, - // but it is normalized when used in NativeMessaging.jsm. + // but it is normalized when used in NativeMessaging.sys.mjs. deepEqual( result.manifest, manifest, diff --git a/toolkit/components/extensions/test/xpcshell/test_webRequest_ancestors.js b/toolkit/components/extensions/test/xpcshell/test_webRequest_ancestors.js index 509f821828..abbb814ac7 100644 --- a/toolkit/components/extensions/test/xpcshell/test_webRequest_ancestors.js +++ b/toolkit/components/extensions/test/xpcshell/test_webRequest_ancestors.js @@ -11,7 +11,7 @@ const server = createHttpServer({ hosts: ["example.com"] }); server.registerDirectory("/data/", do_get_file("data")); add_task(async function setup() { - // When WebRequest.jsm is used directly instead of through ext-webRequest.js, + // When WebRequest.sys.mjs is used directly instead of through ext-webRequest.js, // ExtensionParent.apiManager is not automatically initialized. Do it here. await ExtensionParent.apiManager.lazyInit(); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_webRequest_cookies.js b/toolkit/components/extensions/test/xpcshell/test_webRequest_cookies.js index 53ed465786..f4c8d75690 100644 --- a/toolkit/components/extensions/test/xpcshell/test_webRequest_cookies.js +++ b/toolkit/components/extensions/test/xpcshell/test_webRequest_cookies.js @@ -75,7 +75,7 @@ function onResponseStarted(details) { } add_task(async function setup() { - // When WebRequest.jsm is used directly instead of through ext-webRequest.js, + // When WebRequest.sys.mjs is used directly instead of through ext-webRequest.js, // ExtensionParent.apiManager is not automatically initialized. Do it here. await ExtensionParent.apiManager.lazyInit(); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js b/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js index 46a72a5926..86b2410e33 100644 --- a/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js +++ b/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js @@ -89,7 +89,7 @@ add_task(async function setup() { // Disable rcwn to make cache behavior deterministic. Services.prefs.setBoolPref("network.http.rcwn.enabled", false); - // When WebRequest.jsm is used directly instead of through ext-webRequest.js, + // When WebRequest.sys.mjs is used directly instead of through ext-webRequest.js, // ExtensionParent.apiManager is not automatically initialized. Do it here. await ExtensionParent.apiManager.lazyInit(); }); diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell-common.toml b/toolkit/components/extensions/test/xpcshell/xpcshell-common.toml index 7cf8d79409..6d47012eca 100644 --- a/toolkit/components/extensions/test/xpcshell/xpcshell-common.toml +++ b/toolkit/components/extensions/test/xpcshell/xpcshell-common.toml @@ -533,7 +533,7 @@ skip-if = ["os == 'android'"] # Bug 1564871 ["test_ext_storage_sanitizer.js"] skip-if = [ "appname == 'thunderbird'", - "os == 'android'", # Sanitizer.jsm is not in toolkit. + "os == 'android'", # Sanitizer.sys.mjs is not in toolkit. ] ["test_ext_storage_session.js"] @@ -587,7 +587,9 @@ skip-if = [ ["test_ext_wasm.js"] ["test_ext_webRequest_auth.js"] -skip-if = ["os == 'android' && debug"] +skip-if = [ + "os == 'android' && debug", +] ["test_ext_webRequest_cached.js"] skip-if = ["os == 'android'"] # Bug 1573511 @@ -616,7 +618,9 @@ skip-if = ["os == 'android' && debug"] skip-if = ["tsan"] # Bug 1683730 ["test_ext_webRequest_permission.js"] -skip-if = ["os == 'android' && debug"] +skip-if = [ + "os == 'android' && debug", +] ["test_ext_webRequest_redirectProperty.js"] skip-if = ["os == 'android' && processor == 'x86_64'"] # Bug 1683253 |