diff options
Diffstat (limited to 'toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js')
-rw-r--r-- | toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js | 21 |
1 files changed, 19 insertions, 2 deletions
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` ); } |