diff options
Diffstat (limited to 'toolkit/components/extensions/test')
131 files changed, 387 insertions, 331 deletions
diff --git a/toolkit/components/extensions/test/browser/browser_ext_background_serviceworker.js b/toolkit/components/extensions/test/browser/browser_ext_background_serviceworker.js index 153818f4de..6a39a668e7 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_background_serviceworker.js +++ b/toolkit/components/extensions/test/browser/browser_ext_background_serviceworker.js @@ -175,7 +175,7 @@ async function testServiceWorker({ extension, expectMessageReply }) { let msgFromV1 = await SpecialPowers.spawn( browser, [swRegInfo.scriptURL], - async url => { + async () => { const { active } = await content.navigator.serviceWorker.ready; const { port1, port2 } = new content.MessageChannel(); diff --git a/toolkit/components/extensions/test/browser/browser_ext_downloads_filters.js b/toolkit/components/extensions/test/browser/browser_ext_downloads_filters.js index 48dd6b88ee..a3ee11aa66 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_downloads_filters.js +++ b/toolkit/components/extensions/test/browser/browser_ext_downloads_filters.js @@ -10,7 +10,7 @@ async function testAppliedFilters(ext, expectedFilter, expectedFilterCount) { let filterCount = 0; let MockFilePicker = SpecialPowers.MockFilePicker; - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); MockFilePicker.displayDirectory = tempDir; MockFilePicker.returnValue = MockFilePicker.returnCancel; MockFilePicker.appendFiltersCallback = function (fp, val) { diff --git a/toolkit/components/extensions/test/browser/browser_ext_downloads_referrer.js b/toolkit/components/extensions/test/browser/browser_ext_downloads_referrer.js index 9690df6376..24d52dd8e0 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_downloads_referrer.js +++ b/toolkit/components/extensions/test/browser/browser_ext_downloads_referrer.js @@ -4,8 +4,8 @@ "use strict"; const URL_PATH = "browser/toolkit/components/extensions/test/browser/data"; -const TEST_URL = `http://example.com/${URL_PATH}/test_downloads_referrer.html`; -const DOWNLOAD_URL = `http://example.com/${URL_PATH}/test-download.txt`; +const TEST_URL = `https://example.com/${URL_PATH}/test_downloads_referrer.html`; +const DOWNLOAD_URL = `https://example.com/${URL_PATH}/test-download.txt`; async function triggerSaveAs({ selector }) { const contextMenu = window.document.getElementById("contentAreaContextMenu"); @@ -28,7 +28,7 @@ add_setup(() => { } let MockFilePicker = SpecialPowers.MockFilePicker; - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); registerCleanupFunction(function () { MockFilePicker.cleanup(); diff --git a/toolkit/components/extensions/test/browser/browser_ext_extension_page_tab_navigated.js b/toolkit/components/extensions/test/browser/browser_ext_extension_page_tab_navigated.js index 9742d42b2e..429d584a17 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_extension_page_tab_navigated.js +++ b/toolkit/components/extensions/test/browser/browser_ext_extension_page_tab_navigated.js @@ -73,7 +73,7 @@ function createTestExtPageScript(name) { // Triggers a WebRequest listener registered by the test extensions by // opening a tab on the given web page URL and then closing it after // it did load. -async function triggerWebRequestListener(webPageURL, pause) { +async function triggerWebRequestListener(webPageURL) { let webPageTab = await BrowserTestUtils.openNewForegroundTab( { gBrowser, diff --git a/toolkit/components/extensions/test/browser/browser_ext_management_themes.js b/toolkit/components/extensions/test/browser/browser_ext_management_themes.js index d3cfa536b8..7fc656f141 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_management_themes.js +++ b/toolkit/components/extensions/test/browser/browser_ext_management_themes.js @@ -91,7 +91,7 @@ add_task(async function test_management_themes() { return found; } - browser.test.onMessage.addListener(async msg => { + browser.test.onMessage.addListener(async () => { let theme = await getAddon("theme"); browser.test.assertEq( theme.description, diff --git a/toolkit/components/extensions/test/browser/browser_ext_themes_arrowpanels.js b/toolkit/components/extensions/test/browser/browser_ext_themes_arrowpanels.js index 6665fb3092..9ddd1d62d3 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_themes_arrowpanels.js +++ b/toolkit/components/extensions/test/browser/browser_ext_themes_arrowpanels.js @@ -23,7 +23,7 @@ function closeIdentityPopup() { // This test checks applied WebExtension themes that attempt to change // popup properties -add_task(async function test_popup_styling(browser, accDoc) { +add_task(async function test_popup_styling() { const POPUP_BACKGROUND_COLOR = "#FF0000"; const POPUP_TEXT_COLOR = "#008000"; const POPUP_BORDER_COLOR = "#0000FF"; @@ -50,7 +50,7 @@ add_task(async function test_popup_styling(browser, accDoc) { await BrowserTestUtils.withNewTab( { gBrowser, url: "https://example.com" }, - async function (browser) { + async function () { await extension.startup(); // Open the information arrow panel diff --git a/toolkit/components/extensions/test/browser/browser_ext_themes_incognito.js b/toolkit/components/extensions/test/browser/browser_ext_themes_incognito.js index d9beb0f9a8..6daa6dd812 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_themes_incognito.js +++ b/toolkit/components/extensions/test/browser/browser_ext_themes_incognito.js @@ -36,7 +36,7 @@ add_task(async function test_theme_incognito_not_allowed() { }, }; - browser.theme.onUpdated.addListener(info => { + browser.theme.onUpdated.addListener(() => { browser.test.log("got theme onChanged"); browser.test.fail("theme"); }); diff --git a/toolkit/components/extensions/test/browser/browser_ext_themes_ntp_colors_perwindow.js b/toolkit/components/extensions/test/browser/browser_ext_themes_ntp_colors_perwindow.js index 9d28cf50c8..3b739322d6 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_themes_ntp_colors_perwindow.js +++ b/toolkit/components/extensions/test/browser/browser_ext_themes_ntp_colors_perwindow.js @@ -71,10 +71,9 @@ function test_ntp_theme(browser, theme, isBrightText) { * Test whether a given browser has the default theme applied * * @param {object} browser to test against - * @param {string} url being tested * @returns {Promise} The task as a promise */ -function test_ntp_default_theme(browser, url) { +function test_ntp_default_theme(browser) { Services.ppmm.sharedData.flush(); return SpecialPowers.spawn( browser, diff --git a/toolkit/components/extensions/test/mochitest/chrome_cleanup_script.js b/toolkit/components/extensions/test/mochitest/chrome_cleanup_script.js index 9afa95f302..2c54bea61c 100644 --- a/toolkit/components/extensions/test/mochitest/chrome_cleanup_script.js +++ b/toolkit/components/extensions/test/mochitest/chrome_cleanup_script.js @@ -35,7 +35,7 @@ for (let win of iterBrowserWindows()) { initialTabs.set(win, new Set(getBrowserApp(win).tabs)); } -addMessageListener("check-cleanup", extensionId => { +addMessageListener("check-cleanup", () => { Services.console.unregisterListener(listener); let results = { diff --git a/toolkit/components/extensions/test/mochitest/file_indexedDB.html b/toolkit/components/extensions/test/mochitest/file_indexedDB.html index 65b7e0ad2f..ce4b96f079 100644 --- a/toolkit/components/extensions/test/mochitest/file_indexedDB.html +++ b/toolkit/components/extensions/test/mochitest/file_indexedDB.html @@ -15,7 +15,7 @@ request.onupgradeneeded = event => { let objectStore = db.createObjectStore(objectStoreName, {autoIncrement: 0}); request = objectStore.add(test.value, test.key); - request.onsuccess = event => { + request.onsuccess = () => { db.close(); window.postMessage("indexedDBCreated", "*"); }; diff --git a/toolkit/components/extensions/test/mochitest/file_simple_iframe_worker.html b/toolkit/components/extensions/test/mochitest/file_simple_iframe_worker.html index 2ecc24e648..d0c2f59844 100644 --- a/toolkit/components/extensions/test/mochitest/file_simple_iframe_worker.html +++ b/toolkit/components/extensions/test/mochitest/file_simple_iframe_worker.html @@ -11,12 +11,12 @@ fetch("file_simple_iframe.txt"); const worker = new Worker("file_simple_worker.js?iniframe=true"); -worker.onmessage = (msg) => { +worker.onmessage = () => { worker.postMessage("file_simple_iframe_worker.txt"); } const sharedworker = new SharedWorker("file_simple_sharedworker.js?iniframe=true"); -sharedworker.port.onmessage = (msg) => { +sharedworker.port.onmessage = () => { sharedworker.port.postMessage("file_simple_iframe_sharedworker.txt"); } sharedworker.port.start(); diff --git a/toolkit/components/extensions/test/mochitest/file_simple_webrequest_worker.html b/toolkit/components/extensions/test/mochitest/file_simple_webrequest_worker.html index a90c4509be..792fc5621b 100644 --- a/toolkit/components/extensions/test/mochitest/file_simple_webrequest_worker.html +++ b/toolkit/components/extensions/test/mochitest/file_simple_webrequest_worker.html @@ -11,12 +11,12 @@ fetch("file_simple_toplevel.txt"); const worker = new Worker("file_simple_worker.js"); -worker.onmessage = (msg) => { +worker.onmessage = () => { worker.postMessage("file_simple_worker.txt"); } const sharedworker = new SharedWorker("file_simple_sharedworker.js"); -sharedworker.port.onmessage = (msg) => { +sharedworker.port.onmessage = () => { dump(`postMessage to sharedworker\n`); sharedworker.port.postMessage("file_simple_sharedworker.txt"); } diff --git a/toolkit/components/extensions/test/mochitest/head_cookies.js b/toolkit/components/extensions/test/mochitest/head_cookies.js index 610c800c94..80c7f96266 100644 --- a/toolkit/components/extensions/test/mochitest/head_cookies.js +++ b/toolkit/components/extensions/test/mochitest/head_cookies.js @@ -30,7 +30,7 @@ async function testCookies(options) { let { url, domain, secure } = backgroundOptions; let failures = 0; - let tallyFailure = error => { + let tallyFailure = () => { failures++; }; diff --git a/toolkit/components/extensions/test/mochitest/head_webrequest.js b/toolkit/components/extensions/test/mochitest/head_webrequest.js index 9e6b5cc910..c40fd06619 100644 --- a/toolkit/components/extensions/test/mochitest/head_webrequest.js +++ b/toolkit/components/extensions/test/mochitest/head_webrequest.js @@ -200,7 +200,7 @@ function background(events) { } let listeners = { - onBeforeRequest(expected, details, result) { + onBeforeRequest(expected, details) { // Save some values to test request consistency in later events. browser.test.assertTrue( details.tabId !== undefined, @@ -263,7 +263,7 @@ function background(events) { } }, onBeforeRedirect() {}, - onSendHeaders(expected, details, result) { + onSendHeaders(expected, details) { if (expected.headers && expected.headers.request) { checkHeaders("request", expected, details); } @@ -287,7 +287,7 @@ function background(events) { onAuthRequired(expected, details, result) { result.authCredentials = expected.authInfo; }, - onCompleted(expected, details, result) { + onCompleted(expected, details) { // If we have already completed a GET request for this url, // and it was found, we expect for the response to come fromCache. // expected.cached may be undefined, force boolean. @@ -322,7 +322,7 @@ function background(events) { checkHeaders("response", expected, details); } }, - onErrorOccurred(expected, details, result) { + onErrorOccurred(expected, details) { if (expected.error) { if (Array.isArray(expected.error)) { browser.test.assertTrue( diff --git a/toolkit/components/extensions/test/mochitest/mochitest-common.toml b/toolkit/components/extensions/test/mochitest/mochitest-common.toml index 51a851a74b..782069a79c 100644 --- a/toolkit/components/extensions/test/mochitest/mochitest-common.toml +++ b/toolkit/components/extensions/test/mochitest/mochitest-common.toml @@ -130,6 +130,7 @@ skip-if = ["os == 'android'"] # only the current window is supported - bug 17959 ["test_ext_browserAction_openPopup_without_pref.html"] ["test_ext_browserSettings_overrideDocumentColors.html"] +skip-if = ["os == 'android'"] # bug 1876317 ["test_ext_browsingData_indexedDB.html"] skip-if = [ diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html index 4b5d90814c..b026ea6245 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html @@ -78,7 +78,7 @@ add_task(async function test_downloads_saveAs() { defaultFile.append(DOWNLOAD_FILENAME); const {MockFilePicker} = SpecialPowers; - MockFilePicker.init(window); + MockFilePicker.init(SpecialPowers.wrap(window).browsingContext); function mockFilePickerCallback(expectedStartingDir, pickedFile) { return fp => { diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_uniquify.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_uniquify.html index 99a6c48500..35a0bb13df 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_uniquify.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_uniquify.html @@ -42,7 +42,7 @@ add_task(async function test_downloads_uniquify() { unique.append("file_download(1).txt"); const {MockFilePicker} = SpecialPowers; - MockFilePicker.init(window); + MockFilePicker.init(SpecialPowers.wrap(window).browsingContext); MockFilePicker.returnValue = MockFilePicker.returnOK; MockFilePicker.showCallback = fp => { diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html index 65bf0a50d0..98a9fed30e 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html @@ -67,7 +67,7 @@ function makeTest(manifestPermissions, optionalPermissions, checkFetch = true) { let url = new URL(window.location.pathname, "http://example.com/"); fetch(url, {}).then(response => { browser.test.sendMessage("fetch.result", response.ok); - }).catch(err => { + }).catch(() => { browser.test.sendMessage("fetch.result", false); }); }, diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html index 4caa4d2464..3f824276d6 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html @@ -38,7 +38,7 @@ let testExtension = { "onCompleted", ]; - function listener(name, details) { + function listener(name) { // If we get anything, we failed. Removing the system principal check // in ext-webrequest triggers this failure. browser.test.fail(`received ${name}`); @@ -58,7 +58,7 @@ add_task(async function test_webRequest_chromeworker_events() { await extension.startup(); await new Promise(resolve => { let worker = new ChromeWorker("webrequest_chromeworker.js"); - worker.onmessage = event => { + worker.onmessage = () => { ok("chrome worker fetch finished"); resolve(); }; diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_mozextension.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_mozextension.html index 6a41b9cf08..36de902180 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_mozextension.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_mozextension.html @@ -82,7 +82,7 @@ add_task(async function test_webRequest_mozextension_fetch() { browser.test.sendMessage("request-complete"); }, {urls: [browser.runtime.getURL("*")]}); - browser.test.onMessage.addListener((msg, data) => { + browser.test.onMessage.addListener(() => { fetch(page).then(() => { browser.test.notifyPass("fetch success"); browser.test.sendMessage("done"); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html b/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html index c426913373..ac0ec974dc 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html @@ -27,7 +27,7 @@ add_task(async function test_api() { // This privileged test extension should not affect the webRequest // data received by non-privileged extensions (See Bug 1576272). browser.webRequest.onBeforeRequest.addListener( - details => { + () => { return { cancel: false }; }, { urls: ["http://mochi.test/*/file_sample.html"] }, @@ -79,7 +79,7 @@ add_task(async function test_api() { browser.storage.onChanged.removeListener(listen); // Test a parent event manager. - let webRequestListener = details => { + let webRequestListener = () => { browser.webRequest.onBeforeRequest.removeListener(webRequestListener); return { cancel: false }; }; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_async_clipboard.html b/toolkit/components/extensions/test/mochitest/test_ext_async_clipboard.html index 4bd8339357..708b5522c3 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_async_clipboard.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_async_clipboard.html @@ -154,7 +154,7 @@ add_task(async function test_contentscript_clipboard_permission_writetext() { clipboardWriteText(str).then(function() { // nothing here browser.test.sendMessage("ready"); - }, function(err) { + }, function() { browser.test.fail("WriteText promise rejected"); browser.test.sendMessage("ready"); }); // clipboardWriteText @@ -196,7 +196,7 @@ add_task(async function test_contentscript_clipboard_permission_readtext() { browser.test.fail("ReadText read the wrong thing from clipboard:" + strData); } browser.test.sendMessage("ready"); - }, function(err) { + }, function() { browser.test.fail("ReadText promise rejected"); browser.test.sendMessage("ready"); }); // clipboardReadText @@ -237,7 +237,7 @@ add_task(async function test_contentscript_clipboard_permission_write() { clipboardWrite([item]).then(function() { // nothing here browser.test.sendMessage("ready"); - }, function(err) { // clipboardWrite promise error function + }, function() { // clipboardWrite promise error function browser.test.fail("Write promise rejected"); browser.test.sendMessage("ready"); }); // clipboard write @@ -280,7 +280,7 @@ add_task(async function test_contentscript_clipboard_permission_read() { browser.test.fail("Read read the wrong string from clipboard:" + s); } browser.test.sendMessage("ready"); - }, function(err) { // clipboardRead promise error function + }, function() { // clipboardRead promise error function browser.test.fail("Read promise rejected"); browser.test.sendMessage("ready"); }); // clipboard read diff --git a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_indexedDB.html b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_indexedDB.html index f8ea41ddab..0d417cbb5f 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_indexedDB.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_indexedDB.html @@ -52,7 +52,7 @@ add_task(async function testIndexedDB() { // eslint-disable-next-line mozilla/balanced-listeners window.addEventListener( "message", - msg => { + () => { browser.test.sendMessage("indexedDBCreated"); }, true diff --git a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_localStorage.html b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_localStorage.html index 2fd608f125..0e36139f14 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_localStorage.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_localStorage.html @@ -177,7 +177,7 @@ add_task(async function testLocalStorage() { function awaitLoad(tabId) { return new Promise(resolve => { - browser.tabs.onUpdated.addListener(function listener(tabId_, changed, tab) { + browser.tabs.onUpdated.addListener(function listener(tabId_, changed) { if (tabId == tabId_ && changed.status == "complete") { browser.tabs.onUpdated.removeListener(listener); resolve(); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_serviceWorkers.html b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_serviceWorkers.html index d8ebd8e225..36ec448ccd 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_serviceWorkers.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_serviceWorkers.html @@ -33,7 +33,7 @@ add_task(async function testServiceWorkers() { const PAGE = "/tests/toolkit/components/extensions/test/mochitest/file_serviceWorker.html"; - browser.runtime.onMessage.addListener(msg => { + browser.runtime.onMessage.addListener(() => { browser.test.sendMessage("serviceWorkerRegistered"); }); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_settings.html b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_settings.html index 11c690e5bf..b36daf9b8d 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_browsingData_settings.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_browsingData_settings.html @@ -42,16 +42,16 @@ add_task(async function testSettings() { // Verify that we get the keys back we expect. isDeeply( Object.entries(settings.dataToRemove) - .filter(([key, value]) => value) - .map(([key, value]) => key) + .filter(([, value]) => value) + .map(([key]) => key) .sort(), SETTINGS_LIST, "dataToRemove contains expected properties." ); isDeeply( Object.entries(settings.dataRemovalPermitted) - .filter(([key, value]) => value) - .map(([key, value]) => key) + .filter(([, value]) => value) + .map(([key]) => key) .sort(), SETTINGS_LIST, "dataToRemove contains expected properties." diff --git a/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html b/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html index f87b5620d6..8d425656e0 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html @@ -14,7 +14,7 @@ add_task(async function test_contentscript() { function background() { - browser.runtime.onMessage.addListener(([script], sender) => { + browser.runtime.onMessage.addListener(([script]) => { browser.test.sendMessage("run", {script}); browser.test.sendMessage("run-" + script); }); @@ -65,7 +65,7 @@ add_task(async function test_contentscript() { let extension = ExtensionTestUtils.loadExtension(extensionData); let ran = 0; - extension.onMessage("run", ({script}) => { + extension.onMessage("run", () => { ran++; }); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_extension_iframe_messaging.html b/toolkit/components/extensions/test/mochitest/test_ext_extension_iframe_messaging.html index 403782ab7d..2b47a9c0f7 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_extension_iframe_messaging.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_extension_iframe_messaging.html @@ -72,7 +72,7 @@ add_task(async function test_moz_extension_iframe_messaging() { }, }, background() { - browser.test.onMessage.addListener(async msg => { + browser.test.onMessage.addListener(async () => { await browser.test.assertRejects( browser.runtime.sendMessage("from-background"), diff --git a/toolkit/components/extensions/test/mochitest/test_ext_redirect_jar.html b/toolkit/components/extensions/test/mochitest/test_ext_redirect_jar.html index 18ff14a6de..c21b18de95 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_redirect_jar.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_redirect_jar.html @@ -46,7 +46,7 @@ function getExtension() { }, background: async () => { let redirectUrl = browser.runtime.getURL("finished.html"); - browser.webRequest.onBeforeRequest.addListener(details => { + browser.webRequest.onBeforeRequest.addListener(() => { return {redirectUrl}; }, {urls: ["*://*/intercept*"]}, ["blocking"]); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html b/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html index a139e94687..fa4bd0a05d 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html @@ -115,7 +115,7 @@ add_task(async function teardown() { /* eslint-env mozilla/chrome-script */ // Cleanup cache await new Promise(resolve => { - Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve()); + Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, () => resolve()); }); const {UrlClassifierTestUtils} = ChromeUtils.importESModule( diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html index ffdbc90efb..6958e906b9 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html @@ -41,7 +41,7 @@ function background() { } let done_count = 0; - browser.runtime.onMessage.addListener((msg, sender, sendReply) => { + browser.runtime.onMessage.addListener((msg, sender) => { browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"), "sender url correct"); if (msg == "done") { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html index 8cce833b49..5da378de2b 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html @@ -54,7 +54,7 @@ function backgroundScript(token, id, otherId) { function contentScript(token, id, otherId) { let gotContentMessage = false; - browser.runtime.onMessage.addListener((msg, sender, sendReply) => { + browser.runtime.onMessage.addListener((msg, sender) => { browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`); browser.test.assertEq(`${token}-contentMessage`, msg, @@ -83,7 +83,7 @@ function contentScript(token, id, otherId) { async function tabScript(token, id, otherId) { let gotTabMessage = false; - browser.runtime.onMessage.addListener((msg, sender, sendReply) => { + browser.runtime.onMessage.addListener((msg, sender) => { browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`); if (String(msg).startsWith("content-")) { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_storage_cleanup.html b/toolkit/components/extensions/test/mochitest/test_ext_storage_cleanup.html index 33029cf61e..e6a885a3c7 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_storage_cleanup.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_storage_cleanup.html @@ -71,7 +71,7 @@ const storageTestHelpers = { reject(new Error(`indexedDB open failed with ${e.errorCode}`)); }; - req.onupgradeneeded = e => { + req.onupgradeneeded = () => { // no database, data is not present resolve(false); }; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_multiple.html b/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_multiple.html index d1bfbd824b..50d7d6cb7d 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_multiple.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_multiple.html @@ -53,7 +53,7 @@ add_task(async () => { filter.ondata = event => { filter.write(event.data); }; - filter.onstop = event => { + filter.onstop = () => { filter.write(new TextEncoder().encode(" End")); filter.close(); }; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_processswitch.html b/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_processswitch.html index 049178cad0..7240e01c02 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_processswitch.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_streamfilter_processswitch.html @@ -36,7 +36,7 @@ add_task(async () => { filter.ondata = event => { filter.write(event.data); }; - filter.onstop = event => { + filter.onstop = () => { filter.write(new TextEncoder().encode(" End")); filter.close(); }; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html b/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html index fd034f0b65..f791d08602 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html @@ -303,7 +303,7 @@ add_task(async function test_sub_subframe_conduit_verified_env() { `, }; - async function expectErrors(ext, log) { + async function expectErrors(ext) { let err = await ext.awaitMessage("content_child"); is(err, "Bad sender context envType: content_child"); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_tabs_executeScript_good.html b/toolkit/components/extensions/test/mochitest/test_ext_tabs_executeScript_good.html index 9b0f41f789..0704b93be9 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_tabs_executeScript_good.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_tabs_executeScript_good.html @@ -16,7 +16,7 @@ async function testHasPermission(params) { let contentSetup = params.contentSetup || (() => Promise.resolve()); async function background(contentSetup) { - browser.runtime.onMessage.addListener((msg, sender) => { + browser.runtime.onMessage.addListener((msg) => { browser.test.assertEq(msg, "script ran", "script ran"); browser.test.notifyPass("executeScript"); }); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_tabs_permissions.html b/toolkit/components/extensions/test/mochitest/test_ext_tabs_permissions.html index 217139f12b..062e3a79e3 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_tabs_permissions.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_tabs_permissions.html @@ -69,8 +69,7 @@ const helperExtensionDef = { hasTitleChangeInfo = false; browser.tabs.onUpdated.addListener(function listener( tabId, - changeInfo, - tab + changeInfo ) { if (changeInfo.url?.endsWith(message.data.urlHash)) { hasURLChangeInfo = true; @@ -413,7 +412,7 @@ async function test_restricted_properties( let hasURLChangeInfo = false, hasTitleChangeInfo = false; - function onUpdateListener(tabId, changeInfo, tab) { + function onUpdateListener(tabId, changeInfo) { if (changeInfo.url?.endsWith(urlHash)) { hasURLChangeInfo = true; } @@ -550,7 +549,7 @@ async function test_onUpdateFilter(testCases, permissions) { async background() { let listenerGotCalled = false; - function onUpdateListener(tabId, changeInfo, tab) { + function onUpdateListener() { listenerGotCalled = true; } diff --git a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_incognito.html b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_incognito.html index d1c41d2030..1009eb0496 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_incognito.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_incognito.html @@ -17,7 +17,7 @@ let image = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" + const IMAGE_ARRAYBUFFER = Uint8Array.from(image, byte => byte.charCodeAt(0)).buffer; async function testImageLoading(src, expectedAction) { - let imageLoadingPromise = new Promise((resolve, reject) => { + let imageLoadingPromise = new Promise((resolve) => { let cleanupListeners; let testImage = new window.Image(); // Set the src via wrappedJSObject so the load is triggered with the diff --git a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html index c13e40e265..c8ab397e4a 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html @@ -27,7 +27,7 @@ const IMAGE_ARRAYBUFFER = Uint8Array.from(image, byte => byte.charCodeAt(0)) const ANDROID = navigator.userAgent.includes("Android"); async function testImageLoading(src, expectedAction) { - let imageLoadingPromise = new Promise((resolve, reject) => { + let imageLoadingPromise = new Promise((resolve) => { let cleanupListeners; let testImage = document.createElement("img"); // Set the src via wrappedJSObject so the load is triggered with the diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_auth.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_auth.html index f260f040a1..ec5f00a18c 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_auth.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_auth.html @@ -79,13 +79,13 @@ add_task(async function test_webRequest_auth_nonblocking_forwardAuthProvider() { "nsIAuthPrompt2"]), getInterface: ChromeUtils.generateQI(["nsIAuthPromptProvider", "nsIAuthPrompt2"]), - promptAuth(channel, level, authInfo) { + promptAuth() { throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE); }, - getAuthPrompt(reason, iid) { + getAuthPrompt() { return this; }, - asyncPromptAuth(channel, callback, context, level, authInfo) { + asyncPromptAuth(channel, callback, context) { // We just cancel here, we're only ensuring that non-webrequest // notificationcallbacks get called if webrequest doesn't handle it. Promise.resolve().then(() => { @@ -138,10 +138,10 @@ add_task(async function test_webRequest_auth_nonblocking_forwardAuthPrompt2() { QueryInterface: ChromeUtils.generateQI(["nsIInterfaceRequestor", "nsIAuthPrompt2"]), getInterface: ChromeUtils.generateQI(["nsIAuthPrompt2"]), - promptAuth(request, level, authInfo) { + promptAuth() { throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE); }, - asyncPromptAuth(request, callback, context, level, authInfo) { + asyncPromptAuth(request) { // We just cancel here, we're only ensuring that non-webrequest // notificationcallbacks get called if webrequest doesn't handle it. Promise.resolve().then(() => { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html index 86cec62fb4..5ac3dccaa7 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html @@ -35,7 +35,7 @@ add_task(async function test_webRequest_serviceworker_events() { "onErrorOccurred", ]); - function listener(name, details) { + function listener(name) { browser.test.assertTrue(eventNames.has(name), `received ${name}`); eventNames.delete(name); if (name == "onCompleted") { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html index 9d57d55681..1e769a3156 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html @@ -303,7 +303,7 @@ add_task(async function test_webRequest_tabId() { add_task(async function test_webRequest_tabId_browser() { async function background(url) { let tabId; - browser.test.onMessage.addListener(async (msg, expected) => { + browser.test.onMessage.addListener(async (msg) => { if (msg == "create") { let tab = await browser.tabs.create({url}); tabId = tab.id; diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_errors.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_errors.html index cbfc5c17e7..d29638b408 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_errors.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_errors.html @@ -23,7 +23,7 @@ async function test_connection_refused(url, expectedError) { }, {urls: ["<all_urls>"]}); let tabId; - browser.test.onMessage.addListener(async (msg, expected) => { + browser.test.onMessage.addListener(async () => { await browser.tabs.remove(tabId); browser.test.sendMessage("done"); }); diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html index e66b5c471a..7b06a30551 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html @@ -15,13 +15,13 @@ function getExtension() { async function background() { let expect; let urls = ["*://*.example.org/tests/*"]; - browser.webRequest.onBeforeRequest.addListener(details => { + browser.webRequest.onBeforeRequest.addListener(() => { browser.test.assertEq(expect.shift(), "onBeforeRequest"); }, {urls}, ["blocking"]); - browser.webRequest.onBeforeSendHeaders.addListener(details => { + browser.webRequest.onBeforeSendHeaders.addListener(() => { browser.test.assertEq(expect.shift(), "onBeforeSendHeaders"); }, {urls}, ["blocking", "requestHeaders"]); - browser.webRequest.onSendHeaders.addListener(details => { + browser.webRequest.onSendHeaders.addListener(() => { browser.test.assertEq(expect.shift(), "onSendHeaders"); }, {urls}, ["requestHeaders"]); @@ -82,10 +82,10 @@ function getExtension() { } return {responseHeaders: headers}; }, {urls}, ["blocking", "responseHeaders"]); - browser.webRequest.onBeforeRedirect.addListener(details => { + browser.webRequest.onBeforeRedirect.addListener(() => { browser.test.assertEq(expect.shift(), "onBeforeRedirect"); }, {urls}); - browser.webRequest.onResponseStarted.addListener(details => { + browser.webRequest.onResponseStarted.addListener(() => { browser.test.assertEq(expect.shift(), "onResponseStarted"); }, {urls}); browser.webRequest.onCompleted.addListener(details => { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html index 87dbbd6598..7ba92f5c80 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_redirect_bypass_cors.html @@ -57,7 +57,7 @@ add_task(async function test_webRequest_redirect_cors_bypass() { let win = window.open(WIN_URL); // Creating a message channel to the new tab. const channel = new BroadcastChannel("test_bus"); - await new Promise((resolve, reject) => { + await new Promise((resolve) => { channel.onmessage = async function(fetch_result) { // Fetch result data will either be the text content of file_sample.txt -> 'Sample' // or a network-Error. diff --git a/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js b/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js index 14d3ad2bab..9fb71430bf 100644 --- a/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js +++ b/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js @@ -2,7 +2,7 @@ /* eslint-env worker */ -onmessage = function (event) { +onmessage = function () { fetch("https://example.com/example.txt").then(() => { postMessage("Done!"); }); diff --git a/toolkit/components/extensions/test/xpcshell/data/file_page_xhr.html b/toolkit/components/extensions/test/xpcshell/data/file_page_xhr.html index 387b5285f5..58b053f7d9 100644 --- a/toolkit/components/extensions/test/xpcshell/data/file_page_xhr.html +++ b/toolkit/components/extensions/test/xpcshell/data/file_page_xhr.html @@ -8,7 +8,7 @@ <script> "use strict"; -addEventListener("message", async function(event) { +addEventListener("message", async function() { const url = new URL("/return_headers.sjs", location).href; const webpageFetchResult = await fetch(url).then(res => res.json()); diff --git a/toolkit/components/extensions/test/xpcshell/data/file_permission_xhr.html b/toolkit/components/extensions/test/xpcshell/data/file_permission_xhr.html index 6f1bb4648b..8ae5955024 100644 --- a/toolkit/components/extensions/test/xpcshell/data/file_permission_xhr.html +++ b/toolkit/components/extensions/test/xpcshell/data/file_permission_xhr.html @@ -12,7 +12,7 @@ /* globals privilegedFetch, privilegedXHR */ /* eslint-disable mozilla/balanced-listeners */ -addEventListener("message", function rcv(event) { +addEventListener("message", function rcv() { removeEventListener("message", rcv, false); function assertTrue(condition, description) { diff --git a/toolkit/components/extensions/test/xpcshell/head.js b/toolkit/components/extensions/test/xpcshell/head.js index 6935e3f0da..ff58d36f7d 100644 --- a/toolkit/components/extensions/test/xpcshell/head.js +++ b/toolkit/components/extensions/test/xpcshell/head.js @@ -3,8 +3,9 @@ promiseQuotaManagerServiceReset, promiseQuotaManagerServiceClear, runWithPrefs, testEnv, withHandlingUserInput, resetHandlingUserInput, assertPersistentListeners, promiseExtensionEvent, assertHasPersistedScriptsCachedFlag, - assertIsPersistedScriptsCachedFlag - setup_crash_reporter_override_and_cleaner crashFrame crashExtensionBackground + assertIsPersistedScriptsCachedFlag, + setup_crash_reporter_override_and_cleaner, crashFrame, crashExtensionBackground, + makeRkvDatabaseDir */ var { AppConstants } = ChromeUtils.importESModule( @@ -81,6 +82,19 @@ var createHttpServer = (...args) => { return AddonTestUtils.createHttpServer(...args); }; +async function makeRkvDatabaseDir(name, { mockCorrupted = false } = {}) { + const databaseDir = PathUtils.join(PathUtils.profileDir, name); + await IOUtils.makeDirectory(databaseDir); + if (mockCorrupted) { + // Mock a corrupted db. + await IOUtils.write( + PathUtils.join(databaseDir, "data.safe.bin"), + new Uint8Array([0x00, 0x00, 0x00, 0x00]) + ); + } + return databaseDir; +} + // Some tests load non-moz-extension:-URLs in their extension document. When // extensions run in-process (extensions.webextensions.remote set to false), // that fails. @@ -285,7 +299,7 @@ function handlingUserInputFrameScript() { let handle; MessageChannel.addListener(this, "ExtensionTest:HandleUserInput", { - receiveMessage({ name, data }) { + receiveMessage({ data }) { if (data) { handle = content.windowUtils.setHandlingUserInput(true); } else if (handle) { @@ -367,7 +381,7 @@ const optionalPermissionsPromptHandler = { }); }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "webextension-optional-permission-prompt") { this.sawPrompt = true; let { resolve } = subject.wrappedJSObject; diff --git a/toolkit/components/extensions/test/xpcshell/head_schemas.js b/toolkit/components/extensions/test/xpcshell/head_schemas.js index 94af4a631a..b74d461444 100644 --- a/toolkit/components/extensions/test/xpcshell/head_schemas.js +++ b/toolkit/components/extensions/test/xpcshell/head_schemas.js @@ -102,7 +102,7 @@ function getContextWrapper(manifestVersion = 2) { }, preprocessors: { - localize(value, context) { + localize(value) { return value.replace( /__MSG_(.*?)__/g, (m0, m1) => `${m1.toUpperCase()}` @@ -118,7 +118,7 @@ function getContextWrapper(manifestVersion = 2) { return this.permissions.has(permission); }, - shouldInject(ns, name, allowedContexts) { + shouldInject(ns, name) { return name != "do-not-inject"; }, diff --git a/toolkit/components/extensions/test/xpcshell/head_service_worker.js b/toolkit/components/extensions/test/xpcshell/head_service_worker.js index aa1cf5cb18..771f3b1179 100644 --- a/toolkit/components/extensions/test/xpcshell/head_service_worker.js +++ b/toolkit/components/extensions/test/xpcshell/head_service_worker.js @@ -150,7 +150,7 @@ class TestWorkerWatcher extends ExtensionCommon.EventEmitter { } } - observe(subject, topic, childIDString) { + observe() { // Keep the watched process and related test child process actor updated // when a process is created or destroyed. this.getAndWatchExtensionProcess(); diff --git a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js b/toolkit/components/extensions/test/xpcshell/test_csp_validator.js index 12ba3f93e9..011628f027 100644 --- a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js +++ b/toolkit/components/extensions/test/xpcshell/test_csp_validator.js @@ -7,7 +7,7 @@ const cps = Cc["@mozilla.org/addons/content-policy;1"].getService( ); add_task(async function test_csp_validator_flags() { - let checkPolicy = (policy, flags, expectedResult, message = null) => { + let checkPolicy = (policy, flags, expectedResult) => { info(`Checking policy: ${policy}`); let result = cps.validateAddonCSP(policy, flags); @@ -76,7 +76,7 @@ add_task(async function test_csp_validator_flags() { }); add_task(async function test_csp_validator() { - let checkPolicy = (policy, expectedResult, message = null) => { + let checkPolicy = (policy, expectedResult) => { info(`Checking policy: ${policy}`); let result = cps.validateAddonCSP( @@ -199,7 +199,7 @@ add_task(async function test_csp_validator() { }); add_task(async function test_csp_validator_extension_pages() { - let checkPolicy = (policy, expectedResult, message = null) => { + let checkPolicy = (policy, expectedResult) => { info(`Checking policy: ${policy}`); // While Schemas.jsm uses Ci.nsIAddonContentPolicy.CSP_ALLOW_WASM, we don't diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js b/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js index fe385004ba..77be9b22bd 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js @@ -7,7 +7,7 @@ add_task(async function test_cleared_alarm_does_not_fire() { async function backgroundScript() { let ALARM_NAME = "test_ext_alarms"; - browser.alarms.onAlarm.addListener(alarm => { + browser.alarms.onAlarm.addListener(() => { browser.test.fail("cleared alarm does not fire"); browser.test.notifyFail("alarm-cleared"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_api_events_listener_calls_exceptions.js b/toolkit/components/extensions/test/xpcshell/test_ext_api_events_listener_calls_exceptions.js index 44ff592d83..02970f9144 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_api_events_listener_calls_exceptions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_api_events_listener_calls_exceptions.js @@ -141,6 +141,7 @@ add_task(async function test_api_listener_call_exception() { // catch with a failure if we are running the extension code as a side effect // of logging the error to the console service. const nonError = { + // eslint-disable-next-line getter-return get message() { browser.test.fail(`Unexpected extension code executed`); }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js b/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js index dfb5c4c415..9141aa89cb 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js @@ -1,10 +1,5 @@ "use strict"; -Services.prefs.setBoolPref( - "extensions.webextensions.background-delayed-startup", - true -); - AddonTestUtils.init(this); AddonTestUtils.overrideCertDB(); AddonTestUtils.createAppInfo( diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentScripts_register.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentScripts_register.js index c92ed11022..819b51ac8c 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentScripts_register.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentScripts_register.js @@ -305,7 +305,7 @@ add_task(async function test_contentscripts_unregister_on_context_unload() { add_task(async function test_contentscripts_register_js() { async function background() { browser.runtime.onMessage.addListener( - ([msg, expectedStates, readyState], sender) => { + ([msg, expectedStates, readyState]) => { if (msg == "chrome-namespace-ok") { browser.test.sendMessage(msg); return; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript.js index cb2f342d4e..734e084b57 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript.js @@ -12,7 +12,7 @@ ExtensionTestUtils.mockAppInfo(); add_task(async function test_contentscript_runAt() { function background() { browser.runtime.onMessage.addListener( - ([msg, expectedStates, readyState], sender) => { + ([msg, expectedStates, readyState]) => { if (msg == "chrome-namespace-ok") { browser.test.sendMessage(msg); return; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_context.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_context.js index fc27b84200..44ecde6fcd 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_context.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_context.js @@ -340,7 +340,7 @@ add_task(async function test_contentscript_context_valid_during_execution() { await extension.startup(); await extension.awaitMessage("content-script-ready"); - await contentPage.legacySpawn(extension.id, async extensionId => { + await contentPage.legacySpawn(extension.id, async () => { // Navigate so that the content page is frozen in the bfcache. this.content.location = "http://example.org/dummy?second"; }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_create_iframe.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_create_iframe.js index 41d9901c80..2bd475ec15 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_create_iframe.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_create_iframe.js @@ -5,7 +5,7 @@ server.registerDirectory("/data/", do_get_file("data")); add_task(async function test_contentscript_create_iframe() { function background() { - browser.runtime.onMessage.addListener((msg, sender) => { + browser.runtime.onMessage.addListener(msg => { let { name, availableAPIs, manifest, testGetManifest } = msg; let hasExtTabsAPI = availableAPIs.indexOf("tabs") > 0; let hasExtWindowsAPI = availableAPIs.indexOf("windows") > 0; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_importmap.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_importmap.js index ba7f7120d9..2f80840bf6 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_importmap.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_importmap.js @@ -52,7 +52,7 @@ server.registerPathHandler("/importmap.html", (request, response) => { response.write(importMapHtml); }); -server.registerPathHandler("/simple.js", (request, response) => { +server.registerPathHandler("/simple.js", () => { ok(false, "Unexpected request to /simple.js"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_module_import.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_module_import.js index 3e4e5dd983..80183567c4 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_module_import.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_module_import.js @@ -8,7 +8,7 @@ server.registerPathHandler("/dummy", (request, response) => { response.write("<!DOCTYPE html><html></html>"); }); -server.registerPathHandler("/script.js", (request, response) => { +server.registerPathHandler("/script.js", () => { ok(false, "Unexpected request to /script.js"); }); 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 3b8721ad8d..4ebe6df636 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js @@ -989,7 +989,7 @@ function awaitLoads(urlsPromise, origins) { } }); - observer = (channel, topic, data) => { + observer = channel => { if (expectedURLs) { checkChannel(channel.QueryInterface(Ci.nsIChannel)); } else { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js b/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js index 028f5b5638..7cb244aa3a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js @@ -18,7 +18,7 @@ class StubContext extends BaseContext { this.sandbox = Cu.Sandbox(global); } - logActivity(type, name, data) { + logActivity() { // no-op required by subclass } @@ -128,7 +128,7 @@ class Context extends BaseContext { this.sandbox = Cu.Sandbox(principal, { wantXrays: false }); } - logActivity(type, name, data) { + logActivity() { // no-op required by subclass } 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 a828584ced..2a36f51637 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js @@ -187,7 +187,7 @@ add_task(async function test_ExtensionPageContextChild_in_child_frame() { ); await extension.awaitMessage("extensionPageLoaded"); - await contentPage.legacySpawn(extension.id, async extensionId => { + await contentPage.legacySpawn(extension.id, async () => { let { ExtensionPageChild } = ChromeUtils.importESModule( "resource://gre/modules/ExtensionPageChild.sys.mjs" ); @@ -237,7 +237,7 @@ add_task(async function test_ExtensionPageContextChild_in_toplevel() { ); await extension.awaitMessage("extensionPageLoaded"); - await contentPage.legacySpawn(extension.id, async extensionId => { + await contentPage.legacySpawn(extension.id, async () => { let { ExtensionPageChild } = ChromeUtils.importESModule( "resource://gre/modules/ExtensionPageChild.sys.mjs" ); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_allowAllRequests.js b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_allowAllRequests.js index ccb380180f..b67b28a811 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_allowAllRequests.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_allowAllRequests.js @@ -18,7 +18,7 @@ add_setup(() => { const server = createHttpServer({ hosts: ["example.com", "example.net", "example.org"], }); -server.registerPathHandler("/never_reached", (req, res) => { +server.registerPathHandler("/never_reached", () => { Assert.ok(false, "Server should never have been reached"); }); server.registerPathHandler("/allowed", (req, res) => { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_download.js b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_download.js index cd24b75855..5a5ac79473 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_download.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_download.js @@ -2,7 +2,7 @@ let server = createHttpServer({ hosts: ["example.com"] }); let downloadReqCount = 0; -server.registerPathHandler("/downloadtest", (req, res) => { +server.registerPathHandler("/downloadtest", () => { ++downloadReqCount; }); 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 236cda4e37..4b7bebe188 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_modifyHeaders.js @@ -73,7 +73,7 @@ server.registerPathHandler("/setcookie", (req, res) => { res.setHeader("Set-Cookie", "second=serving; max-age=999", /* merge */ true); res.write(req.hasHeader("Cookie") ? req.getHeader("Cookie") : ""); }); -server.registerPathHandler("/empty", (req, res) => {}); +server.registerPathHandler("/empty", () => {}); add_setup(() => { Services.prefs.setBoolPref("extensions.manifestV3.enabled", true); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_webrequest.js b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_webrequest.js index 415ab42c5f..6573286d24 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dnr_webrequest.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dnr_webrequest.js @@ -8,7 +8,7 @@ add_setup(() => { const server = createHttpServer({ hosts: ["example.com", "redir"], }); -server.registerPathHandler("/never_reached", (req, res) => { +server.registerPathHandler("/never_reached", () => { Assert.ok(false, "Server should never have been reached"); }); server.registerPathHandler("/source", (req, res) => { @@ -223,7 +223,7 @@ add_task(async function redirect_with_webRequest_after_failing_dnr_redirect() { const VERY_LONG_STRING = "x".repeat(network_standard_url_max_length - 20); browser.webRequest.onBeforeRequest.addListener( - d => { + () => { return { redirectUrl: "http://redir/destination?by-webrequest" }; }, { urls: ["*://example.com/*"] }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dns.js b/toolkit/components/extensions/test/xpcshell/test_ext_dns.js index 4b8599b0c5..c9e9d29ed5 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dns.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dns.js @@ -14,7 +14,7 @@ AddonTestUtils.createAppInfo( "42" ); -function getExtension(background = undefined) { +function getExtension() { let manifest = { permissions: ["dns", "proxy"], }; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js index e2867d1f03..6bf313511a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js @@ -453,7 +453,7 @@ async function testHttpErrors(allowHttpErrors) { response.write(content); }); - function background(code) { + function background() { let dlid = 0; let expectedState; browser.test.onMessage.addListener(async options => { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_partitionKey.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_partitionKey.js index 3326ed0ce9..169a147e0d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_partitionKey.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_partitionKey.js @@ -29,7 +29,7 @@ let downloadDir; function observeDownloadChannel(uri, partitionKey, isPrivate) { return new Promise(resolve => { let observer = { - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "http-on-modify-request") { let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); if (httpChannel.URI.spec != uri) { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js index 37c497a9b6..2ca18abf86 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js @@ -77,7 +77,7 @@ function backgroundScript() { browser.test.sendMessage("ready"); } -async function clearDownloads(callback) { +async function clearDownloads() { let list = await Downloads.getList(Downloads.ALL); let downloads = await list.getAll(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js index 03288fb5d5..ae40faf909 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js @@ -62,7 +62,7 @@ function backgroundScript() { browser.test.sendMessage("ready"); } -async function clearDownloads(callback) { +async function clearDownloads() { let list = await Downloads.getList(Downloads.ALL); let downloads = await list.getAll(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_eventpage_messaging.js b/toolkit/components/extensions/test/xpcshell/test_ext_eventpage_messaging.js index c343f19a5c..b3ad24c461 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_eventpage_messaging.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_eventpage_messaging.js @@ -107,7 +107,7 @@ add_task(async function test_runtime_onConnect_cancels_suspend() { // extension API. This ensures that if the event page suspend is canceled, // that it was intentionally done by the listener, and not as a side // effect of an unrelated extension API call. - browser.runtime.onConnect.addListener(port => { + browser.runtime.onConnect.addListener(() => { // Set by extensionPageScript before runtime.connect(): globalThis.notify_extensionPage_got_onConnect(); }); @@ -162,7 +162,7 @@ add_task(async function test_runtime_Port_onMessage_cancels_suspend() { // that it was intentionally done by the listener, and not as a side // effect of an unrelated extension API call. browser.runtime.onConnect.addListener(port => { - port.onMessage.addListener(msg => { + port.onMessage.addListener(() => { // Set by extensionPageScript before runtime.connect(): globalThis.notify_extensionPage_got_port_onMessage(); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js b/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js index cd2eb4dbb7..25ac794d66 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js @@ -76,7 +76,7 @@ let fooExperimentFiles = { /* globals ExtensionAPI */ "parent.js": () => { this.foo = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { experiments: { foo: { @@ -129,7 +129,7 @@ let fooExperimentFiles = { onChildEvent: new EventManagerWithAssertions({ context, name: `experiments.foo.onChildEvent`, - register: fire => { + register: () => { return () => {}; }, }).api(), @@ -379,7 +379,7 @@ add_task(async function test_unbundled_experiments() { "parent.js": () => { this.crunk = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { experiments: { crunk: { @@ -395,7 +395,7 @@ add_task(async function test_unbundled_experiments() { "child.js": () => { this.crunk = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { experiments: { crunk: { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js b/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js index 048e675a3e..1e46e19527 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_i18n.js @@ -306,7 +306,7 @@ add_task(async function test_get_accept_languages() { } function background(checkResultsFn) { - browser.test.onMessage.addListener(([msg, expected]) => { + browser.test.onMessage.addListener(([, expected]) => { browser.i18n.getAcceptLanguages().then(results => { checkResultsFn("background", results, expected); @@ -316,7 +316,7 @@ add_task(async function test_get_accept_languages() { } function content(checkResultsFn) { - browser.test.onMessage.addListener(([msg, expected]) => { + browser.test.onMessage.addListener(([, expected]) => { browser.i18n.getAcceptLanguages().then(results => { checkResultsFn("contentScript", results, expected); @@ -392,7 +392,7 @@ add_task(async function test_get_ui_language() { } function background(getResultsFn, checkResultsFn) { - browser.test.onMessage.addListener(([msg, expected]) => { + browser.test.onMessage.addListener(([, expected]) => { checkResultsFn("background", getResultsFn(), expected); browser.test.sendMessage("background-done"); @@ -400,7 +400,7 @@ add_task(async function test_get_ui_language() { } function content(getResultsFn, checkResultsFn) { - browser.test.onMessage.addListener(([msg, expected]) => { + browser.test.onMessage.addListener(([, expected]) => { checkResultsFn("contentScript", getResultsFn(), expected); browser.test.sendMessage("content-done"); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_indexedDB_principal.js b/toolkit/components/extensions/test/xpcshell/test_ext_indexedDB_principal.js index f355b1d43a..2428dcc461 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_indexedDB_principal.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_indexedDB_principal.js @@ -30,13 +30,13 @@ add_task(async function test_indexedDB_principal() { let store = tx.objectStore("TestStore"); tx.oncomplete = () => browser.test.sendMessage("storage-created"); store.add("foo", "bar"); - tx.onerror = function (e) { + tx.onerror = function () { browser.test.fail(`Failed with error ${tx.error.message}`); // Don't wait for timeout browser.test.sendMessage("storage-created"); }; }; - request.onerror = function (e) { + request.onerror = function () { browser.test.fail(`Failed with error ${request.error.message}`); // Don't wait for timeout browser.test.sendMessage("storage-created"); @@ -52,7 +52,7 @@ add_task(async function test_indexedDB_principal() { dbRequest.onsuccess = function (e) { let db = e.target.result; let transaction = db.transaction("TestStore"); - transaction.onerror = function (e) { + transaction.onerror = function () { browser.test.fail( `Failed with error ${transaction.error.message}` ); @@ -60,7 +60,7 @@ add_task(async function test_indexedDB_principal() { }; let objectStore = transaction.objectStore("TestStore"); let request = objectStore.get("bar"); - request.onsuccess = function (event) { + request.onsuccess = function () { browser.test.assertEq( request.result, "foo", @@ -68,12 +68,12 @@ add_task(async function test_indexedDB_principal() { ); browser.test.notifyPass("done"); }; - request.onerror = function (e) { + request.onerror = function () { browser.test.fail(`Failed with error ${request.error.message}`); browser.test.notifyFail("done"); }; }; - dbRequest.onerror = function (e) { + dbRequest.onerror = function () { browser.test.fail(`Failed with error ${dbRequest.error.message}`); browser.test.notifyFail("done"); }; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_management.js b/toolkit/components/extensions/test/xpcshell/test_ext_management.js index 8fb6b0d9a1..89c3403f1f 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_management.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_management.js @@ -65,7 +65,7 @@ add_task(async function test_management_permission() { await testAvailable(); - browser.test.onMessage.addListener(async msg => { + browser.test.onMessage.addListener(async () => { browser.test.log("test with permission"); // get permission diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js b/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js index 45c981811b..0d923d60fa 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js @@ -59,7 +59,7 @@ add_task(async function setup() { add_task(async function test_management_uninstall_no_prompt() { function background() { - browser.test.onMessage.addListener(msg => { + browser.test.onMessage.addListener(() => { browser.management.uninstallSelf(); }); } @@ -82,7 +82,7 @@ add_task(async function test_management_uninstall_prompt_uninstall() { promptService._response = 0; function background() { - browser.test.onMessage.addListener(msg => { + browser.test.onMessage.addListener(() => { browser.management.uninstallSelf({ showConfirmDialog: true }); }); } @@ -114,7 +114,7 @@ add_task(async function test_management_uninstall_prompt_keep() { promptService._response = 1; function background() { - browser.test.onMessage.addListener(async msg => { + browser.test.onMessage.addListener(async () => { await browser.test.assertRejects( browser.management.uninstallSelf({ showConfirmDialog: true }), "User cancelled uninstall of extension", diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_messaging_startup.js b/toolkit/components/extensions/test/xpcshell/test_ext_messaging_startup.js index 120bebb431..59d6794c7f 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_messaging_startup.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_messaging_startup.js @@ -158,7 +158,7 @@ add_task(function test_onMessage() { } async function background() { - browser.runtime.onMessage.addListener((msg, sender) => { + browser.runtime.onMessage.addListener(msg => { browser.test.assertEq( msg, "ping", @@ -217,7 +217,7 @@ add_task(async function test_other_startup() { useAddonManager: "permanent", async background() { - browser.runtime.onMessage.addListener(msg => { + browser.runtime.onMessage.addListener(() => { browser.test.notifyPass("startup"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js b/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js index cb08a70151..5b6719a1b6 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js @@ -531,7 +531,7 @@ add_task(async function test_disconnect() { ); browser.test.sendMessage("message", msg); }); - port.onDisconnect.addListener(msgPort => { + port.onDisconnect.addListener(() => { browser.test.fail("onDisconnect should not be called for disconnect()"); }); browser.test.onMessage.addListener((what, payload) => { @@ -660,7 +660,7 @@ add_task(async function test_read_limit() { ); browser.test.sendMessage("result", "disconnected"); }); - port.onMessage.addListener(msg => { + port.onMessage.addListener(() => { browser.test.sendMessage("result", "message"); }); port.postMessage(PAYLOAD); @@ -881,7 +881,7 @@ add_task(async function test_connect_native_from_content_script() { ); browser.test.sendMessage("result", "disconnected"); }); - port.onMessage.addListener(msg => { + port.onMessage.addListener(() => { browser.test.sendMessage("result", "message"); }); port.postMessage({ test: "test" }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_notifications_incognito.js b/toolkit/components/extensions/test/xpcshell/test_ext_notifications_incognito.js index fda60c3a82..b287e0a6ad 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_notifications_incognito.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_notifications_incognito.js @@ -33,7 +33,7 @@ const mockAlertsService = { this.showAlert({ cookie, title, text, privateBrowsing }, alertListener); }, - closeAlert(name) { + closeAlert() { // This mock immediately close the alert on show, so this is empty. }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js index 7fb8d4ca07..948b75978a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js @@ -49,6 +49,32 @@ add_setup(async () => { AddonTestUtils.usePrivilegedSignatures = false; }); +add_task( + { + skip_if: () => ExtensionPermissions._useLegacyStorageBackend, + }, + async function test_permissions_rkv_recovery_rename() { + const databaseDir = await makeRkvDatabaseDir( + "extension-store-permissions", + { + mockCorrupted: true, + } + ); + const res = await ExtensionPermissions.get("@testextension"); + Assert.deepEqual( + res, + { permissions: [], origins: [] }, + "Expect ExtensionPermissions get promise to be resolved" + ); + Assert.ok( + await IOUtils.exists( + PathUtils.join(databaseDir, "data.safe.bin.corrupt") + ), + "Expect corrupt file to be found" + ); + } +); + add_task(async function test_permissions_on_startup() { let extensionId = "@permissionTest"; let extension = ExtensionTestUtils.loadExtension({ diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_persistent_events.js b/toolkit/components/extensions/test/xpcshell/test_ext_persistent_events.js index 07cc29bfe2..d1660ccb6d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_persistent_events.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_persistent_events.js @@ -41,7 +41,7 @@ const API = class extends ExtensionAPI { const FIRE_TOPIC = `fire-${namespace}.${event}`; - async function listener(subject, topic, data) { + async function listener(subject) { try { if (subject.wrappedJSObject.waitForBackground) { await fire.wakeup(); @@ -257,7 +257,7 @@ const global = this; async function promiseObservable(topic, count, fn = null) { let _countResolve; let results = []; - function listener(subject, _topic, data) { + function listener(subject, _topic) { const eventDetails = subject.wrappedJSObject; results.push(eventDetails); if (results.length > count) { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_privacy_disable.js b/toolkit/components/extensions/test/xpcshell/test_ext_privacy_disable.js index 637751f473..4e05954b7e 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_privacy_disable.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_privacy_disable.js @@ -32,7 +32,7 @@ function awaitEvent(eventName) { function awaitPrefChange(prefName) { return new Promise(resolve => { - let listener = args => { + let listener = () => { Preferences.ignore(prefName, listener); resolve(); }; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_authorization_via_proxyinfo.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_authorization_via_proxyinfo.js index 27f537b73b..e6d2653445 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_authorization_via_proxyinfo.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_authorization_via_proxyinfo.js @@ -73,7 +73,7 @@ add_task(async function test_webRequest_auth_proxy() { ); browser.webRequest.onAuthRequired.addListener( - details => { + () => { // Using proxyAuthorizationHeader should prevent an auth request coming to us in the extension. browser.test.fail("onAuthRequired"); }, 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 db041d20d0..4b1128a349 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_onauthrequired.js @@ -191,7 +191,7 @@ add_task(async function test_webRequest_auth_proxy_https() { let authReceived = false; browser.webRequest.onBeforeSendHeaders.addListener( - details => { + () => { if (authReceived) { browser.test.sendMessage("done"); return { cancel: true }; @@ -202,7 +202,7 @@ add_task(async function test_webRequest_auth_proxy_https() { ); browser.webRequest.onAuthRequired.addListener( - details => { + () => { authReceived = true; return { authCredentials: { username: "puser", password: "ppass" } }; }, @@ -241,14 +241,14 @@ add_task(async function test_webRequest_auth_proxy_https() { add_task(async function test_webRequest_auth_proxy_system() { async function background(port) { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.fail("onBeforeRequest"); }, { urls: ["<all_urls>"] } ); browser.webRequest.onAuthRequired.addListener( - details => { + () => { 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. diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_settings.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_settings.js index 33c91309f0..2db12c4b57 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_settings.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_settings.js @@ -45,13 +45,13 @@ add_task(async function test_proxy_settings() { { urls: ["http://example.com/*"] } ); browser.webRequest.onCompleted.addListener( - details => { + () => { browser.test.notifyPass("proxytest"); }, { urls: ["http://example.com/*"] } ); browser.webRequest.onErrorOccurred.addListener( - details => { + () => { browser.test.notifyFail("proxytest"); }, { urls: ["http://example.com/*"] } diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_socks.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_socks.js index 6ebd9fbfcc..fd0aff709a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_socks.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_socks.js @@ -46,7 +46,7 @@ class SocksClient { this.state = STATE_WAIT_GREETING; this.socket = socket; - socket.onclose = event => { + socket.onclose = () => { this.server.requestCompleted(this); }; socket.ondata = event => { @@ -566,7 +566,7 @@ add_task(async function test_webRequest_socks_proxy() { { urls: ["<all_urls>"] } ); browser.webRequest.onAuthRequired.addListener( - details => { + () => { // We should never get onAuthRequired for socks proxy browser.test.fail("onAuthRequired"); }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_startup.js b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_startup.js index 4130d407b7..3c48adf56d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_startup.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_startup.js @@ -175,7 +175,7 @@ add_task(async function webRequest_before_proxy() { function background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { return { redirectUrl: "data:,response_from_webRequest" }; }, { @@ -185,7 +185,7 @@ add_task(async function webRequest_before_proxy() { ["blocking"] ); browser.proxy.onRequest.addListener( - details => { + () => { browser.test.sendMessage("seen_proxy_request"); }, { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_redirects.js b/toolkit/components/extensions/test/xpcshell/test_ext_redirects.js index 7b950355f3..d563df5b53 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_redirects.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_redirects.js @@ -52,10 +52,10 @@ function onStopListener(channel) { } async function onModifyListener(originUrl, redirectToUrl) { - return TestUtils.topicObserved("http-on-modify-request", (subject, data) => { + return TestUtils.topicObserved("http-on-modify-request", subject => { let channel = subject.QueryInterface(Ci.nsIHttpChannel); return channel.URI && channel.URI.spec == originUrl; - }).then(([subject, data]) => { + }).then(([subject]) => { let channel = subject.QueryInterface(Ci.nsIHttpChannel); if (redirectToUrl) { channel.redirectTo(Services.io.newURI(redirectToUrl)); @@ -229,7 +229,7 @@ add_task(async function test_extension_302_redirect_web() { { urls: [serverUrl] } ); browser.webRequest.onHeadersReceived.addListener( - details => { + () => { browser.test.assertEq( expected.shift(), "onHeadersReceived", @@ -239,7 +239,7 @@ add_task(async function test_extension_302_redirect_web() { { urls: [serverUrl] } ); browser.webRequest.onResponseStarted.addListener( - details => { + () => { browser.test.assertEq( expected.shift(), "onResponseStarted", @@ -527,7 +527,7 @@ add_task(async function test_extension_redirect() { let myuri = browser.runtime.getURL("*"); let exturi = browser.runtime.getURL("finished.html"); browser.webRequest.onBeforeRequest.addListener( - details => { + () => { return { redirectUrl: exturi }; }, { urls: ["<all_urls>", myuri] }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js index c330aaafde..1b6d5c331b 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js @@ -51,7 +51,7 @@ function background() { } }); - browser.runtime.onUpdateAvailable.addListener(details => { + browser.runtime.onUpdateAvailable.addListener(() => { browser.test.sendMessage("reloading"); browser.runtime.reload(); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports.js b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports.js index 7365a13f93..d871acf2cf 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports.js @@ -17,7 +17,7 @@ add_task(async function test_port_disconnected_from_wrong_window() { done = true; }); - port.onDisconnect.addListener(err => { + port.onDisconnect.addListener(() => { if (port === ports[1]) { browser.test.log("Port 1 disconnected, sending message via port 2"); ports[2].postMessage("port-2-msg"); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports_gc.js b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports_gc.js index dd47744a97..ca63e683be 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports_gc.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_ports_gc.js @@ -56,7 +56,7 @@ let gcExperimentFiles = { ); /* globals ExtensionAPI */ this.gcHelper = class extends ExtensionAPI { - getAPI(context) { + getAPI() { let witnesses = new Map(); return { gcHelper: { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js index 2bbc9864d7..2f9f07046c 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js @@ -49,7 +49,7 @@ add_task(async function runtimeSendMessageReply() { } }); - browser.runtime.onMessage.addListener((msg, sender, respond) => { + browser.runtime.onMessage.addListener(msg => { if (msg == "respond-now") { // If a response from another listener is received first, this // exception should be ignored. Test fails if it is not. @@ -271,7 +271,7 @@ add_task(async function sendMessageResponseGC() { savedResolve("saved-resolve"); return; case "promise-never": - return new Promise(r => {}); + return new Promise(() => {}); case "callback-save": savedRespond = respond; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_same_site_redirects.js b/toolkit/components/extensions/test/xpcshell/test_ext_same_site_redirects.js index a3000e4e1f..f42a74e0bb 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_same_site_redirects.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_same_site_redirects.js @@ -97,7 +97,7 @@ server.registerPathHandler("/final", (request, response) => { function promiseFinalResponse() { Assert.deepEqual(receivedCookies, [], "Test starts without observed cookies"); return new Promise(resolve => { - server.registerPathHandler("/final_and_clean", (request, response) => { + server.registerPathHandler("/final_and_clean", request => { Assert.equal(request.host, SITE_FINAL); Assert.equal(getCookies(request), "", "Cookies cleaned up"); resolve(receivedCookies.splice(0)); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js index a89ddf0728..24fcf9e1a9 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js @@ -1898,7 +1898,7 @@ add_task(async function testDefaults() { let localWrapper = { manifestVersion: 2, cloneScope: global, - shouldInject(ns) { + shouldInject() { return true; }, getImplementation(ns, name) { @@ -1973,7 +1973,7 @@ add_task(async function testReturns() { const localWrapper = { manifestVersion: 2, cloneScope: global, - shouldInject(ns) { + shouldInject() { return true; }, getImplementation(ns, name) { @@ -2096,7 +2096,7 @@ add_task(async function testCrossOriginArguments() { let localWrapper = { manifestVersion: 2, cloneScope: sandbox, - shouldInject(ns) { + shouldInject() { return true; }, getImplementation(ns, name) { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_interactive.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_interactive.js index 986dc74bc5..712daecf72 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_interactive.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_interactive.js @@ -46,7 +46,7 @@ let experimentFiles = { /* globals ExtensionAPI */ "parent.js": () => { this.userinputtest = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { userinputtest: { test() {}, @@ -58,7 +58,7 @@ let experimentFiles = { "child.js": () => { this.userinputtest = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { userinputtest: { child() {}, 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 562ab5c36d..85e645e67b 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 @@ -41,7 +41,7 @@ add_task(async function () { ]; class FakeAPI extends ExtensionAPI { - getAPI(context) { + getAPI() { return { testManifestPermission: { get testProperty() { 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 e2da7e5a74..14cbca7443 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_privileged.js @@ -26,7 +26,7 @@ add_setup(async () => { ]; class API extends ExtensionAPI { - getAPI(context) { + getAPI() { return { privileged: { test: "hello", diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_roots.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_roots.js index 21434228a3..86f52bde7b 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_roots.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_roots.js @@ -149,7 +149,7 @@ let wrapper = { }, preprocessors: { - localize(value, context) { + localize(value) { return value.replace(/__MSG_(.*?)__/g, (m0, m1) => `${m1.toUpperCase()}`); }, }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_persistAcrossSessions.js b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_persistAcrossSessions.js index cae09b5d2e..1527be54d5 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_scripting_persistAcrossSessions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_scripting_persistAcrossSessions.js @@ -18,6 +18,18 @@ const { TestUtils } = ChromeUtils.importESModule( "resource://testing-common/TestUtils.sys.mjs" ); +add_task(async function test_scriptingstore_rkv_recovery_rename() { + ExtensionScriptingStore._getStoreForTesting()._uninitForTesting(); + const databaseDir = await makeRkvDatabaseDir("extension-store", { + mockCorrupted: true, + }); + await ExtensionScriptingStore._getStoreForTesting().lazyInit(); + Assert.ok( + await IOUtils.exists(PathUtils.join(databaseDir, "data.safe.bin.corrupt")), + "Expect corrupt file to be found" + ); +}); + const makeExtension = ({ manifest: manifestProps, ...otherProps }) => { return ExtensionTestUtils.loadExtension({ manifest: { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js index 8a6631f26b..2a2aead4b5 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js @@ -397,8 +397,7 @@ add_task(async function test_storage_local_data_migration() { Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, true ); - const filterByCategory = ([timestamp, category]) => - category === EVENT_CATEGORY; + const filterByCategory = ([, category]) => category === EVENT_CATEGORY; ok( !snapshot.parent || snapshot.parent.filter(filterByCategory).length === 0, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sanitizer.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sanitizer.js index 6c69ad1a4c..1150ed570d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sanitizer.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sanitizer.js @@ -81,7 +81,7 @@ add_task(async function test_sanitize_offlineApps_extension_indexedDB() { const store = tx.objectStore("TestStore"); return new Promise((resolve, reject) => { const req = store.get(k); - tx.oncomplete = evt => resolve(req.result); + tx.oncomplete = () => resolve(req.result); tx.onerror = evt => reject(evt.target.error); }); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js index 9e26eedfcf..64a325bf71 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js @@ -254,7 +254,7 @@ class KintoServer { } installCatchAll() { - this.httpServer.registerPathHandler("/", (request, response) => { + this.httpServer.registerPathHandler("/", request => { dump( `got request: ${request.method}:${request.path}?${request.queryString}\n` ); @@ -774,76 +774,65 @@ add_task(async function ensureCanSync_clearAll() { const extension2 = { id: extensionId2 }; await withContextAndServer(async function (context, server) { - await withSignedInUser( - loggedInUser, - async function (extensionStorageSync, fxaService) { - async function assertSetAndGetData(extension, data) { - await extensionStorageSync.set(extension, data, context); - let storedData = await extensionStorageSync.get( - extension, - Object.keys(data), - context - ); - const extId = extensionId; - deepEqual( - storedData, - data, - `${extId} should get back the data we set` - ); - } - - async function assertDataCleared(extension, keys) { - const storedData = await extensionStorageSync.get( - extension, - keys, - context - ); - deepEqual( - storedData, - {}, - `${extension.id} should have lost the data` - ); - } - - server.installCollection("storage-sync-crypto"); - server.etag = 1000; - - let newKeys = await extensionStorageSync.ensureCanSync([ - extensionId, - extensionId2, - ]); - ok( - newKeys.hasKeysFor([extensionId]), - `key isn't present for ${extensionId}` + await withSignedInUser(loggedInUser, async function (extensionStorageSync) { + async function assertSetAndGetData(extension, data) { + await extensionStorageSync.set(extension, data, context); + let storedData = await extensionStorageSync.get( + extension, + Object.keys(data), + context ); - ok( - newKeys.hasKeysFor([extensionId2]), - `key isn't present for ${extensionId2}` + const extId = extensionId; + deepEqual(storedData, data, `${extId} should get back the data we set`); + } + + async function assertDataCleared(extension, keys) { + const storedData = await extensionStorageSync.get( + extension, + keys, + context ); + deepEqual(storedData, {}, `${extension.id} should have lost the data`); + } - let posts = server.getPosts(); - equal(posts.length, 1); - assertPostedNewRecord(posts[0]); + server.installCollection("storage-sync-crypto"); + server.etag = 1000; + + let newKeys = await extensionStorageSync.ensureCanSync([ + extensionId, + extensionId2, + ]); + ok( + newKeys.hasKeysFor([extensionId]), + `key isn't present for ${extensionId}` + ); + ok( + newKeys.hasKeysFor([extensionId2]), + `key isn't present for ${extensionId2}` + ); - await assertSetAndGetData(extension, { "my-key": 1 }); - await assertSetAndGetData(extension2, { "my-key": 2 }); + let posts = server.getPosts(); + equal(posts.length, 1); + assertPostedNewRecord(posts[0]); - // Call cleanup for the first extension, to double check it has - // been wiped out even without an active extension context. - cleanUpForContext(extension, context); + await assertSetAndGetData(extension, { "my-key": 1 }); + await assertSetAndGetData(extension2, { "my-key": 2 }); - // clear everything. - await extensionStorageSync.clearAll(); + // Call cleanup for the first extension, to double check it has + // been wiped out even without an active extension context. + cleanUpForContext(extension, context); - // Assert that the data is gone for both the extensions. - await assertDataCleared(extension, ["my-key"]); - await assertDataCleared(extension2, ["my-key"]); + // clear everything. + await extensionStorageSync.clearAll(); - // should have been no posts caused by the clear. - posts = server.getPosts(); - equal(posts.length, 1); - } - ); + // Assert that the data is gone for both the extensions. + await assertDataCleared(extension, ["my-key"]); + await assertDataCleared(extension2, ["my-key"]); + + // should have been no posts caused by the clear. + posts = server.getPosts(); + equal(posts.length, 1); + }); }); await testExtension.unload(); @@ -1407,7 +1396,7 @@ add_task(async function checkSyncKeyRing_overwrites_on_conflict() { // overwrite it with our keys. const extensionId = uuid(); let extensionKey; - await withSyncContext(async function (context) { + await withSyncContext(async function () { await withServer(async function (server) { // The old device has this kbHash, which is very similar to the // current kbHash but with the last character changed. diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js index cfa49c334b..4ff080887f 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js @@ -90,7 +90,7 @@ async function test_multiple_pages() { contentPage = await ExtensionTestUtils.loadContentPage(url, { extension }); extension.sendMessage("page-loaded"); }); - extension.onMessage("remove-page", async url => { + extension.onMessage("remove-page", async () => { await contentPage.close(); extension.sendMessage("page-removed"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_userScripts_exports.js b/toolkit/components/extensions/test/xpcshell/test_ext_userScripts_exports.js index 5950377f85..d6aa7a038c 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_userScripts_exports.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_userScripts_exports.js @@ -225,7 +225,7 @@ add_task(async function test_apiScript_async_method() { browser.userScripts.onBeforeScript.addListener(script => { script.defineGlobals({ ...sharedTestAPIMethods, - testAPIMethod(param, cb, cb2, objWithCb) { + testAPIMethod(param, cb, cb2) { browser.test.assertEq( "function", typeof cb, @@ -696,7 +696,7 @@ add_task( getPrototypeOf() { throw new Error("Proxy's getPrototypeOf trap"); }, - get(target, prop, receiver) { + get() { throw new Error("Proxy's get trap"); }, }); 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 c616d162a5..578e69ebdf 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js @@ -14,7 +14,7 @@ server.registerPathHandler("/authenticate.sjs", (request, response) => { let realm = url.searchParams.get("realm") || "mochitest"; let proxy_realm = url.searchParams.get("proxy_realm"); - function checkAuthorization(authorization) { + function checkAuthorization() { let expected_user = url.searchParams.get("user"); if (!expected_user) { return true; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_cancelWithReason.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_cancelWithReason.js index a8405e5962..2ad729d0b4 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_cancelWithReason.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_cancelWithReason.js @@ -41,9 +41,9 @@ add_task(async function test_cancel_with_reason() { channel.asyncOpen({ QueryInterface: ChromeUtils.generateQI(["nsIStreamListener"]), - onStartRequest(request) {}, + onStartRequest() {}, - onStopRequest(request, statusCode) { + onStopRequest(request) { let properties = request.QueryInterface(Ci.nsIPropertyBag); let id = properties.getProperty("cancelledByExtension"); let reason = request.loadInfo.requestBlockingReason; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_download.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_download.js index 3485996f56..f1415ca87a 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_download.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_download.js @@ -15,7 +15,7 @@ add_task(async function testDownload() { }, background: async function () { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("request_intercepted"); return { cancel: true }; }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_filterResponseData.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_filterResponseData.js index 0b826be08f..0ca0b36de8 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_filterResponseData.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_filterResponseData.js @@ -371,7 +371,7 @@ add_task(async function test_filter_302() { let filter = browser.webRequest.filterResponseData(details.requestId); browser.test.sendMessage("filter-created"); - filter.ondata = event => { + filter.ondata = () => { const script = "forceError();"; filter.write(new Uint8Array(new TextEncoder().encode(script))); filter.close(); 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 bfb4b55856..17c22e156d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_permission.js @@ -47,7 +47,7 @@ add_task(async function test_permissions() { const frameScript = () => { const messageListener = { - async receiveMessage({ target, messageName, recipient, data, name }) { + async receiveMessage() { /* globals content */ let doc = content.document; let iframe = doc.createElement("iframe"); @@ -130,7 +130,7 @@ add_task(async function test_no_webRequestBlocking_error() { browser.test.assertThrows( () => { browser.webRequest[eventName].addListener( - details => {}, + () => {}, { urls: ["<all_urls>"] }, ["blocking"] ); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_redirectProperty.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_redirectProperty.js index 5a448abb2a..91d13e8296 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_redirectProperty.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_redirectProperty.js @@ -42,9 +42,9 @@ add_task(async function test_redirect_property() { channel.asyncOpen({ QueryInterface: ChromeUtils.generateQI(["nsIStreamListener"]), - onStartRequest(request) {}, + onStartRequest() {}, - onStopRequest(request, statusCode) { + onStopRequest(request) { let properties = request.QueryInterface(Ci.nsIPropertyBag); let id = properties.getProperty("redirectedByExtension"); resolve({ id, url: request.QueryInterface(Ci.nsIChannel).URI.spec }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_responseBody.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_responseBody.js index 8995870ba6..3f94615db9 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_responseBody.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_responseBody.js @@ -128,7 +128,7 @@ const TASKS = [ `(${num}): Got expected initial status` ); - filter.onstart = event => { + filter.onstart = () => { browser.test.assertEq( "transferringdata", filter.status, @@ -136,7 +136,7 @@ const TASKS = [ ); }; - filter.onstop = event => { + filter.onstop = () => { browser.test.fail( `(${num}): Got unexpected onStop event while disconnected` ); @@ -207,7 +207,7 @@ const TASKS = [ } }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -222,7 +222,7 @@ const TASKS = [ task(filter, resolve, num) { let decoder = new TextDecoder("utf-8"); - filter.onstop = event => { + filter.onstop = () => { browser.test.fail( `(${num}): Got unexpected onStop event while disconnected` ); @@ -254,7 +254,7 @@ const TASKS = [ } }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -269,7 +269,7 @@ const TASKS = [ task(filter, resolve, num) { let encoder = new TextEncoder(); - filter.onstop = event => { + filter.onstop = () => { browser.test.fail( `(${num}): Got unexpected onStop event while disconnected` ); @@ -330,7 +330,7 @@ const TASKS = [ } }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -346,7 +346,7 @@ const TASKS = [ let encoder = new TextEncoder(); let decoder = new TextDecoder("utf-8"); - filter.onstop = event => { + filter.onstop = () => { browser.test.fail(`(${num}): Got unexpected onStop event while closed`); }; @@ -406,7 +406,7 @@ const TASKS = [ } }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -422,11 +422,11 @@ const TASKS = [ let response = ""; let decoder = new TextDecoder("utf-8"); - filter.onstart = event => { + filter.onstart = () => { browser.test.log(`(${num}): Request start`); }; - filter.onstop = event => { + filter.onstop = () => { browser.test.assertEq( "finishedtransferringdata", filter.status, @@ -456,7 +456,7 @@ const TASKS = [ filter.write(event.data); }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -469,11 +469,11 @@ const TASKS = [ { url: "multipart", task(filter, resolve, num) { - filter.onstart = event => { + filter.onstart = () => { browser.test.log(`(${num}): Request start`); }; - filter.onstop = event => { + filter.onstop = () => { filter.disconnect(); resolve(); }; @@ -482,7 +482,7 @@ const TASKS = [ filter.write(event.data); }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -499,11 +499,11 @@ const TASKS = [ { url: "multipart2", task(filter, resolve, num) { - filter.onstart = event => { + filter.onstart = () => { browser.test.log(`(${num}): Request start`); }; - filter.onstop = event => { + filter.onstop = () => { filter.disconnect(); resolve(); }; @@ -512,7 +512,7 @@ const TASKS = [ filter.write(event.data); }; - filter.onerror = event => { + filter.onerror = () => { browser.test.fail( `(${num}): Got unexpected error event: ${filter.error}` ); @@ -628,7 +628,7 @@ add_task(async function test_cachedResponse() { data => { let filter = browser.webRequest.filterResponseData(data.requestId); - filter.onstop = event => { + filter.onstop = () => { filter.close(); }; filter.ondata = event => { @@ -669,7 +669,7 @@ add_task(async function test_late_close() { data => { let filter = browser.webRequest.filterResponseData(data.requestId); - filter.onstop = event => { + filter.onstop = () => { browser.test.fail("Should not receive onstop after close()"); browser.test.assertEq( "closed", diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_startup.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_startup.js index 616dc1fb50..2765fe949d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_startup.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_startup.js @@ -89,7 +89,7 @@ add_task(async function test_nonblocking() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] } @@ -163,7 +163,7 @@ add_task(async function test_eventpage_nonblocking() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] } @@ -237,7 +237,7 @@ add_task(async function test_persistent_blocking() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.fail("Listener should not have been called"); }, { urls: ["http://test1.example.com/*"] }, @@ -290,7 +290,7 @@ add_task(async function test_persistent_listener_after_sideload_upgrade() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] }, @@ -405,7 +405,7 @@ add_task( }); browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] }, @@ -501,14 +501,14 @@ add_task(async function test_persistent_listener_after_staged_upgrade() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] }, ["blocking"] ); browser.webRequest.onSendHeaders.addListener( - details => { + () => { browser.test.sendMessage("got-sendheaders"); }, { urls: ["http://example.com/data/file_sample.html"] } @@ -540,20 +540,20 @@ add_task(async function test_persistent_listener_after_staged_upgrade() { delete extensionData.manifest.optional_permissions; extensionData.background = function () { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] }, ["blocking"] ); browser.webRequest.onBeforeSendHeaders.addListener( - details => { + () => { browser.test.sendMessage("got-beforesendheaders"); }, { urls: ["http://example.com/data/file_sample.html"] } ); browser.webRequest.onSendHeaders.addListener( - details => { + () => { browser.test.sendMessage("got-sendheaders"); }, { urls: ["http://example.com/data/file_sample.html"] } @@ -688,7 +688,7 @@ add_task(async function test_persistent_listener_after_permission_removal() { background() { browser.webRequest.onBeforeRequest.addListener( - details => { + () => { browser.test.sendMessage("got-request"); }, { urls: ["http://example.com/data/file_sample.html"] }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js index f8116aced0..52af6a9b3d 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js @@ -31,7 +31,7 @@ add_task(async function test_suspend() { background() { browser.webRequest.onBeforeSendHeaders.addListener( - details => { + () => { // Make sure that returning undefined or a promise that resolves to // undefined does not break later handlers. }, @@ -40,7 +40,7 @@ add_task(async function test_suspend() { ); browser.webRequest.onBeforeSendHeaders.addListener( - details => { + () => { return Promise.resolve(); }, { urls: ["<all_urls>"] }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_viewsource.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_viewsource.js index 35b713e59b..5c59cbd924 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_viewsource.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_viewsource.js @@ -51,7 +51,7 @@ add_task(async function test_webRequest_viewsource() { ); browser.webRequest.onCompleted.addListener( - details => { + () => { // If cancel fails we get onCompleted. browser.test.fail("onCompleted received"); }, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_webSocket.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_webSocket.js index 7e34d2b0b3..1bd5b54f2b 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_webSocket.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_webSocket.js @@ -28,14 +28,14 @@ add_task(async function test_webSocket() { ["blocking"] ); - browser.test.onMessage.addListener(msg => { + browser.test.onMessage.addListener(() => { let ws = new WebSocket("ws://example.com/dummy"); - ws.onopen = e => { + ws.onopen = () => { ws.send("data"); }; - ws.onclose = e => {}; - ws.onerror = e => {}; - ws.onmessage = e => { + ws.onclose = () => {}; + ws.onerror = () => {}; + ws.onmessage = () => { ws.close(); }; }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_web_accessible_resources.js b/toolkit/components/extensions/test/xpcshell/test_ext_web_accessible_resources.js index 0b34dd8127..e7f35da711 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_web_accessible_resources.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_web_accessible_resources.js @@ -12,7 +12,7 @@ const IMAGE_ARRAYBUFFER = Uint8Array.from(image, byte => ).buffer; async function testImageLoading(src, expectedAction) { - let imageLoadingPromise = new Promise((resolve, reject) => { + let imageLoadingPromise = new Promise(resolve => { let cleanupListeners; let testImage = document.createElement("img"); // Set the src via wrappedJSObject so the load is triggered with the @@ -50,7 +50,7 @@ async function testImageLoading(src, expectedAction) { add_task(async function test_web_accessible_resources_csp() { function background() { - browser.runtime.onMessage.addListener((msg, sender) => { + browser.runtime.onMessage.addListener(msg => { if (msg.name === "image-loading") { browser.test.assertTrue(msg.success, `Image was ${msg.expectedAction}`); browser.test.sendMessage(`image-${msg.expectedAction}`); @@ -63,7 +63,7 @@ add_task(async function test_web_accessible_resources_csp() { } function content() { - window.addEventListener("message", function rcv(event) { + window.addEventListener("message", function rcv() { browser.runtime.sendMessage("script-ran"); window.removeEventListener("message", rcv); }); @@ -116,7 +116,7 @@ add_task(async function test_web_accessible_resources_csp() { await page.legacySpawn(null, () => { this.obs = { events: [], - observe(subject, topic, data) { + observe(subject) { this.events.push(subject.QueryInterface(Ci.nsIURI).spec); }, done() { diff --git a/toolkit/components/extensions/test/xpcshell/test_native_manifests.js b/toolkit/components/extensions/test/xpcshell/test_native_manifests.js index 6a6fb91e3f..1f5bc88740 100644 --- a/toolkit/components/extensions/test/xpcshell/test_native_manifests.js +++ b/toolkit/components/extensions/test/xpcshell/test_native_manifests.js @@ -313,7 +313,7 @@ add_task(async function test_manifest_with_invalid_utf_8() { ); equal(result, null, "lookupApplication should reject file with invalid UTF8"); let errorPattern = - /NotReadableError: Could not read file.* because it is not UTF-8 encoded/; + /NotReadableError: Could not read `.*': file is not UTF-8 encoded/; let utf8Errors = messages.filter(({ message }) => errorPattern.test(message)); equal(utf8Errors.length, 1, "lookupApplication logs error about UTF-8"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_proxy_failover.js b/toolkit/components/extensions/test/xpcshell/test_proxy_failover.js index bca71df63e..699b57b757 100644 --- a/toolkit/components/extensions/test/xpcshell/test_proxy_failover.js +++ b/toolkit/components/extensions/test/xpcshell/test_proxy_failover.js @@ -95,7 +95,7 @@ add_task(async function setup() { async function getProxyExtension(proxyDetails) { async function background(proxyDetails) { browser.proxy.onRequest.addListener( - details => { + () => { return proxyDetails; }, { urls: ["<all_urls>"] } @@ -165,7 +165,7 @@ add_task( contentUrl, `${contentUrl}?t=${Math.random()}` ) - .then(text => { + .then(() => { ok(false, "xhr unexpectedly completed"); }) .catch(e => { @@ -196,7 +196,7 @@ add_task( equal(req.proxy.type, "direct", "proxy failover to direct"); equal(req.text, "ok!", "xhr completed"); }) - .catch(req => { + .catch(() => { ok(false, "xhr failed"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js b/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js index 0a7e1422d2..7a4aea9c4f 100644 --- a/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js +++ b/toolkit/components/extensions/test/xpcshell/test_proxy_info_results.js @@ -57,14 +57,14 @@ async function testProxyResolution(test) { if (expected.error) { errorMsg = extension.awaitMessage("proxy-error-received"); } - let proxyInfo = await new Promise((resolve, reject) => { + let proxyInfo = await new Promise(resolve => { let channel = NetUtil.newChannel({ uri, loadUsingSystemPrincipal: true, }); gProxyService.asyncResolve(channel, 0, { - onProxyAvailable(req, uri, pi, status) { + onProxyAvailable(req, uri, pi) { resolve(pi && pi.QueryInterface(Ci.nsIProxyInfo)); }, }); @@ -186,14 +186,15 @@ add_task(async function test_proxyInfo_results() { { proxy: [ { - type: "http", + type: "socks", host: "foo.bar", port: 3128, proxyAuthorizationHeader: "test", }, ], expected: { - error: 'ProxyInfoData: ProxyAuthorizationHeader requires type "https"', + error: + 'ProxyInfoData: ProxyAuthorizationHeader requires type "https" or "http"', }, }, { @@ -447,6 +448,26 @@ add_task(async function test_proxyInfo_results() { }, }, }, + { + proxy: [ + { + type: "http", + host: "foo.bar", + port: 3128, + proxyAuthorizationHeader: "test", + connectionIsolationKey: "key", + }, + ], + expected: { + proxyInfo: { + host: "foo.bar", + port: "3128", + type: "http", + proxyAuthorizationHeader: "test", + connectionIsolationKey: "key", + }, + }, + }, ]; for (let test of tests) { await setupProxyResult(test.proxy); diff --git a/toolkit/components/extensions/test/xpcshell/test_proxy_listener.js b/toolkit/components/extensions/test/xpcshell/test_proxy_listener.js index 8cc46d45e7..ef72e9ab75 100644 --- a/toolkit/components/extensions/test/xpcshell/test_proxy_listener.js +++ b/toolkit/components/extensions/test/xpcshell/test_proxy_listener.js @@ -11,14 +11,14 @@ const TRANSPARENT_PROXY_RESOLVES_HOST = Ci.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST; function getProxyInfo(url = "http://www.mozilla.org/") { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let channel = NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true, }); gProxyService.asyncResolve(channel, 0, { - onProxyAvailable(req, uri, pi, status) { + onProxyAvailable(req, uri, pi) { resolve(pi); }, }); @@ -214,7 +214,7 @@ async function getExtension(expectedProxyInfo) { `testing proxy.onRequest with proxyInfo = ${JSON.stringify(proxyInfo)}` ); browser.proxy.onRequest.addListener( - details => { + () => { return proxyInfo; }, { urls: ["<all_urls>"] } diff --git a/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js b/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js index a7157f19a4..46a72a5926 100644 --- a/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js +++ b/toolkit/components/extensions/test/xpcshell/test_webRequest_filtering.js @@ -73,7 +73,7 @@ function compareLists(list1, list2, kind) { equal(String(list1), String(list2), `${kind} URLs correct`); } -async function openAndCloseContentPage(url) { +async function openAndCloseContentPage() { let contentPage = await ExtensionTestUtils.loadContentPage(URL); // Clear the sheet cache so that it doesn't interact with following tests: A // stylesheet with the same URI loaded from the same origin doesn't otherwise diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api.js index 489cc3a754..57aed8a700 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api.js @@ -55,7 +55,7 @@ add_task(async function test_propagated_extension_error() { throw err; } }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return { type: Ci.mozIExtensionAPIRequestResult.EXTENSION_ERROR, value: new Error("Fake Extension Error"), @@ -76,7 +76,7 @@ add_task(async function test_system_errors_donot_leak() { ); } - function mockAPIRequestHandler(policy, request) { + function mockAPIRequestHandler() { throw new Error("Fake handleAPIRequest exception"); } @@ -183,7 +183,7 @@ add_task(async function test_call_sync_fn_missing_return() { backgroundScript() { self.browser.mockExtensionAPI.methodSyncWithReturn("arg0"); }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return undefined; }, assertResults({ testError }) { @@ -208,7 +208,7 @@ add_task(async function test_call_async_throw_extension_error() { throw err; } }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return { type: Ci.mozIExtensionAPIRequestResult.EXTENSION_ERROR, value: new Error("Fake Param Validation Error"), @@ -233,7 +233,7 @@ add_task(async function test_call_async_reject_error() { throw err; } }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return { type: Ci.mozIExtensionAPIRequestResult.RETURN_VALUE, value: Promise.reject(new Error("Fake API rejected error object")), @@ -311,7 +311,7 @@ add_task(async function test_call_no_return_throw_extension_error() { throw err; } }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return { type: Ci.mozIExtensionAPIRequestResult.EXTENSION_ERROR, value: new Error("Fake Param Validation Error"), @@ -331,7 +331,7 @@ add_task(async function test_call_no_return_without_errors() { backgroundScript() { self.browser.mockExtensionAPI.methodNoReturn("arg0"); }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return undefined; }, assertResults({ testError }) { @@ -446,7 +446,7 @@ add_task(async function test_get_property() { backgroundScript() { return self.browser.mockExtensionAPI.propertyAsString; }, - mockAPIRequestHandler(policy, request) { + mockAPIRequestHandler() { return { type: Ci.mozIExtensionAPIRequestResult.RETURN_VALUE, value: "property-value", @@ -478,7 +478,7 @@ add_task(async function test_get_property() { value: ChromeUtils.createError("fake extension error", savedFrame), }; }, - assertResults({ testError, testResult }) { + assertResults({ testError }) { Assert.deepEqual(testError, null, "Got no error as expected"); }, } diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_event_callback.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_event_callback.js index 576ec760d3..88c89a77e0 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_event_callback.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_event_callback.js @@ -18,7 +18,7 @@ add_task(async function setup() { add_task(async function test_api_event_manager_methods() { await runExtensionAPITest("extension event manager methods", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testAsserts }) { const api = browser.mockExtensionAPI; const listener = () => {}; @@ -48,7 +48,7 @@ add_task(async function test_api_event_manager_methods() { ); } }, - assertResults({ testError, testResult }) { + assertResults({ testError }) { Assert.deepEqual(testError, null, "Got no error as expected"); }, }); @@ -104,7 +104,7 @@ add_task(async function test_api_event_eventListener_call_with_result() { await runExtensionAPITest( "extension event eventListener wrapper forwarded call result", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testLog }) { const api = browser.mockExtensionAPI; let listener; @@ -206,11 +206,11 @@ add_task(async function test_api_event_eventListener_result_rejected() { await runExtensionAPITest( "extension event eventListener throws (mozIExtensionCallback.call)", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testLog }) { const api = browser.mockExtensionAPI; let listener; - return new Promise((resolve, reject) => { + return new Promise(resolve => { testLog("addListener and wait for event to be fired"); listener = (msg, arg1) => { if (msg === "test-done") { @@ -263,7 +263,7 @@ add_task(async function test_api_event_eventListener_throws_on_call() { await runExtensionAPITest( "extension event eventListener throws (mozIExtensionCallback.call)", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testLog }) { const api = browser.mockExtensionAPI; let listener; @@ -280,7 +280,7 @@ add_task(async function test_api_event_eventListener_throws_on_call() { api.onTestEvent.addListener(listener); }); }, - assertResults({ testError, testResult }) { + assertResults({ testError }) { Assert.deepEqual(testError, null, "Got no error as expected"); }, mockAPIRequestHandler(policy, request) { @@ -305,7 +305,7 @@ add_task(async function test_send_response_eventListener() { await runExtensionAPITest( "extension event eventListener sendResponse eventListener argument", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testLog }) { const api = browser.mockExtensionAPI; let listener; @@ -353,14 +353,14 @@ add_task(async function test_send_response_eventListener() { add_task(async function test_send_response_multiple_eventListener() { await runExtensionAPITest("multiple extension event eventListeners", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testLog }) { const api = browser.mockExtensionAPI; let listenerNoReply; let listenerSendResponseReply; return new Promise(resolve => { testLog("addListener and wait for event to be fired"); - listenerNoReply = (msg, sendResponse) => { + listenerNoReply = () => { return false; }; listenerSendResponseReply = (msg, sendResponse) => { diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_request_handler.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_request_handler.js index 070a45fa95..4886db37d0 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_request_handler.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_request_handler.js @@ -29,7 +29,7 @@ add_task(async function test_sw_api_request_handling_local_process_api() { files: { "page.html": "<!DOCTYPE html><body></body>", "sw.js": async function () { - browser.test.onMessage.addListener(async msg => { + browser.test.onMessage.addListener(async () => { browser.test.succeed("call to test.succeed"); browser.test.assertTrue(true, "call to test.assertTrue"); browser.test.assertFalse(false, "call to test.assertFalse"); diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_errors.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_errors.js index d8684c1574..b532ca5203 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_errors.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_errors.js @@ -17,7 +17,7 @@ AddonTestUtils.createAppInfo( // is no JSON schema for this namespace so we add one here that is tailored for // our testing needs. const API = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { mockExtensionAPI: { methodAsync: () => { diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_formatters.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_formatters.js index a7310f345e..d6f0d83896 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_formatters.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_api_schema_formatters.js @@ -17,7 +17,7 @@ AddonTestUtils.createAppInfo( // is no JSON schema for this namespace so we add one here that is tailored for // our testing needs. const API = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { mockExtensionAPI: { methodAsync: files => { diff --git a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_runtime_port.js b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_runtime_port.js index 0d88014f32..1ca5994f60 100644 --- a/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_runtime_port.js +++ b/toolkit/components/extensions/test/xpcshell/webidl-api/test_ext_webidl_runtime_port.js @@ -16,7 +16,7 @@ add_task(async function setup() { add_task(async function test_method_return_runtime_port() { await runExtensionAPITest("API method returns an ExtensionPort instance", { - backgroundScript({ testAsserts, testLog }) { + backgroundScript({ testAsserts }) { try { browser.mockExtensionAPI.methodReturnsPort("port-create-error"); throw new Error("methodReturnsPort should have raised an exception"); |