.eslintrc.js |
|
448 |
data |
|
|
head.js |
exported createHttpServer, cleanupDir, clearCache, optionalPermissionsPromptHandler, promiseConsoleOutput,
promiseQuotaManagerServiceReset, promiseQuotaManagerServiceClear,
runWithPrefs, testEnv, withHandlingUserInput, resetHandlingUserInput,
assertPersistentListeners, promiseExtensionEvent, assertHasPersistedScriptsCachedFlag,
assertIsPersistedScriptsCachedFlag,
setup_crash_reporter_override_and_cleaner, crashFrame, crashExtensionBackground,
makeRkvDatabaseDir
|
18118 |
head_dnr.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
7010 |
head_dnr_static_rules.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
5513 |
head_legacy_ep.js |
|
330 |
head_native_messaging.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4438 |
head_remote.js |
globals testEnv |
232 |
head_schemas.js |
exported Schemas, LocalAPIImplementation, SchemaAPIInterface, getContextWrapper |
2991 |
head_service_worker.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5097 |
head_storage.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
43460 |
head_sync.js |
exported withSyncContext |
1798 |
head_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
16905 |
native_messaging.toml |
|
545 |
test_change_backgroundServiceWorker_enabled_pref_false.js |
|
1584 |
test_change_backgroundServiceWorker_enabled_pref_true.js |
|
3025 |
test_change_remote_mode.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
608 |
test_ChannelWrapper.js |
The ChannelWrapper API is part of the implementation of WebRequest, and not
really meant to be used in isolation. In practice, there are several in-tree
uses of ChannelWrapper, so this test serves as a sanity check that
ChannelWrapper behaves reasonable in the absence of WebRequest.
|
17939 |
test_csp_custom_policies.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
8025 |
test_csp_validator.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9684 |
test_ext_activityLog.js |
|
2055 |
test_ext_adoption_with_private_field_xrays.js |
/ |
4287 |
test_ext_adoption_with_xrays.js |
/ |
3499 |
test_ext_alarms.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
10473 |
test_ext_alarms_does_not_fire.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1037 |
test_ext_alarms_periodic.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1398 |
test_ext_alarms_replaces.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1728 |
test_ext_api_events_listener_calls_exceptions.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
13309 |
test_ext_api_permissions.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1651 |
test_ext_asyncAPICall_isHandlingUserInput.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
4240 |
test_ext_background_api_injection.js |
|
1172 |
test_ext_background_early_shutdown.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
32693 |
test_ext_background_generated_load_events.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
751 |
test_ext_background_generated_reload.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
700 |
test_ext_background_global_history.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
697 |
test_ext_background_iframe.js |
|
14372 |
test_ext_background_private_browsing.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1241 |
test_ext_background_runtime_connect_params.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2420 |
test_ext_background_script_and_service_worker.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2518 |
test_ext_background_service_worker.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9883 |
test_ext_background_sub_windows.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
6196 |
test_ext_background_teardown.js |
|
2538 |
test_ext_background_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3236 |
test_ext_background_type_module.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
3938 |
test_ext_background_window_properties.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1096 |
test_ext_brokenlinks.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1590 |
test_ext_browser_style_deprecation.js |
|
12210 |
test_ext_browserSettings.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
16798 |
test_ext_browserSettings_homepage.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
935 |
test_ext_browsingData.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1530 |
test_ext_browsingData_cookies_cache.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
12409 |
test_ext_browsingData_cookies_cookieStoreId.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5647 |
test_ext_cache_api.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9841 |
test_ext_captivePortal.js |
This duplicates the test from netwerk/test/unit/test_captive_portal_service.js
however using an extension to gather the captive portal information.
|
6147 |
test_ext_captivePortal_url.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1370 |
test_ext_clear_cached_resources.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
12227 |
test_ext_content_security_policy.js |
",
"moz-extension:",
"'self'",
],
};
// Keep in sync with extensions.webextensions.base-content-security-policy.v3
baseCSP[3] = {
"script-src": ["'self'", "'wasm-unsafe-eval'"],
};
/**
@typedef TestPolicyExpects
@type {object}
@param {boolean} workerEvalAllowed
@param {boolean} workerImportScriptsAllowed
@param {boolean} workerWasmAllowed
|
9176 |
test_ext_contentscript.js |
/ |
7526 |
test_ext_contentscript_about_blank_start.js |
|
2168 |
test_ext_contentscript_api_injection.js |
|
1824 |
test_ext_contentscript_async_loading.js |
|
2268 |
test_ext_contentscript_canvas_tainting.js |
|
3498 |
test_ext_contentscript_context.js |
eslint-disable mozilla/balanced-listeners |
10720 |
test_ext_contentscript_context_isolation.js |
globals exportFunction |
4877 |
test_ext_contentscript_create_iframe.js |
|
4841 |
test_ext_contentscript_csp.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
12969 |
test_ext_contentscript_css.js |
|
1226 |
test_ext_contentscript_dynamic_registration.js |
/ |
5975 |
test_ext_contentscript_errors.js |
/ |
5278 |
test_ext_contentscript_exporthelpers.js |
globals exportFunction, precisePi, reportPi |
2586 |
test_ext_contentscript_importmap.js |
|
3688 |
test_ext_contentscript_in_background.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1483 |
test_ext_contentscript_json_api.js |
|
3377 |
test_ext_contentscript_module_import.js |
eslint-disable no-eval, no-implied-eval |
8115 |
test_ext_contentscript_perf_observers.js |
|
2238 |
test_ext_contentscript_permissions_change.js |
|
3341 |
test_ext_contentscript_permissions_fetch.js |
|
2755 |
test_ext_contentscript_preloading.js |
Extension content scripts execution happens in two stages:
1. preload content script when a request for a document is observed.
2. actual content script execution when the document has loaded.
This is generally an internal implementation detail and an optimization, but
if it does not happen, it may lead to difficult-to-diagnose intermittent
failures as seen at https://bugzilla.mozilla.org/show_bug.cgi?id=1583700#c12
This test hooks the internal content script execution mechanism to confirm
that preloading happens as expected.
There are some cases where preload is triggered unexpectedly (or not),
especially when null principals (e.g. sandboxed frames) are involved,
or when principal-inheriting URLs (e.g. about:blank and blob:) are involved.
This is not ideal but as long as we don't execute when we should not, we are
good. See comment at DocInfo::PrincipalURL in WebExtensionPolicy.cpp
|
27518 |
test_ext_contentscript_restrictSchemes.js |
|
4255 |
test_ext_contentscript_scriptCreated.js |
/ |
1586 |
test_ext_contentscript_slow_frame.js |
|
13965 |
test_ext_contentscript_teardown.js |
|
2841 |
test_ext_contentscript_triggeringPrincipal.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
42773 |
test_ext_contentscript_unregister_during_loadContentScript.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
2950 |
test_ext_contentscript_world.js |
/*"],
// MAIN and ISOLATED are the only supported values. The userScripts API
// may define userScripts.ExecutionWorld.USER_SCRIPT, but that should
// not be permitted as a value in manifest.json.
world: "USER_SCRIPT",
},
],
});
ExtensionTestUtils.failOnSchemaWarnings(true);
equal(
normalized.error,
'Error processing content_scripts.0.world: Invalid enumeration value "USER_SCRIPT"',
"Should refuse to load extension with an unsupported world value"
);
Assert.deepEqual(normalized.errors, [], "Should not have any other warnings");
});
add_task(async function manifest_content_scripts_world_MAIN() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
content_scripts: [
{
js: ["main.js"],
matches: ["*:// |
7929 |
test_ext_contentscript_xml_prettyprint.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
2316 |
test_ext_contentscript_xorigin_frame.js |
|
2087 |
test_ext_contentscript_xrays.js |
/ |
7021 |
test_ext_contentScripts_register.js |
/file_sample_registered_styles.html"];
browser.test.assertThrows(
() => {
browser.contentScripts.register({
matches,
unknownParam: "unexpected property",
});
},
/Unexpected property "unknownParam"/,
"contentScripts.register throws on unexpected properties"
);
let fileScript = await browser.contentScripts.register({
css: [{ file: "registered_ext_style.css" }],
matches,
runAt: "document_start",
});
let textScript = await browser.contentScripts.register({
css: [{ code: cssCode }],
matches,
runAt: "document_start",
});
browser.test.onMessage.addListener(async msg => {
switch (msg) {
case "unregister-text":
await textScript.unregister().catch(err => {
browser.test.fail(
`Unexpected exception while unregistering text style: ${err}`
);
});
await browser.test.assertRejects(
textScript.unregister(),
/Content script already unregistered/,
"Got the expected rejection on calling script.unregister() multiple times"
);
browser.test.sendMessage("unregister-text:done");
break;
case "unregister-file":
await fileScript.unregister().catch(err => {
browser.test.fail(
`Unexpected exception while unregistering url style: ${err}`
);
});
await browser.test.assertRejects(
fileScript.unregister(),
/Content script already unregistered/,
"Got the expected rejection on calling script.unregister() multiple times"
);
browser.test.sendMessage("unregister-file:done");
break;
default:
browser.test.fail(`Unexpected test message received: ${msg}`);
}
});
browser.test.sendMessage("background_ready");
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: [
"http://localhost/ |
25213 |
test_ext_contexts.js |
|
5633 |
test_ext_contexts_gc.js |
/ |
9032 |
test_ext_contextual_identities.js |
|
20038 |
test_ext_contextual_identities_move.js |
|
3427 |
test_ext_cookieBehaviors.js |
|
21533 |
test_ext_cookies_errors.js |
|
5858 |
test_ext_cookies_firstParty.js |
|
11372 |
test_ext_cookies_onChanged.js |
|
4650 |
test_ext_cookies_partitionKey.js |
This test verifies that the extension API's access to cookies is consistent
with the cookies as seen by web pages under the following modes:
- Every top-level document shares the same cookie jar, every subdocument of
the top-level document has a distinct cookie jar tied to the site of the
top-level document (dFPI).
- All documents have a cookie jar keyed by the domain of the top-level
document (FPI).
- All cookies are in one cookie jar (classic behavior = no FPI nor dFPI)
FPI and dFPI are implemented using OriginAttributes, and historically the
consequence of not recognizing an origin attribute is that cookies cannot be
deleted. Hence, the functionality of the cookies API is verified as follows,
by the testCookiesAPI/runTestCase methods.
1. Load page that creates cookies for the top and a framed document:
- "delete_me"
- "edit_me"
2. cookies.getAll: get all cookies with extension API.
3. cookies.remove: Remove "delete_me" cookies with the extension API.
4. cookies.set: Edit "edit_me" cookie with the extension API.
5. Verify that the web page can see "edit_me" cookie (via document.cookie).
6. cookies.get: "edit_me" is still present.
7. cookies.remove: "edit_me" can be removed.
8. cookies.getAll: no cookies left.
|
40019 |
test_ext_cookies_samesite.js |
|
3471 |
test_ext_cookies_sort.js |
|
2157 |
test_ext_cors_mozextension.js |
|
7942 |
test_ext_csp_frame_ancestors.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
8374 |
test_ext_csp_upgrade_requests.js |
|
1898 |
test_ext_debugging_utils.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
8147 |
test_ext_dnr_across_redirects.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
3384 |
test_ext_dnr_allowAllRequests.js |
|
44796 |
test_ext_dnr_api.js |
|
12821 |
test_ext_dnr_domainType.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
10830 |
test_ext_dnr_download.js |
|
7696 |
test_ext_dnr_dynamic_rules.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
44380 |
test_ext_dnr_file_access.js |
"];
if (hasFilePermissions) {
host_permissions.push("file:///*");
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["declarativeNetRequest", "declarativeNetRequestFeedback"],
host_permissions,
},
background: async () => {
const hasFilePermissions = await browser.permissions.contains({
origins: ["file:///*"],
});
const dnr = browser.declarativeNetRequest;
await dnr.updateSessionRules({
addRules: [
{
id: 1,
condition: { excludedResourceTypes: [] },
// "allow" action does not require permissions because of the
// "declarativeNetRequest" permission, which enables actions such
// as "block" and "allow" without host permissions.
action: { type: "allow" },
},
{
id: 2,
priority: 2,
condition: { excludedResourceTypes: [] },
// "modifyHeaders" action requires host permissions to the request
// URL and the initiator (with exceptions, see below).
action: {
type: "modifyHeaders",
responseHeaders: [{ operation: "set", header: "x", value: "y" }],
},
},
],
});
async function testMatchesRequest(request, ruleIds, description) {
browser.test.assertDeepEq(
ruleIds,
(await dnr.testMatchOutcome(request)).matchedRules.map(m => m.ruleId),
description
);
}
const url = "http://example.com/";
if (hasFilePermissions) {
await testMatchesRequest(
{ url, initiator: "file:///tmp", type: "other" },
[1, 2],
"Can modify requests from file:-initiator, with permission"
);
} else {
await testMatchesRequest(
{ url, initiator: "file:///tmp", type: "other" },
[1],
"Cannot modify requests from file:-initiator, without permission"
);
}
// main_frame/sub_frame are exempt from initiator checks by design, for
// context see: https://bugzilla.mozilla.org/show_bug.cgi?id=1825824#c2
await testMatchesRequest(
{ url, initiator: "file:///tmp", type: "main_frame" },
[1, 2],
"Can match requests from file:-initiator for main_frame requests"
);
await testMatchesRequest(
{ url, initiator: "file:///tmp", type: "sub_frame" },
[1, 2],
"Can match requests from file:-initiator for sub_frame requests"
);
// Regardless of initiator, file:-requests themselves cannot be matched by
// DNR, both by design and in its implementation, which is only hooked up
// to http(s) requests via NetworkIntegration.startDNREvaluation.
// testMatchesRequest can artifically match file:-URLs but that is not
// supported and should be fixed when we fix bug 1827422.
await testMatchesRequest(
{ url: "file:///", initiator: "file:///tmp", type: "sub_frame" },
[1], // Ideally [], would be fixed by bug 1827422.
"Cannot match file:-requests from file."
);
await testMatchesRequest(
{ url: "file:///", type: "sub_frame" },
[1], // Ideally [], would be fixed by bug 1827422.
"Cannot match file:-requests from file."
);
browser.test.notifyPass();
},
});
await extension.startup();
await extension.awaitFinish();
await extension.unload();
}
add_task(async function dnr_without_file_permissions() {
await test_dnr_with_file_initiator(/* hasFilePermissions |
3988 |
test_ext_dnr_modifyHeaders.js |
merge |
37561 |
test_ext_dnr_private_browsing.js |
|
4457 |
test_ext_dnr_redirect_transform.js |
|
25879 |
test_ext_dnr_regexFilter.js |
|
19850 |
test_ext_dnr_regexFilter_limits.js |
|
20101 |
test_ext_dnr_session_rules.js |
|
40969 |
test_ext_dnr_startup_cache.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
19498 |
test_ext_dnr_static_rules.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
43481 |
test_ext_dnr_static_rules_limits.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
15982 |
test_ext_dnr_system_restrictions.js |
|
10924 |
test_ext_dnr_tabIds.js |
|
8517 |
test_ext_dnr_testMatchOutcome.js |
|
56368 |
test_ext_dnr_update_static_rules.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
17529 |
test_ext_dnr_urlFilter.js |
|
36420 |
test_ext_dnr_webrequest.js |
|
9935 |
test_ext_dnr_without_webrequest.js |
|
33285 |
test_ext_dns.js |
PROXYCONFIG_MANUAL |
4583 |
test_ext_downloads.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1181 |
test_ext_downloads_cookies.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
7922 |
test_ext_downloads_cookieStoreId.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
14663 |
test_ext_downloads_download.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
18828 |
test_ext_downloads_eventpage.js |
|
4815 |
test_ext_downloads_misc.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
35484 |
test_ext_downloads_partitionKey.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5972 |
test_ext_downloads_private.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
10701 |
test_ext_downloads_search.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
19790 |
test_ext_downloads_urlencoded.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
8817 |
test_ext_error_location.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1341 |
test_ext_eventpage_idle.js |
|
28430 |
test_ext_eventpage_messaging.js |
|
10096 |
test_ext_eventpage_messaging_wakeup.js |
|
11518 |
test_ext_eventpage_settings.js |
|
4915 |
test_ext_eventpage_warning.js |
|
2711 |
test_ext_experiments.js |
globals browser |
10653 |
test_ext_experiments_glean.js |
globals ExtensionAPI |
3620 |
test_ext_extension.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2131 |
test_ext_extension_content_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
6371 |
test_ext_extension_page_navigated.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
10673 |
test_ext_extension_startup_failure.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1274 |
test_ext_extension_startup_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2964 |
test_ext_extensionPreferencesManager.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
24746 |
test_ext_extensionSettingsStore.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
30023 |
test_ext_file_access.js |
"],
js: ["content_script.js"],
},
],
},
files: {
"content_script.js": async () => {
let response = await fetch(document.URL);
browser.test.assertEq(200, response.status, "expected load");
let responseText = await response.text();
browser.test.assertTrue(
responseText.includes("<p>Page</p>"),
`expected file content in response of ${response.url}`
);
// Now with content.fetch:
response = await content.fetch(document.URL);
browser.test.assertEq(200, response.status, "expected load (content)");
browser.test.sendMessage("done");
},
},
});
await extension.startup();
let contentPage = await ExtensionTestUtils.loadContentPage(FILE_DUMMY_URL);
await extension.awaitMessage("done");
await contentPage.close();
await extension.unload();
});
// XHR/fetch for other file is not allowed, even with file://-permissions.
add_task(async function content_script_xhr_to_other_file_not_allowed() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["file:///*"],
content_scripts: [
{
matches: ["file:///*"],
js: ["content_script.js"],
},
],
},
files: {
"content_script.js": async () => {
let otherFileUrl = document.URL.replace(
"dummy_page.html",
"file_sample.html"
);
let x = new XMLHttpRequest();
x.open("GET", otherFileUrl);
await new Promise(resolve => {
x.onloadend = resolve;
x.send();
});
browser.test.assertEq(0, x.status, "expected error");
browser.test.assertEq("", x.responseText, "request should fail");
// Now with content.XMLHttpRequest.
x = new content.XMLHttpRequest();
x.open("GET", otherFileUrl);
x.onloadend = () => {
browser.test.assertEq(0, x.status, "expected error (content)");
browser.test.sendMessage("done");
};
x.send();
},
},
});
await extension.startup();
let contentPage = await ExtensionTestUtils.loadContentPage(FILE_DUMMY_URL);
await extension.awaitMessage("done");
await contentPage.close();
await extension.unload();
});
// "file://" permission does not grant access to files in the extension page.
add_task(async function file_access_from_extension_page_not_allowed() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["file:///*"],
description: FILE_DUMMY_URL,
},
async background() {
const FILE_DUMMY_URL = browser.runtime.getManifest().description;
await browser.test.assertRejects(
fetch(FILE_DUMMY_URL),
/NetworkError when attempting to fetch resource/,
"block request to file from background page despite file permission"
);
// Regression test for bug 1420296 .
await browser.test.assertRejects(
fetch(FILE_DUMMY_URL, { mode: "same-origin" }),
/NetworkError when attempting to fetch resource/,
"block request to file from background page despite 'same-origin' mode"
);
browser.test.sendMessage("done");
},
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
});
// webRequest listeners should see subresource requests from file:-principals.
add_task(async function webRequest_script_request_from_file_principals() {
// Extension without file:-permission should not see the request.
let extensionWithoutFilePermission = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["http://example.net/", "webRequest"],
},
background() {
browser.webRequest.onBeforeRequest.addListener(
details => {
browser.test.fail(`Unexpected request from ${details.originUrl}`);
},
{ urls: ["http://example.net/intercept_by_webRequest.js"] }
);
},
});
// Extension with <all_urls> (which matches the resource URL at example.net
// and the origin at file:// |
6115 |
test_ext_geckoProfiler_control.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
7371 |
test_ext_geckoProfiler_schema.js |
|
1932 |
test_ext_geturl.js |
|
5005 |
test_ext_i18n.js |
/ |
15710 |
test_ext_i18n_css.js |
/ |
5099 |
test_ext_idle.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9624 |
test_ext_incognito.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3436 |
test_ext_indexedDB_principal.js |
|
4904 |
test_ext_ipcBlob.js |
/ |
4240 |
test_ext_json_parser.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3137 |
test_ext_l10n.js |
|
4926 |
test_ext_localStorage.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1411 |
test_ext_management.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9482 |
test_ext_management_uninstall_self.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4081 |
test_ext_manifest.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
16991 |
test_ext_manifest_content_security_policy.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3550 |
test_ext_manifest_incognito.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2331 |
test_ext_manifest_minimum_chrome_version.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
419 |
test_ext_manifest_minimum_opera_version.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
417 |
test_ext_manifest_themes.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1058 |
test_ext_MessageManagerProxy.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2865 |
test_ext_messaging_startup.js |
|
7245 |
test_ext_native_messaging.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
33997 |
test_ext_native_messaging_perf.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3361 |
test_ext_native_messaging_unresponsive.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2107 |
test_ext_networkStatus.js |
|
5886 |
test_ext_notifications_incognito.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2971 |
test_ext_notifications_unsupported.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1405 |
test_ext_optional_host_permissions.js |
|
1796 |
test_ext_permission_warnings.js |
|
25911 |
test_ext_permission_xhr.js |
eslint-disable mozilla/balanced-listeners |
7051 |
test_ext_permissions.js |
|
36202 |
test_ext_permissions_api.js |
|
16304 |
test_ext_permissions_migrate.js |
|
6701 |
test_ext_permissions_optional_only.js |
|
9105 |
test_ext_permissions_uninstall.js |
|
9322 |
test_ext_persistent_events.js |
global EventManager |
63692 |
test_ext_privacy.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
28892 |
test_ext_privacy_disable.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5070 |
test_ext_privacy_nonPersistentCookies.js |
|
1307 |
test_ext_privacy_update.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4339 |
test_ext_proxy_authorization_via_proxyinfo.js |
|
3282 |
test_ext_proxy_config.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
20429 |
test_ext_proxy_containerIsolation.js |
|
1633 |
test_ext_proxy_onauthrequired.js |
|
8601 |
test_ext_proxy_settings.js |
|
2894 |
test_ext_proxy_socks.js |
globals TCPServerSocket |
16385 |
test_ext_proxy_speculative.js |
|
1328 |
test_ext_proxy_startup.js |
|
7303 |
test_ext_redirects.js |
|
20637 |
test_ext_runtime_connect_no_receiver.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
747 |
test_ext_runtime_getBackgroundPage.js |
|
4351 |
test_ext_runtime_getBrowserInfo.js |
|
963 |
test_ext_runtime_getContexts.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
4959 |
test_ext_runtime_getPlatformInfo.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
915 |
test_ext_runtime_id.js |
|
1160 |
test_ext_runtime_messaging_self.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2847 |
test_ext_runtime_onInstalled_and_onStartup.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
15441 |
test_ext_runtime_onPerformanceWarning.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2939 |
test_ext_runtime_ports.js |
|
2112 |
test_ext_runtime_ports_gc.js |
globals ExtensionAPI |
4950 |
test_ext_runtime_sendMessage.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
14273 |
test_ext_runtime_sendMessage_args.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4189 |
test_ext_runtime_sendMessage_errors.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2105 |
test_ext_runtime_sendMessage_multiple.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2418 |
test_ext_runtime_sendMessage_no_receiver.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2839 |
test_ext_same_site_cookies.js |
Description of the test:
(1) We load an image from mochi.test which sets a same site cookie
(2) We have the web extension perform an XHR request to mochi.test
(3) We verify the web-extension can access the same-site cookie
|
3993 |
test_ext_same_site_redirects.js |
This test tests various redirection scenarios, and checks whether sameSite
cookies are sent.
The file has the following tests:
- verify_firstparty_web_behavior - base case, confirms normal web behavior.
- samesite_is_foreign_without_host_permissions
- wildcard_host_permissions_enable_samesite_cookies
- explicit_host_permissions_enable_samesite_cookies
- some_host_permissions_enable_some_samesite_cookies
|
8045 |
test_ext_sandbox_var.js |
|
949 |
test_ext_sandboxed_resource.js |
eslint-disable-next-line mozilla/balanced-listeners |
1629 |
test_ext_schema.js |
|
2195 |
test_ext_schemas.js |
|
52117 |
test_ext_schemas_allowed_contexts.js |
|
4961 |
test_ext_schemas_async.js |
|
9123 |
test_ext_schemas_interactive.js |
globals ExtensionAPI |
4327 |
test_ext_schemas_manifest_permissions.js |
|
4719 |
test_ext_schemas_privileged.js |
|
4007 |
test_ext_schemas_revoke.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
12220 |
test_ext_schemas_roots.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5228 |
test_ext_schemas_versioned.js |
|
23454 |
test_ext_script_filenames.js |
|
10779 |
test_ext_scripting_contentScripts.js |
"],
granted_host_permissions: true,
...manifestProps,
},
temporarilyInstalled: true,
...otherProps,
});
};
add_task(async function test_registerContentScripts_runAt() {
let extension = makeExtension({
async background() {
const TEST_CASES = [
{
title: "runAt: document_idle",
params: [
{
id: "script-idle",
js: ["script-idle.js"],
matches: ["http:// |
16063 |
test_ext_scripting_contentScripts_css.js |
"],
granted_host_permissions: true,
...manifestProps,
},
allowInsecureRequests: true,
temporarilyInstalled: true,
...otherProps,
});
};
add_task(async function test_registerContentScripts_css() {
let extension = makeExtension({
async background() {
// This script is injected in all frames after the styles so that we can
// verify the registered styles.
const checkAppliedStyleScript = {
id: "check-applied-styles",
allFrames: true,
matches: ["http:// |
11162 |
test_ext_scripting_contentScripts_file.js |
"] },
{ id: "script-3", matches: ["file:// |
2184 |
test_ext_scripting_mv2.js |
|
552 |
test_ext_scripting_persistAcrossSessions.js |
/ |
25388 |
test_ext_scripting_startupCache.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
6152 |
test_ext_scripting_updateContentScripts.js |
"],
granted_host_permissions: true,
...manifestProps,
},
temporarilyInstalled: true,
...otherProps,
});
};
add_task(async function test_scripting_updateContentScripts() {
let extension = makeExtension({
async background() {
const script = {
id: "a-script",
js: ["script-1.js"],
matches: ["http:// |
3364 |
test_ext_secfetch.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
10408 |
test_ext_service_worker_messaging.js |
Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ |
3664 |
test_ext_shadowdom.js |
/ |
1627 |
test_ext_shared_array_buffer.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
3608 |
test_ext_shared_workers.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
1246 |
test_ext_shutdown_cleanup.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
966 |
test_ext_simple.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5506 |
test_ext_startup_cache.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
5338 |
test_ext_startup_cache_telemetry.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
5038 |
test_ext_startup_perf.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2468 |
test_ext_startup_request_handler.js |
|
1590 |
test_ext_startupData.js |
|
1314 |
test_ext_storage_content_local.js |
|
1202 |
test_ext_storage_content_sync.js |
|
881 |
test_ext_storage_content_sync_kinto.js |
|
887 |
test_ext_storage_idb_data_migration.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
23165 |
test_ext_storage_local.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2452 |
test_ext_storage_managed.js |
|
6146 |
test_ext_storage_managed_policy.js |
|
1117 |
test_ext_storage_quota_exceeded_errors.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2607 |
test_ext_storage_sanitizer.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3663 |
test_ext_storage_session.js |
|
11543 |
test_ext_storage_sync.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1260 |
test_ext_storage_sync_kinto.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
74988 |
test_ext_storage_sync_kinto_crypto.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
3207 |
test_ext_storage_tab.js |
|
6996 |
test_ext_storage_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
13452 |
test_ext_tab_teardown.js |
|
3001 |
test_ext_telemetry.js |
|
25758 |
test_ext_test_mock.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
2166 |
test_ext_test_wrapper.js |
|
2033 |
test_ext_theme_experiments.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
3031 |
test_ext_theme_startupData.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
9780 |
test_ext_trustworthy_origin.js |
This test is asserting that moz-extension: URLs are recognized as trustworthy local origins
|
508 |
test_ext_unknown_permissions.js |
|
1579 |
test_ext_unlimitedStorage.js |
|
5539 |
test_ext_unload_frame.js |
|
7110 |
test_ext_userScripts.js |
/ |
20857 |
test_ext_userScripts_exports.js |
/file_sample.html"],
scriptMetadata,
});
if (messageListener) {
browser.runtime.onMessage.addListener(messageListener);
}
browser.test.sendMessage("background-ready");
}
function notifyFinish(failureReason) {
browser.test.assertEq(
undefined,
failureReason,
"should be completed without errors"
);
browser.test.sendMessage("test_userScript_APIMethod:done");
}
function assertTrue(val, message) {
browser.test.assertTrue(val, message);
if (!val) {
browser.test.sendMessage("test_userScript_APIMethod:done");
throw message;
}
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["http://localhost/ |
31533 |
test_ext_userScripts_mv3_availability.js |
|
18915 |
test_ext_userScripts_mv3_csp.js |
|
11447 |
test_ext_userScripts_mv3_injection.js |
"],
},
files: {
"3.file.js": "resultCollector.push('3.file');dump('3.file.js ran\\n');",
"6.file.js": "resultCollector.push('6.file');dump('6.file.js ran\\n');",
},
async background() {
browser.test.onMessage.addListener(async msg => {
browser.test.assertEq("revoke_permission", msg, "Expected msg");
await browser.permissions.remove({ permissions: ["userScripts"] });
browser.test.assertEq(undefined, browser.userScripts, "API gone");
browser.test.sendMessage("revoke_permission:done");
});
await browser.userScripts.register([
{
id: "basic",
matches: ["*://example.com/resultCollector"],
js: [
{ code: "resultCollector.push('1.code');dump('1.code ran\\n');" },
{ code: "resultCollector.push('2.code');dump('2.code ran\\n');" },
{ file: "3.file.js" },
{ code: "resultCollector.push('4.code');dump('4.code ran\\n');" },
{ code: "resultCollector.push('5.code');dump('5.code ran\\n');" },
{ file: "6.file.js" },
],
runAt: "document_end",
world: "MAIN",
},
]);
browser.test.sendMessage("registered");
},
});
let contentPageBeforeExtStarted = await ExtensionTestUtils.loadContentPage(
"http://example.com/resultCollector"
);
await extension.startup();
await extension.awaitMessage("registered");
let contentPageAfterRegister = await ExtensionTestUtils.loadContentPage(
"http://example.com/resultCollector"
);
Assert.deepEqual(
await collectResults(contentPageAfterRegister),
["1.code", "2.code", "3.file", "4.code", "5.code", "6.file"],
"All MAIN world scripts executed in a new page after registration"
);
Assert.deepEqual(
await collectResults(contentPageBeforeExtStarted),
[],
"User scripts did not execute in content that existed before registration"
);
await contentPageAfterRegister.close();
await contentPageBeforeExtStarted.close();
// Verify that when the "userScripts" permission is revoked, that scripts
// won't be injected in new documents.
extension.sendMessage("revoke_permission");
await extension.awaitMessage("revoke_permission:done");
let contentPageAfterRevoke = await ExtensionTestUtils.loadContentPage(
"http://example.com/resultCollector"
);
Assert.deepEqual(
await collectResults(contentPageAfterRevoke),
[],
"Should not execute after permission revocation"
);
await contentPageAfterRevoke.close();
await extension.unload();
});
add_task(async function userScript_require_host_permissions() {
const extensionId = "@userScript_require_host_permissions";
await grantUserScriptsPermission(extensionId);
let extension = ExtensionTestUtils.loadExtension({
useAddonManager: "permanent",
manifest: {
browser_specific_settings: { gecko: { id: extensionId } },
manifest_version: 3,
optional_permissions: ["userScripts"],
host_permissions: ["*://example.net/*"],
},
async background() {
await browser.userScripts.register([
{
id: "basic",
matches: ["*:// |
10333 |
test_ext_userScripts_mv3_messaging.js |
|
23169 |
test_ext_userScripts_mv3_persistence.js |
|
21351 |
test_ext_userScripts_mv3_worlds.js |
|
13111 |
test_ext_userScripts_register.js |
|
3504 |
test_ext_wasm.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3980 |
test_ext_web_accessible_resources.js |
|
4382 |
test_ext_web_accessible_resources_matches.js |
|
14585 |
test_ext_webRequest_auth.js |
|
17663 |
test_ext_webRequest_cached.js |
/file_sample.html?r=*"],
},
["blocking", "responseHeaders"]
);
browser.webRequest.onResponseStarted.addListener(
details => {
let needle = details.fromCache ? testHeaders[1] : testHeaders[0];
let header = details.responseHeaders.filter(header => {
browser.test.log(`header ${header.name} = ${header.value}`);
return header.name == needle.name && header.value == needle.value;
});
browser.test.assertEq(
header.length,
1,
"header exists with correct value"
);
if (details.fromCache) {
browser.test.sendMessage("from-cache");
}
},
{
urls: ["http://example.com/ |
10047 |
test_ext_webRequest_cancelWithReason.js |
|
1859 |
test_ext_webRequest_containerIsolation.js |
|
1654 |
test_ext_webRequest_download.js |
|
1242 |
test_ext_webRequest_eventPage_StreamFilter.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
11026 |
test_ext_webRequest_filter_urls.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
862 |
test_ext_webRequest_filterResponseData.js |
|
18194 |
test_ext_webRequest_filterTypes.js |
|
2745 |
test_ext_webRequest_from_extension_page.js |
|
1743 |
test_ext_webRequest_host.js |
|
2525 |
test_ext_webRequest_incognito.js |
|
2636 |
test_ext_webRequest_mergecsp.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
16086 |
test_ext_webRequest_permission.js |
globals content |
4444 |
test_ext_webRequest_redirect_mozextension.js |
",
],
web_accessible_resources: ["test.html"],
},
files: {
"test.html": '<!DOCTYPE html><script src="test.js"></script>',
"test.js": () => {
browser.test.assertTrue(
browser.webRequest,
"webRequest API should be available"
);
browser.test.sendMessage("test_done");
},
},
background: () => {
browser.webRequest.onBeforeRequest.addListener(
() => {
return {
redirectUrl: browser.runtime.getURL("test.html"),
};
},
{ urls: ["*:// |
1199 |
test_ext_webRequest_redirect_StreamFilter.js |
/*"],
},
background() {
const closeCounts = {};
browser.webRequest.onBeforeRequest.addListener(
details => {
let expectedError = "Channel redirected";
if (details.type === "main_frame" || details.type === "sub_frame") {
// Message differs for the reason stated at the top of this file.
// TODO bug 1683862: Make error message more accurate.
expectedError = "Invalid request ID";
}
closeCounts[details.requestId] = 0;
let filter = browser.webRequest.filterResponseData(details.requestId);
filter.onstart = () => {
filter.disconnect();
browser.test.fail("Unexpected filter.onstart");
};
filter.onerror = function () {
closeCounts[details.requestId]++;
browser.test.assertEq(expectedError, filter.error, "filter.error");
};
},
{ urls: ["*:// |
4602 |
test_ext_webRequest_redirectProperty.js |
|
1870 |
test_ext_webRequest_requestSize.js |
/*"] }
);
browser.webRequest.onCompleted.addListener(
async details => {
browser.test.assertTrue(details.requestSize > 100, "have requestSize");
browser.test.assertTrue(
details.responseSize > 100,
"have responseSize"
);
browser.test.log(`details.requestSize: ${details.requestSize}`);
browser.test.log(`details.responseSize: ${details.responseSize}`);
browser.test.sendMessage("done");
},
{ urls: ["*:// |
1729 |
test_ext_webRequest_responseBody.js |
eslint-disable mozilla/no-arbitrary-setTimeout |
18963 |
test_ext_webRequest_restrictedHeaders.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
7451 |
test_ext_webRequest_set_cookie.js |
Check that all the cookies described by `prefixes` are in the cookie jar.
@param {Array.string} prefixes
Zero or more prefixes, describing cookies that are expected to be set
in the current cookie jar. Each prefix describes both a cookie
name and corresponding value. For example, if the string "ext"
is passed as an argument, then this function expects to see
a cookie called "extcookie" and corresponding value of "extvalue".
|
10249 |
test_ext_webRequest_startup.js |
That that we get the expected events
@param {Extension} extension
@param {Map} events
@param {object} expect
@param {boolean} expect.background delayed startup event expected
@param {boolean} expect.started background has already started
@param {boolean} expect.delayedStart startup is delayed, notify start and
expect the starting event
@param {boolean} expect.request wait for the request event
|
23017 |
test_ext_webRequest_startup_StreamFilter.js |
|
1927 |
test_ext_webRequest_style_cache.js |
|
1348 |
test_ext_webRequest_suspend.js |
|
7930 |
test_ext_webRequest_urlclassification.js |
If this test fails, likely nsIClassifiedChannel has added or changed a
CLASSIFIED_* flag. Those changes must be in sync with
ChannelWrapper.webidl/cpp and the web_request.json schema file.
|
1144 |
test_ext_webRequest_userContextId.js |
|
1164 |
test_ext_webRequest_viewsource.js |
|
2714 |
test_ext_webRequest_viewsource_StreamFilter.js |
/dummy"] },
["blocking"]
);
browser.webRequest.onBeforeRequest.addListener(
details => {
browser.test.assertEq(`${BASE_URL}/redir`, details.url, "Got redirect");
let filter = browser.webRequest.filterResponseData(details.requestId);
filter.onstop = () => {
filter.disconnect();
browser.test.fail("Unexpected onstop for redirect");
browser.test.sendMessage("redirect_done");
};
filter.onerror = () => {
browser.test.assertEq(
// TODO bug 1683862: must be "Channel redirected", but it is not
// because document requests are handled differently compared to
// other requests, see the comment at the top of
// test_ext_webRequest_redirect_StreamFilter.js.
"Invalid request ID",
filter.error,
"Expected error in filter.onerror"
);
browser.test.sendMessage("redirect_done");
};
},
{ urls: ["*:// |
5136 |
test_ext_webRequest_webSocket.js |
|
1484 |
test_ext_webSocket.js |
"] }];
let extension = ExtensionTestUtils.loadExtension({
manifest: {
manifest_version,
permissions: ["webRequest", "webRequestBlocking"],
host_permissions: ["<all_urls>"],
granted_host_permissions: true,
web_accessible_resources,
content_security_policy,
content_scripts: [
{
matches: ["http:// |
4663 |
test_ext_xhr_capabilities.js |
|
1983 |
test_ext_xhr_cors.js |
|
7144 |
test_extension_permissions_migrate_kvstore_path.js |
/*"],
};
const expectedPermsAddon02 = {
permissions: ["proxy"],
origins: ["https:// |
7675 |
test_extension_permissions_migration.js |
fileDeleted |
2698 |
test_extension_process_alive.js |
|
12414 |
test_ExtensionShortcutKeyMap.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4771 |
test_ExtensionStorageSync_migration_kinto.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
3401 |
test_ExtensionTaskScheduler.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
9777 |
test_load_all_api_modules.js |
|
6827 |
test_locale_converter.js |
|
4086 |
test_locale_data.js |
|
5464 |
test_MatchPattern.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
21508 |
test_native_manifests.js |
|
16051 |
test_OriginControls.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
22110 |
test_process_crash_telemetry.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
4117 |
test_proxy_failover.js |
|
9463 |
test_proxy_incognito.js |
eslint no-unused-vars: ["error", {"args": "none", "varsIgnorePattern": "^(FindProxyForURL)$"}] |
2916 |
test_proxy_info_results.js |
|
11356 |
test_proxy_listener.js |
|
8221 |
test_proxy_userContextId.js |
|
1263 |
test_QuarantinedDomains.js |
|
11788 |
test_resistfingerprinting_exempt.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
996 |
test_StorageSyncService.js |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
7787 |
test_WebExtensionContentScript.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
14599 |
test_WebExtensionPolicy.js |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
16095 |
test_webRequest_ancestors.js |
|
2312 |
test_webRequest_cookies.js |
|
2850 |
test_webRequest_filtering.js |
/*_style_*"]) };
WebRequest.onBeforeRequest.addListener(onBeforeRequest, filter, ["blocking"]);
WebRequest.onBeforeSendHeaders.addListener(onBeforeSendHeaders, filter, [
"blocking",
]);
WebRequest.onResponseStarted.addListener(onResponseStarted, filter);
await openAndCloseContentPage(URL);
compareLists(requested, expected_urls, "requested");
compareLists(sendHeaders, expected_urls, "sendHeaders");
compareLists(completed, expected_urls, "completed");
WebRequest.onBeforeRequest.removeListener(onBeforeRequest);
WebRequest.onBeforeSendHeaders.removeListener(onBeforeSendHeaders);
WebRequest.onResponseStarted.removeListener(onResponseStarted);
});
add_task(async function filter_types() {
resetExpectations();
let filter = { types: ["stylesheet"] };
WebRequest.onBeforeRequest.addListener(onBeforeRequest, filter, ["blocking"]);
WebRequest.onBeforeSendHeaders.addListener(onBeforeSendHeaders, filter, [
"blocking",
]);
WebRequest.onResponseStarted.addListener(onResponseStarted, filter);
await openAndCloseContentPage(URL);
compareLists(requested, expected_urls, "requested");
compareLists(sendHeaders, expected_urls, "sendHeaders");
compareLists(completed, expected_urls, "completed");
WebRequest.onBeforeRequest.removeListener(onBeforeRequest);
WebRequest.onBeforeSendHeaders.removeListener(onBeforeSendHeaders);
WebRequest.onResponseStarted.removeListener(onResponseStarted);
});
add_task(async function filter_windowId() {
resetExpectations();
// Check that adding windowId will exclude non-matching requests.
// test_ext_webrequest_filter.html provides coverage for matching requests.
let filter = { urls: new MatchPatternSet(["*:// |
5833 |
webidl-api |
|
|
xpcshell-common-e10s.toml |
|
910 |
xpcshell-common.toml |
|
17835 |
xpcshell-content.toml |
|
3213 |
xpcshell-e10s.toml |
|
1132 |
xpcshell-legacy-ep.toml |
|
824 |
xpcshell-remote.toml |
|
1837 |
xpcshell-serviceworker.toml |
|
1347 |
xpcshell.toml |
|
3814 |