diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/extensions | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz firefox-adbda400be353e676059e335c3c0aaf99e719475.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions')
192 files changed, 673 insertions, 607 deletions
diff --git a/toolkit/components/extensions/.eslintrc.js b/toolkit/components/extensions/.eslintrc.js index dfa4e2a7bf..8cc2d2a16f 100644 --- a/toolkit/components/extensions/.eslintrc.js +++ b/toolkit/components/extensions/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { globals: { - // These are defined in the WebExtension script scopes by ExtensionCommon.jsm + // These are defined in the WebExtension script scopes by ExtensionCommon.sys.mjs Cc: true, Ci: true, Cr: true, @@ -120,12 +120,6 @@ module.exports = { // Allow use of bitwise operators. "no-bitwise": "off", - // Disallow using the console API. - "no-console": "error", - - // Allow using constant expressions in conditions like while (true) - "no-constant-condition": "off", - // Allow use of the continue statement. "no-continue": "off", diff --git a/toolkit/components/extensions/ConduitsChild.sys.mjs b/toolkit/components/extensions/ConduitsChild.sys.mjs index c5774ab39c..598804f74a 100644 --- a/toolkit/components/extensions/ConduitsChild.sys.mjs +++ b/toolkit/components/extensions/ConduitsChild.sys.mjs @@ -4,7 +4,7 @@ /** * This @file implements the child side of Conduits, an abstraction over - * Fission IPC for extension API subject. See {@link ConduitsParent.jsm} + * Fission IPC for extension API subject. See {@link ConduitsParent.sys.mjs} * for more details about the overall design. * * @typedef {object} MessageData diff --git a/toolkit/components/extensions/Extension.sys.mjs b/toolkit/components/extensions/Extension.sys.mjs index 4bbaa56199..de6d4c8bfd 100644 --- a/toolkit/components/extensions/Extension.sys.mjs +++ b/toolkit/components/extensions/Extension.sys.mjs @@ -1459,8 +1459,7 @@ export class ExtensionData { }; if (this.fluentL10n || this.localeData) { - context.preprocessors.localize = (value, context) => - this.localize(value, locale); + context.preprocessors.localize = value => this.localize(value, locale); } return lazy.Schemas.normalize(this.rawManifest, manifestType, context); @@ -2665,8 +2664,8 @@ const PROXIED_EVENTS = new Set([ ]); class BootstrapScope { - install(data, reason) {} - uninstall(data, reason) { + install() {} + uninstall(data) { lazy.AsyncShutdown.profileChangeTeardown.addBlocker( `Uninstalling add-on: ${data.id}`, Management.emit("uninstall", { id: data.id }).then(() => { @@ -2746,8 +2745,8 @@ class BootstrapScope { } class DictionaryBootstrapScope extends BootstrapScope { - install(data, reason) {} - uninstall(data, reason) {} + install() {} + uninstall() {} startup(data, reason) { // eslint-disable-next-line no-use-before-define @@ -2762,9 +2761,9 @@ class DictionaryBootstrapScope extends BootstrapScope { } class LangpackBootstrapScope extends BootstrapScope { - install(data, reason) {} - uninstall(data, reason) {} - async update(data, reason) {} + install() {} + uninstall() {} + async update() {} startup(data, reason) { // eslint-disable-next-line no-use-before-define @@ -2780,8 +2779,8 @@ class LangpackBootstrapScope extends BootstrapScope { // TODO(Bug 1789718): Remove after the deprecated XPIProvider-based implementation is also removed. class SitePermissionBootstrapScope extends BootstrapScope { - install(data, reason) {} - uninstall(data, reason) {} + install() {} + uninstall() {} startup(data, reason) { // eslint-disable-next-line no-use-before-define @@ -3068,7 +3067,7 @@ export class Extension extends ExtensionData { return ExtensionCommon.checkLoadURL(url, this.principal, options); } - async promiseLocales(locale) { + async promiseLocales() { let locales = await StartupCache.locales.get( [this.id, "@@all_locales"], () => this._promiseLocaleMap() @@ -3206,7 +3205,7 @@ export class Extension extends ExtensionData { // Extended serialized data which is only needed in the extensions process, // and is never deserialized in web content processes. - // Keep in sync with BrowserExtensionContent in ExtensionChild.jsm + // Keep in sync with BrowserExtensionContent in ExtensionChild.sys.mjs serializeExtended() { return { backgroundScripts: this.backgroundScripts, @@ -3232,7 +3231,7 @@ export class Extension extends ExtensionData { children.delete(data.target); maybeResolve(); } - function observer(subject, topic, data) { + function observer(subject) { children.delete(subject); maybeResolve(); } @@ -3260,7 +3259,7 @@ export class Extension extends ExtensionData { sharedData.set(key, value); } - getSharedData(key, value) { + getSharedData(key) { key = `extension/${this.id}/${key}`; return sharedData.get(key); } @@ -3820,7 +3819,7 @@ export class Extension extends ExtensionData { return this.cleanupGeneratedFile(); } - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "xpcom-shutdown") { this.cleanupGeneratedFile(); } @@ -3852,7 +3851,7 @@ export class Extension extends ExtensionData { } export class Dictionary extends ExtensionData { - constructor(addonData, startupReason) { + constructor(addonData) { super(addonData.resourceURI); this.id = addonData.id; this.startupData = addonData.startupData; @@ -3862,7 +3861,7 @@ export class Dictionary extends ExtensionData { return new DictionaryBootstrapScope(); } - async startup(reason) { + async startup() { this.dictionaries = {}; for (let [lang, path] of Object.entries(this.startupData.dictionaries)) { let uri = Services.io.newURI( @@ -3886,7 +3885,7 @@ export class Dictionary extends ExtensionData { } export class Langpack extends ExtensionData { - constructor(addonData, startupReason) { + constructor(addonData) { super(addonData.resourceURI); this.startupData = addonData.startupData; this.manifestCacheKey = [addonData.id, addonData.version]; @@ -3896,7 +3895,7 @@ export class Langpack extends ExtensionData { return new LangpackBootstrapScope(); } - async promiseLocales(locale) { + async promiseLocales() { let locales = await StartupCache.locales.get( [this.id, "@@all_locales"], () => this._promiseLocaleMap() @@ -3911,7 +3910,7 @@ export class Langpack extends ExtensionData { ); } - async startup(reason) { + async startup() { this.chromeRegistryHandle = null; if (this.startupData.chromeEntries.length) { const manifestURI = Services.io.newURI( @@ -3971,7 +3970,7 @@ export class Langpack extends ExtensionData { // TODO(Bug 1789718): Remove after the deprecated XPIProvider-based implementation is also removed. export class SitePermission extends ExtensionData { - constructor(addonData, startupReason) { + constructor(addonData) { super(addonData.resourceURI); this.id = addonData.id; this.hasShutdown = false; @@ -4011,7 +4010,7 @@ export class SitePermission extends ExtensionData { ]; } - async startup(reason) { + async startup() { await this.loadManifest(); this.ensureNoErrors(); diff --git a/toolkit/components/extensions/ExtensionActions.sys.mjs b/toolkit/components/extensions/ExtensionActions.sys.mjs index 8e8cf3abd2..29a286442e 100644 --- a/toolkit/components/extensions/ExtensionActions.sys.mjs +++ b/toolkit/components/extensions/ExtensionActions.sys.mjs @@ -322,64 +322,64 @@ class PanelActionBase { * If it only changes a parameter for a single window, `target` will be that window. * Otherwise `target` will be null. * - * @param {XULElement|ChromeWindow|null} target + * @param {XULElement|ChromeWindow|null} _target * Browser tab or browser chrome window, may be null. */ - updateOnChange(target) {} + updateOnChange(_target) {} /** * Get tab object from tabId. * - * @param {string} tabId + * @param {string} _tabId * Internal id of the tab to get. */ - getTab(tabId) {} + getTab(_tabId) {} /** * Get window object from windowId * - * @param {string} windowId + * @param {string} _windowId * Internal id of the window to get. */ - getWindow(windowId) {} + getWindow(_windowId) {} /** * Gets the target object corresponding to the `details` parameter of the various * get* and set* API methods. * - * @param {object} details + * @param {object} _details * An object with optional `tabId` or `windowId` properties. - * @param {number} [details.tabId] - * @param {number} [details.windowId] + * @param {number} [_details.tabId] + * @param {number} [_details.windowId] * @throws if both `tabId` and `windowId` are specified, or if they are invalid. * @returns {XULElement|ChromeWindow|null} * If a `tabId` was specified, the corresponding XULElement tab. * If a `windowId` was specified, the corresponding ChromeWindow. * Otherwise, `null`. */ - getTargetFromDetails({ tabId, windowId }) { + getTargetFromDetails(_details) { return null; } /** * Triggers a click event. * - * @param {XULElement} tab + * @param {XULElement} _tab * The tab where this event should be fired. - * @param {object} clickInfo + * @param {object} _clickInfo * Extra data passed to the second parameter to the action API's * onClicked event. */ - dispatchClick(tab, clickInfo) {} + dispatchClick(_tab, _clickInfo) {} /** * Checks whether this action is shown. * - * @param {XULElement} tab + * @param {XULElement} _tab * The tab to be checked * @returns {boolean} */ - isShownForTab(tab) { + isShownForTab(_tab) { return false; } } @@ -481,7 +481,7 @@ export class PageActionBase extends PanelActionBase { return this.globals.pinned; } - getTargetFromDetails({ tabId, windowId }) { + getTargetFromDetails({ tabId }) { // PageActionBase doesn't support |windowId| if (tabId != null) { return this.getTab(tabId); diff --git a/toolkit/components/extensions/ExtensionChild.sys.mjs b/toolkit/components/extensions/ExtensionChild.sys.mjs index 20c3c8f2ab..70774db395 100644 --- a/toolkit/components/extensions/ExtensionChild.sys.mjs +++ b/toolkit/components/extensions/ExtensionChild.sys.mjs @@ -8,7 +8,7 @@ * This file handles addon logic that is independent of the chrome process and * may run in all web content and extension processes. * - * Don't put contentscript logic here, use ExtensionContent.jsm instead. + * Don't put contentscript logic here, use ExtensionContent.sys.mjs instead. */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; @@ -397,7 +397,7 @@ class BrowserExtensionContent extends EventEmitter { this.optionalPermissions = policy.optionalPermissions; if (WebExtensionPolicy.isExtensionProcess) { - // Keep in sync with serializeExtended in Extension.jsm + // Keep in sync with serializeExtended in Extension.sys.mjs let ed = this.getSharedData("extendedData"); this.backgroundScripts = ed.backgroundScripts; this.backgroundWorkerScript = ed.backgroundWorkerScript; @@ -449,7 +449,7 @@ class BrowserExtensionContent extends EventEmitter { return this.policy.allowedOrigins; } - getSharedData(key, value) { + getSharedData(key) { return sharedData.get(`extension/${this.id}/${key}`); } @@ -727,8 +727,8 @@ class ChildLocalAPIImplementation extends LocalAPIImplementation { // We create one instance of this class for every extension context that // needs to use remote APIs. It uses the the JSWindowActor and -// JSProcessActor Conduits actors (see ConduitsChild.jsm) to communicate -// with the ParentAPIManager singleton in ExtensionParent.jsm. +// JSProcessActor Conduits actors (see ConduitsChild.sys.mjs) to communicate +// with the ParentAPIManager singleton in ExtensionParent.sys.mjs. // It handles asynchronous function calls as well as event listeners. class ChildAPIManager { constructor(context, messageManager, localAPICan, contextData) { diff --git a/toolkit/components/extensions/ExtensionCommon.sys.mjs b/toolkit/components/extensions/ExtensionCommon.sys.mjs index 86c99042b6..512d1444a5 100644 --- a/toolkit/components/extensions/ExtensionCommon.sys.mjs +++ b/toolkit/components/extensions/ExtensionCommon.sys.mjs @@ -7,7 +7,7 @@ /** * This module contains utilities and base classes for logic which is * common between the parent and child process, and in particular - * between ExtensionParent.jsm and ExtensionChild.jsm. + * between ExtensionParent.sys.mjs and ExtensionChild.sys.mjs. */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; @@ -369,28 +369,28 @@ class ExtensionAPI extends EventEmitter { destroy() {} - /** @param {string} entryName */ - onManifestEntry(entryName) {} + /** @param {string} _entryName */ + onManifestEntry(_entryName) {} - /** @param {boolean} isAppShutdown */ - onShutdown(isAppShutdown) {} + /** @param {boolean} _isAppShutdown */ + onShutdown(_isAppShutdown) {} - /** @param {BaseContext} context */ - getAPI(context) { + /** @param {BaseContext} _context */ + getAPI(_context) { throw new Error("Not Implemented"); } - /** @param {string} id */ - static onDisable(id) {} + /** @param {string} _id */ + static onDisable(_id) {} - /** @param {string} id */ - static onUninstall(id) {} + /** @param {string} _id */ + static onUninstall(_id) {} /** - * @param {string} id - * @param {Record<string, JSONValue>} manifest + * @param {string} _id + * @param {Record<string, JSONValue>} _manifest */ - static onUpdate(id, manifest) {} + static onUpdate(_id, _manifest) {} } /** @@ -614,7 +614,7 @@ class BaseContext { // All child contexts must implement logActivity. This is handled if the child // context subclasses ExtensionBaseContextChild. ProxyContextParent overrides // this with a noop for parent contexts. - logActivity(type, name, data) { + logActivity() { throw new Error(`Not implemented for ${this.envType}`); } @@ -1033,7 +1033,7 @@ class BaseContext { /** * An object that runs the implementation of a schema API. Instantiations of - * this interfaces are used by Schemas.jsm. + * this interfaces are used by Schemas.sys.mjs. * * @interface */ @@ -1042,10 +1042,10 @@ class SchemaAPIInterface { * Calls this as a function that returns its return value. * * @abstract - * @param {Array} args The parameters for the function. + * @param {Array} _args The parameters for the function. * @returns {*} The return value of the invoked function. */ - callFunction(args) { + callFunction(_args) { throw new Error("Not implemented"); } @@ -1053,9 +1053,9 @@ class SchemaAPIInterface { * Calls this as a function and ignores its return value. * * @abstract - * @param {Array} args The parameters for the function. + * @param {Array} _args The parameters for the function. */ - callFunctionNoReturn(args) { + callFunctionNoReturn(_args) { throw new Error("Not implemented"); } @@ -1063,15 +1063,15 @@ class SchemaAPIInterface { * Calls this as a function that completes asynchronously. * * @abstract - * @param {Array} args The parameters for the function. - * @param {callback} [callback] The callback to be called when the function + * @param {Array} _args The parameters for the function. + * @param {callback} [_callback] The callback to be called when the function * completes. - * @param {boolean} [requireUserInput=false] If true, the function should + * @param {boolean} [_requireUserInput=false] If true, the function should * fail if the browser is not currently handling user input. * @returns {Promise|undefined} Must be void if `callback` is set, and a * promise otherwise. The promise is resolved when the function completes. */ - callAsyncFunction(args, callback, requireUserInput = false) { + callAsyncFunction(_args, _callback, _requireUserInput) { throw new Error("Not implemented"); } @@ -1089,9 +1089,9 @@ class SchemaAPIInterface { * Assigns the value to this as property. * * @abstract - * @param {string} value The new value of the property. + * @param {string} _value The new value of the property. */ - setProperty(value) { + setProperty(_value) { throw new Error("Not implemented"); } @@ -1099,11 +1099,11 @@ class SchemaAPIInterface { * Registers a `listener` to this as an event. * * @abstract - * @param {Function} listener The callback to be called when the event fires. - * @param {Array} args Extra parameters for EventManager.addListener. + * @param {Function} _listener The callback to be called when the event fires. + * @param {Array} _args Extra parameters for EventManager.addListener. * @see EventManager.addListener */ - addListener(listener, args) { + addListener(_listener, _args) { throw new Error("Not implemented"); } @@ -1111,11 +1111,11 @@ class SchemaAPIInterface { * Checks whether `listener` is listening to this as an event. * * @abstract - * @param {Function} listener The event listener. + * @param {Function} _listener The event listener. * @returns {boolean} Whether `listener` is registered with this as an event. * @see EventManager.hasListener */ - hasListener(listener) { + hasListener(_listener) { throw new Error("Not implemented"); } @@ -1123,10 +1123,10 @@ class SchemaAPIInterface { * Unregisters `listener` from this as an event. * * @abstract - * @param {Function} listener The event listener. + * @param {Function} _listener The event listener. * @see EventManager.removeListener */ - removeListener(listener) { + removeListener(_listener) { throw new Error("Not implemented"); } @@ -1865,7 +1865,7 @@ class SchemaAPIManager extends EventEmitter { { wantXrays: false, wantGlobalProperties: ["ChromeUtils"], - sandboxName: `Namespace of ext-*.js scripts for ${this.processType} (from: resource://gre/modules/ExtensionCommon.jsm)`, + sandboxName: `Namespace of ext-*.js scripts for ${this.processType} (from: resource://gre/modules/ExtensionCommon.sys.mjs)`, } ); @@ -2968,7 +2968,7 @@ class EventManager { // Simple API for event listeners where events never fire. function ignoreEvent(context, name) { return { - addListener: function (callback) { + addListener: function () { let id = context.extension.id; let frame = Components.stack.caller; let msg = `In add-on ${id}, attempting to use listener "${name}", which is unimplemented.`; @@ -2986,8 +2986,8 @@ function ignoreEvent(context, name) { ); Services.console.logMessage(scriptError); }, - removeListener: function (callback) {}, - hasListener: function (callback) {}, + removeListener: function () {}, + hasListener: function () {}, }; } diff --git a/toolkit/components/extensions/ExtensionContent.sys.mjs b/toolkit/components/extensions/ExtensionContent.sys.mjs index 131d555bf0..015d1bc7c6 100644 --- a/toolkit/components/extensions/ExtensionContent.sys.mjs +++ b/toolkit/components/extensions/ExtensionContent.sys.mjs @@ -787,7 +787,7 @@ var contentScripts = new DefaultWeakMap(matcher => { * An execution context for semi-privileged extension content scripts. * * This is the child side of the ContentScriptContextParent class - * defined in ExtensionParent.jsm. + * defined in ExtensionParent.sys.mjs. */ class ContentScriptContextChild extends BaseContext { constructor(extension, contentWindow) { @@ -1035,7 +1035,7 @@ DocumentManager = { }, observers: { - "inner-window-destroyed"(subject, topic, data) { + "inner-window-destroyed"(subject) { let windowId = subject.QueryInterface(Ci.nsISupportsPRUint64).data; // Close any existent content-script context for the destroyed window. diff --git a/toolkit/components/extensions/ExtensionDNR.sys.mjs b/toolkit/components/extensions/ExtensionDNR.sys.mjs index cd01d52b72..d18856a2b8 100644 --- a/toolkit/components/extensions/ExtensionDNR.sys.mjs +++ b/toolkit/components/extensions/ExtensionDNR.sys.mjs @@ -634,20 +634,20 @@ class ModifyHeadersBase { } /** - * @param {MatchedRule} matchedRule + * @param {MatchedRule} _matchedRule * @returns {object[]} */ - headerActionsFor(matchedRule) { + headerActionsFor(_matchedRule) { throw new Error("Not implemented."); } /** - * @param {MatchedRule} matchedrule - * @param {string} name - * @param {string} value - * @param {boolean} merge + * @param {MatchedRule} _matchedrule + * @param {string} _name + * @param {string} _value + * @param {boolean} _merge */ - setHeaderImpl(matchedrule, name, value, merge) { + setHeaderImpl(_matchedrule, _name, _value, _merge) { throw new Error("Not implemented."); } @@ -1913,7 +1913,7 @@ const NetworkIntegration = { maxEvaluatedRulesCount: 0, register() { - // We register via WebRequest.jsm to ensure predictable ordering of DNR and + // We register via WebRequest.sys.mjs to ensure predictable ordering of DNR and // WebRequest behavior. lazy.WebRequest.setDNRHandlingEnabled(true); }, @@ -2034,7 +2034,7 @@ const NetworkIntegration = { properties.setProperty("cancelledByExtension", addonId); }, - applyUpgradeScheme(channel, matchedRule) { + applyUpgradeScheme(channel) { // Request upgrade. No-op if already secure (i.e. https). channel.upgradeToSecure(); }, diff --git a/toolkit/components/extensions/ExtensionPageChild.sys.mjs b/toolkit/components/extensions/ExtensionPageChild.sys.mjs index d84459f1ed..17c208572b 100644 --- a/toolkit/components/extensions/ExtensionPageChild.sys.mjs +++ b/toolkit/components/extensions/ExtensionPageChild.sys.mjs @@ -299,7 +299,7 @@ class ExtensionPageContextChild extends ExtensionBaseContextChild { * APIs (provided that the correct permissions have been requested). * * This is the child side of the ExtensionPageContextParent class - * defined in ExtensionParent.jsm. + * defined in ExtensionParent.sys.mjs. * * @param {BrowserExtensionContent} extension This context's owner. * @param {object} params @@ -391,7 +391,7 @@ export var ExtensionPageChild = { Services.obs.addObserver(this, "inner-window-destroyed"); // eslint-ignore-line mozilla/balanced-listeners }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "inner-window-destroyed") { let windowId = subject.QueryInterface(Ci.nsISupportsPRUint64).data; diff --git a/toolkit/components/extensions/ExtensionParent.sys.mjs b/toolkit/components/extensions/ExtensionParent.sys.mjs index 22ba021e15..b4812a702a 100644 --- a/toolkit/components/extensions/ExtensionParent.sys.mjs +++ b/toolkit/components/extensions/ExtensionParent.sys.mjs @@ -7,7 +7,7 @@ /** * This module contains code for managing APIs that need to run in the * parent process, and handles the parent side of operations that need - * to be proxied from ExtensionChild.jsm. + * to be proxied from ExtensionChild.sys.mjs. */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; @@ -481,7 +481,7 @@ GlobalManager = { }; /** - * The proxied parent side of a context in ExtensionChild.jsm, for the + * The proxied parent side of a context in ExtensionChild.sys.mjs, for the * parent side of a proxied API. */ class ProxyContextParent extends BaseContext { @@ -625,7 +625,7 @@ class ProxyContextParent extends BaseContext { } } - logActivity(type, name, data) { + logActivity() { // The base class will throw so we catch any subclasses that do not implement. // We do not want to throw here, but we also do not log here. } @@ -685,14 +685,14 @@ class ProxyContextParent extends BaseContext { /** * The parent side of proxied API context for extension content script - * running in ExtensionContent.jsm. + * running in ExtensionContent.sys.mjs. */ class ContentScriptContextParent extends ProxyContextParent {} /** * The parent side of proxied API context for extension page, such as a * background script, a tab page, or a popup, running in - * ExtensionChild.jsm. + * ExtensionChild.sys.mjs. */ class ExtensionPageContextParent extends ProxyContextParent { constructor(envType, extension, params, browsingContext) { @@ -716,6 +716,7 @@ class ExtensionPageContextParent extends ProxyContextParent { if (this.viewType !== "background") { return this.appWindow; } + return undefined; } get tabId() { @@ -724,6 +725,7 @@ class ExtensionPageContextParent extends ProxyContextParent { if (data.tabId >= 0) { return data.tabId; } + return undefined; } unload() { @@ -739,7 +741,7 @@ class ExtensionPageContextParent extends ProxyContextParent { /** * The parent side of proxied API context for devtools extension page, such as a - * devtools pages and panels running in ExtensionChild.jsm. + * devtools pages and panels running in ExtensionChild.sys.mjs. */ class DevToolsExtensionPageContextParent extends ExtensionPageContextParent { constructor(...params) { @@ -904,7 +906,7 @@ ParentAPIManager = { extension.parentMessageManager = processMessageManager; }, - async observe(subject, topic, data) { + async observe(subject, topic) { if (topic === "message-manager-close") { let mm = subject; for (let [childId, context] of this.proxyContexts) { @@ -1035,7 +1037,7 @@ ParentAPIManager = { this.proxyContexts.set(childId, context); }, - recvContextLoaded(data, { actor, sender }) { + recvContextLoaded(data, { actor }) { let context = this.getContextById(data.childId); verifyActorForContext(actor, context); const { extension } = context; @@ -1794,7 +1796,7 @@ function promiseMessageFromChild(messageManager, messageName) { unregister(); resolve(message.data); } - function observer(subject, topic, data) { + function observer(subject) { if (subject === messageManager) { unregister(); reject( @@ -2022,7 +2024,7 @@ let IconDetails = { // Returns the appropriate icon URL for the given icons object and the // screen resolution of the given window. - getPreferredIcon(icons, extension = null, size = 16) { + getPreferredIcon(icons, extension, size = 16) { const DEFAULT = "chrome://mozapps/skin/extensions/extensionGeneric.svg"; let bestSize = null; @@ -2210,13 +2212,13 @@ var StartupCache = { this.manifests.delete(id), this.permissions.delete(id), this.menus.delete(id), - ]).catch(e => { + ]).catch(() => { // Ignore the error. It happens when we try to flush the add-on // data after the AddonManager has flushed the entire startup cache. }); }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "startupcache-invalidate") { this._data = new Map(); this._dataPromise = Promise.resolve(this._data); diff --git a/toolkit/components/extensions/ExtensionPermissions.sys.mjs b/toolkit/components/extensions/ExtensionPermissions.sys.mjs index 8308a4369a..1ee9afdc32 100644 --- a/toolkit/components/extensions/ExtensionPermissions.sys.mjs +++ b/toolkit/components/extensions/ExtensionPermissions.sys.mjs @@ -133,9 +133,10 @@ class PermissionStore { const storePath = lazy.FileUtils.getDir("ProfD", [RKV_DIRNAME]).path; // Make sure the folder exists await IOUtils.makeDirectory(storePath, { ignoreExisting: true }); - this._store = await lazy.KeyValueService.getOrCreate( + this._store = await lazy.KeyValueService.getOrCreateWithOptions( storePath, - "permissions" + "permissions", + { strategy: lazy.KeyValueService.RecoveryStrategy.RENAME } ); if (!(await this._store.has(VERSION_KEY))) { // If _shouldMigrateFromOldKVStorePath is true (default only on Nightly channel diff --git a/toolkit/components/extensions/ExtensionPolicyService.cpp b/toolkit/components/extensions/ExtensionPolicyService.cpp index 031abca444..370b0603d0 100644 --- a/toolkit/components/extensions/ExtensionPolicyService.cpp +++ b/toolkit/components/extensions/ExtensionPolicyService.cpp @@ -84,9 +84,9 @@ mozIExtensionProcessScript& ExtensionPolicyService::ProcessScript() { MOZ_ASSERT(NS_IsMainThread()); if (MOZ_UNLIKELY(!sProcessScript)) { - sProcessScript = - do_ImportModule("resource://gre/modules/ExtensionProcessScript.jsm", - "ExtensionProcessScript"); + sProcessScript = do_ImportESModule( + "resource://gre/modules/ExtensionProcessScript.sys.mjs", + "ExtensionProcessScript"); ClearOnShutdown(&sProcessScript); } return *sProcessScript; @@ -406,10 +406,9 @@ nsresult ExtensionPolicyService::InjectContentScripts( DocInfo docInfo(win); using RunAt = dom::ContentScriptRunAt; - namespace RunAtValues = dom::ContentScriptRunAtValues; using Scripts = AutoTArray<RefPtr<WebExtensionContentScript>, 8>; - Scripts scripts[RunAtValues::Count]; + Scripts scripts[ContiguousEnumSize<RunAt>::value]; auto GetScripts = [&](RunAt aRunAt) -> Scripts&& { static_assert(sizeof(aRunAt) == 1, "Our cast is wrong"); diff --git a/toolkit/components/extensions/ExtensionProcessScript.sys.mjs b/toolkit/components/extensions/ExtensionProcessScript.sys.mjs index 2fcf113a88..93746cb0ca 100644 --- a/toolkit/components/extensions/ExtensionProcessScript.sys.mjs +++ b/toolkit/components/extensions/ExtensionProcessScript.sys.mjs @@ -58,7 +58,7 @@ var ExtensionManager; ExtensionManager = { // WeakMap<WebExtensionPolicy, Map<number, WebExtensionContentScript>> - registeredContentScripts: new DefaultWeakMap(policy => new Map()), + registeredContentScripts: new DefaultWeakMap(() => new Map()), init() { Services.cpmm.addMessageListener("Extension:Startup", this); @@ -325,7 +325,7 @@ ExtensionManager = { if (!policy) { break; } - // In the parent process, Extension.jsm updates the policy. + // In the parent process, Extension.sys.mjs updates the policy. if (lazy.isContentProcess) { lazy.ExtensionCommon.updateAllowedOrigins( policy, diff --git a/toolkit/components/extensions/ExtensionScriptingStore.sys.mjs b/toolkit/components/extensions/ExtensionScriptingStore.sys.mjs index 444af8e41f..22e60d6440 100644 --- a/toolkit/components/extensions/ExtensionScriptingStore.sys.mjs +++ b/toolkit/components/extensions/ExtensionScriptingStore.sys.mjs @@ -33,9 +33,10 @@ class Store { ]); // Make sure the folder exists. await IOUtils.makeDirectory(storePath, { ignoreExisting: true }); - this._store = await lazy.KeyValueService.getOrCreate( + this._store = await lazy.KeyValueService.getOrCreateWithOptions( storePath, - "scripting-contentScripts" + "scripting-contentScripts", + { strategy: lazy.KeyValueService.RecoveryStrategy.RENAME } ); } @@ -47,6 +48,11 @@ class Store { return this._initPromise; } + _uninitForTesting() { + this._store = null; + this._initPromise = null; + } + /** * Returns all the stored scripts for a given extension (ID). * diff --git a/toolkit/components/extensions/ExtensionStorage.sys.mjs b/toolkit/components/extensions/ExtensionStorage.sys.mjs index 4155fbaa24..b1b09d137f 100644 --- a/toolkit/components/extensions/ExtensionStorage.sys.mjs +++ b/toolkit/components/extensions/ExtensionStorage.sys.mjs @@ -398,7 +398,7 @@ export var ExtensionStorage = { Services.obs.addObserver(this, "xpcom-shutdown"); }, - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "xpcom-shutdown") { Services.obs.removeObserver(this, "extension-invalidate-storage-cache"); Services.obs.removeObserver(this, "xpcom-shutdown"); diff --git a/toolkit/components/extensions/ExtensionStorageIDB.sys.mjs b/toolkit/components/extensions/ExtensionStorageIDB.sys.mjs index 26df3eacdb..604d29b4cf 100644 --- a/toolkit/components/extensions/ExtensionStorageIDB.sys.mjs +++ b/toolkit/components/extensions/ExtensionStorageIDB.sys.mjs @@ -257,7 +257,7 @@ class ExtensionStorageLocalIDB extends IndexedDB { }; changed = true; } catch (err) { - transactionCompleted.catch(err => { + transactionCompleted.catch(() => { // We ignore this rejection because we are explicitly aborting the transaction, // the transaction.error will be null, and we throw the original error below. }); diff --git a/toolkit/components/extensions/ExtensionStorageSync.sys.mjs b/toolkit/components/extensions/ExtensionStorageSync.sys.mjs index d41cf5af12..3f82d91fac 100644 --- a/toolkit/components/extensions/ExtensionStorageSync.sys.mjs +++ b/toolkit/components/extensions/ExtensionStorageSync.sys.mjs @@ -174,7 +174,7 @@ export class ExtensionStorageSync { return this._promisify("getBytesInUse", extension, context, keys); } - addOnChangedListener(extension, listener, context) { + addOnChangedListener(extension, listener) { let listeners = this.listeners.get(extension.id) || new Set(); listeners.add(listener); this.listeners.set(extension.id, listeners); diff --git a/toolkit/components/extensions/ExtensionStorageSyncKinto.sys.mjs b/toolkit/components/extensions/ExtensionStorageSyncKinto.sys.mjs index d10b140f7e..ace6e16c2c 100644 --- a/toolkit/components/extensions/ExtensionStorageSyncKinto.sys.mjs +++ b/toolkit/components/extensions/ExtensionStorageSyncKinto.sys.mjs @@ -42,6 +42,7 @@ ChromeUtils.defineESModuleGetters(lazy, { CryptoUtils: "resource://services-crypto/utils.sys.mjs", ExtensionCommon: "resource://gre/modules/ExtensionCommon.sys.mjs", FirefoxAdapter: "resource://services-common/kinto-storage-adapter.sys.mjs", + Kinto: "resource://services-common/kinto-offline-client.sys.mjs", KintoHttpClient: "resource://services-common/kinto-http-client.sys.mjs", Observers: "resource://services-common/observers.sys.mjs", Utils: "resource://services-sync/util.sys.mjs", @@ -54,9 +55,6 @@ ChromeUtils.defineESModuleGetters(lazy, { * @typedef {any} KeyBundle * @typedef {any} SyncResultObject */ -XPCOMUtils.defineLazyModuleGetters(lazy, { - Kinto: "resource://services-common/kinto-offline-client.js", -}); ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => { return ChromeUtils.importESModule( @@ -434,7 +432,7 @@ const cryptoCollectionIdSchema = { throw new Error("cannot generate IDs for system collection"); }, - validate(id) { + validate() { return true; }, }; diff --git a/toolkit/components/extensions/ExtensionTelemetry.sys.mjs b/toolkit/components/extensions/ExtensionTelemetry.sys.mjs index 06137b9a23..57f052372c 100644 --- a/toolkit/components/extensions/ExtensionTelemetry.sys.mjs +++ b/toolkit/components/extensions/ExtensionTelemetry.sys.mjs @@ -104,7 +104,7 @@ export function getErrorNameForTelemetry(error) { class ExtensionTelemetryMetric { constructor(metric) { this.metric = metric; - this.gleanTimerIdsMap = new DefaultWeakMap(ext => new WeakMap()); + this.gleanTimerIdsMap = new DefaultWeakMap(() => new WeakMap()); } // Stopwatch methods. @@ -325,7 +325,7 @@ const metricsCache = new Map(); * ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension}); */ export var ExtensionTelemetry = new Proxy(metricsCache, { - get(target, prop, receiver) { + get(target, prop) { // NOTE: if we would be start adding glean probes that do not have a unified // telemetry histogram counterpart, we would need to change this check // accordingly. diff --git a/toolkit/components/extensions/ExtensionTestCommon.sys.mjs b/toolkit/components/extensions/ExtensionTestCommon.sys.mjs index 94cb801cc5..701a85d97b 100644 --- a/toolkit/components/extensions/ExtensionTestCommon.sys.mjs +++ b/toolkit/components/extensions/ExtensionTestCommon.sys.mjs @@ -100,7 +100,7 @@ export class MockExtension { this._extensionPromise.then(extension => { extension.on(...args); }); - // Extension.jsm emits a "startup" event on |extension| before emitting the + // Extension.sys.mjs emits a "startup" event on |extension| before emitting the // "startup" event on |apiManager|. Trigger the "startup" event anyway, to // make sure that the MockExtension behaves like an Extension with regards // to the startup event. diff --git a/toolkit/components/extensions/ExtensionUtils.sys.mjs b/toolkit/components/extensions/ExtensionUtils.sys.mjs index cbdf900d14..45f22aa530 100644 --- a/toolkit/components/extensions/ExtensionUtils.sys.mjs +++ b/toolkit/components/extensions/ExtensionUtils.sys.mjs @@ -241,7 +241,7 @@ function promiseEvent( element, eventName, useCapture = true, - test = event => true + test = () => true ) { return new Promise(resolve => { function listener(event) { diff --git a/toolkit/components/extensions/ExtensionWorkerChild.sys.mjs b/toolkit/components/extensions/ExtensionWorkerChild.sys.mjs index f93f6968e9..44188d7ddb 100644 --- a/toolkit/components/extensions/ExtensionWorkerChild.sys.mjs +++ b/toolkit/components/extensions/ExtensionWorkerChild.sys.mjs @@ -266,7 +266,7 @@ class ChildLocalWebIDLAPIImplementation extends ChildLocalAPIImplementation { throw new Error("Unexpected call to setProperty"); } - hasListener(listener) { + hasListener() { // hasListener is implemented in C++ by ExtensionEventManager, and so // a call to this method is unexpected. throw new Error("Unexpected call to hasListener"); diff --git a/toolkit/components/extensions/ExtensionXPCShellUtils.sys.mjs b/toolkit/components/extensions/ExtensionXPCShellUtils.sys.mjs index 165c37fac1..27323dc8b3 100644 --- a/toolkit/components/extensions/ExtensionXPCShellUtils.sys.mjs +++ b/toolkit/components/extensions/ExtensionXPCShellUtils.sys.mjs @@ -457,10 +457,10 @@ class AOMExtensionWrapper extends ExtensionWrapper { /** * Override for subclasses which don't set an ID in the constructor. * - * @param {nsIURI} uri - * @param {string} id + * @param {nsIURI} _uri + * @param {string} _id */ - maybeSetID(uri, id) {} + maybeSetID(_uri, _id) {} } class InstallableWrapper extends AOMExtensionWrapper { diff --git a/toolkit/components/extensions/ExtensionsParent.cpp b/toolkit/components/extensions/ExtensionsParent.cpp index 0e10af241f..62779711fe 100644 --- a/toolkit/components/extensions/ExtensionsParent.cpp +++ b/toolkit/components/extensions/ExtensionsParent.cpp @@ -22,8 +22,8 @@ ExtensionsParent::~ExtensionsParent() {} extIWebNavigation* ExtensionsParent::WebNavigation() { if (!mWebNavigation) { - mWebNavigation = do_ImportModule("resource://gre/modules/WebNavigation.jsm", - "WebNavigationManager"); + mWebNavigation = do_ImportESModule( + "resource://gre/modules/WebNavigation.sys.mjs", "WebNavigationManager"); } return mWebNavigation; } diff --git a/toolkit/components/extensions/MessageChannel.sys.mjs b/toolkit/components/extensions/MessageChannel.sys.mjs index 65ab2720aa..90ad301402 100644 --- a/toolkit/components/extensions/MessageChannel.sys.mjs +++ b/toolkit/components/extensions/MessageChannel.sys.mjs @@ -322,10 +322,8 @@ class ResponseManager extends FilteringMessageManager { /** * Called when the event queue is idle, and dispatches any pending * low-priority messages in a single chunk. - * - * @param {IdleDeadline} deadline */ - onIdle(deadline) { + onIdle() { this.idleScheduled = false; let messages = this.idleMessages; @@ -370,7 +368,7 @@ class ResponseManager extends FilteringMessageManager { this.callback(this.handlers.get(data.messageName), data); } - *getHandlers(messageName, sender, recipient) { + *getHandlers(messageName) { let handler = this.handlers.get(messageName); if (handler) { yield handler; @@ -454,7 +452,7 @@ class FilteringMessageManagerMap extends Map { // XXXbz if target is really known to be a MessageListenerManager, // do we need this isInstance check? if (EventTarget.isInstance(target)) { - let onUnload = event => { + let onUnload = () => { target.removeEventListener("unload", onUnload); this.delete(target); }; @@ -1148,7 +1146,7 @@ MessageChannel = { } }, - observe(subject, topic, data) { + observe(subject, topic) { switch (topic) { case "message-manager-close": case "message-manager-disconnect": diff --git a/toolkit/components/extensions/MessageManagerProxy.sys.mjs b/toolkit/components/extensions/MessageManagerProxy.sys.mjs index 387b5876e1..110a98a05d 100644 --- a/toolkit/components/extensions/MessageManagerProxy.sys.mjs +++ b/toolkit/components/extensions/MessageManagerProxy.sys.mjs @@ -51,7 +51,7 @@ export class MessageManagerProxy { Services.obs.removeObserver(this, "message-manager-close"); } - observe(subject, topic, data) { + observe(subject, topic) { if (topic === "message-manager-close") { if (subject === this.messageManager) { this.closed = true; diff --git a/toolkit/components/extensions/ProxyChannelFilter.sys.mjs b/toolkit/components/extensions/ProxyChannelFilter.sys.mjs index 2f7f8cb113..444602f2fa 100644 --- a/toolkit/components/extensions/ProxyChannelFilter.sys.mjs +++ b/toolkit/components/extensions/ProxyChannelFilter.sys.mjs @@ -174,9 +174,9 @@ const ProxyInfoData = { `ProxyInfoData: Invalid proxy server authorization header: "${proxyAuthorizationHeader}"` ); } - if (type !== "https") { + if (type !== "https" && type !== "http") { throw new ExtensionError( - `ProxyInfoData: ProxyAuthorizationHeader requires type "https"` + `ProxyInfoData: ProxyAuthorizationHeader requires type "https" or "http"` ); } }, @@ -286,8 +286,8 @@ export class ProxyChannelFilter { ); } - // Originally duplicated from WebRequest.jsm with small changes. Keep this - // in sync with WebRequest.jsm as well as parent/ext-webRequest.js when + // Originally duplicated from WebRequest.sys.mjs with small changes. Keep this + // in sync with WebRequest.sys.mjs as well as parent/ext-webRequest.js when // apropiate. getRequestData(channel, extraData) { let originAttributes = channel.loadInfo?.originAttributes; diff --git a/toolkit/components/extensions/Schemas.sys.mjs b/toolkit/components/extensions/Schemas.sys.mjs index 9107e6a347..e98dfb36f0 100644 --- a/toolkit/components/extensions/Schemas.sys.mjs +++ b/toolkit/components/extensions/Schemas.sys.mjs @@ -373,7 +373,7 @@ class Context { this.path = []; this.preprocessors = { - localize(value, context) { + localize(value) { return value; }, ...params.preprocessors, @@ -436,12 +436,12 @@ class Context { /** * Checks whether this context has the given permission. * - * @param {string} permission + * @param {string} _permission * The name of the permission to check. * * @returns {boolean} True if the context has the given permission. */ - hasPermission(permission) { + hasPermission(_permission) { return false; } @@ -449,12 +449,12 @@ class Context { * Checks whether the given permission can be dynamically revoked or * granted. * - * @param {string} permission + * @param {string} _permission * The name of the permission to check. * * @returns {boolean} True if the given permission is revokable. */ - isPermissionRevokable(permission) { + isPermissionRevokable(_permission) { return false; } @@ -882,18 +882,18 @@ class InjectionContext extends Context { * Check whether the API should be injected. * * @abstract - * @param {string} namespace The namespace of the API. This may contain dots, + * @param {string} _namespace The namespace of the API. This may contain dots, * e.g. in the case of "devtools.inspectedWindow". - * @param {string?} name The name of the property in the namespace. + * @param {string?} _name The name of the property in the namespace. * `null` if we are checking whether the namespace should be injected. - * @param {Array<string>} allowedContexts A list of additional contexts in + * @param {Array<string>} _allowedContexts A list of additional contexts in * which this API should be available. May include any of: * "main" - The main chrome browser process. * "addon" - An addon process. * "content" - A content process. * @returns {boolean} Whether the API should be injected. */ - shouldInject(namespace, name, allowedContexts) { + shouldInject(_namespace, _name, _allowedContexts) { throw new Error("Not implemented"); } @@ -901,12 +901,12 @@ class InjectionContext extends Context { * Generate the implementation for `namespace`.`name`. * * @abstract - * @param {string} namespace The full path to the namespace of the API, minus + * @param {string} _namespace The full path to the namespace of the API, minus * the name of the method or property. E.g. "storage.local". - * @param {string} name The name of the method, property or event. + * @param {string} _name The name of the method, property or event. * @returns {SchemaAPIInterface} The implementation of the API. */ - getImplementation(namespace, name) { + getImplementation(_namespace, _name) { throw new Error("Not implemented"); } @@ -1035,7 +1035,7 @@ class InjectionContext extends Context { * format. */ const FORMATS = { - hostname(string, context) { + hostname(string) { // TODO bug 1797376: Despite the name, this format is NOT a "hostname", // but hostname + port and may fail with IPv6. Use canonicalDomain instead. let valid = true; @@ -1053,7 +1053,7 @@ const FORMATS = { return string; }, - canonicalDomain(string, context) { + canonicalDomain(string) { let valid; try { @@ -1129,7 +1129,7 @@ const FORMATS = { return FORMATS.relativeUrl(string, context); }, - unresolvedRelativeUrl(string, context) { + unresolvedRelativeUrl(string) { if (!string.startsWith("//")) { try { new URL(string); @@ -1191,7 +1191,7 @@ const FORMATS = { return string; }, - date(string, context) { + date(string) { // A valid ISO 8601 timestamp. const PATTERN = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|([-+]\d{2}:?\d{2})))?$/; @@ -1207,7 +1207,7 @@ const FORMATS = { return string; }, - manifestShortcutKey(string, context) { + manifestShortcutKey(string) { if (lazy.ShortcutUtils.validate(string) == lazy.ShortcutUtils.IS_VALID) { return string; } @@ -1374,15 +1374,15 @@ class Entry { * Returns an object containing property descriptor for use when * injecting this entry into an API object. * - * @param {Array<string>} path The API path, e.g. `["storage", "local"]`. - * @param {InjectionContext} context + * @param {Array<string>} _path The API path, e.g. `["storage", "local"]`. + * @param {InjectionContext} _context * * @returns {object?} * An object containing a `descriptor` property, specifying the * entry's property descriptor, and an optional `revoke` * method, to be called when the entry is being revoked. */ - getDescriptor(path, context) { + getDescriptor(_path, _context) { return undefined; } } @@ -1484,7 +1484,7 @@ class Type extends Entry { // valid for this type. It returns true or false. It's used to fill // in optional arguments to functions before actually type checking - checkBaseType(baseType) { + checkBaseType() { return false; } @@ -1517,7 +1517,7 @@ class AnyType extends Type { return this.postprocess({ value }, context); } - checkBaseType(baseType) { + checkBaseType() { return true; } } diff --git a/toolkit/components/extensions/WebNavigation.sys.mjs b/toolkit/components/extensions/WebNavigation.sys.mjs index 3de3c58986..7235aaeb4e 100644 --- a/toolkit/components/extensions/WebNavigation.sys.mjs +++ b/toolkit/components/extensions/WebNavigation.sys.mjs @@ -95,9 +95,8 @@ export var WebNavigationManager = { * * @param {nsIAutoCompleteInput | object} subject * @param {string} topic - * @param {string | undefined} data */ - observe: function (subject, topic, data) { + observe: function (subject, topic) { if (topic == "urlbar-user-start-navigation") { this.onURLBarUserStartNavigation(subject.wrappedJSObject); } else if (topic == "webNavigation-createdNavigationTarget") { diff --git a/toolkit/components/extensions/child/ext-declarativeNetRequest.js b/toolkit/components/extensions/child/ext-declarativeNetRequest.js index 82028c6105..27e67d12f8 100644 --- a/toolkit/components/extensions/child/ext-declarativeNetRequest.js +++ b/toolkit/components/extensions/child/ext-declarativeNetRequest.js @@ -11,7 +11,7 @@ ChromeUtils.defineESModuleGetters(this, { }); this.declarativeNetRequest = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { declarativeNetRequest: { get GUARANTEED_MINIMUM_STATIC_RULES() { diff --git a/toolkit/components/extensions/child/ext-storage.js b/toolkit/components/extensions/child/ext-storage.js index 2d10964d0a..3d71a1cd60 100644 --- a/toolkit/components/extensions/child/ext-storage.js +++ b/toolkit/components/extensions/child/ext-storage.js @@ -67,7 +67,7 @@ this.storage = class extends ExtensionAPI { }; } - getLocalIDBBackend(context, { fireOnChanged, serialize, storagePrincipal }) { + getLocalIDBBackend(context, { fireOnChanged, storagePrincipal }) { let dbPromise; async function getDB() { if (dbPromise) { @@ -185,7 +185,7 @@ this.storage = class extends ExtensionAPI { return items; } // If we got here, then `items` is an object generated by `ObjectType`'s - // `normalize` method from Schemas.jsm. The object returned by `normalize` + // `normalize` method from Schemas.sys.mjs. The object returned by `normalize` // lives in this compartment, while the values live in compartment of // `context.contentWindow`. The `sanitize` method runs with the principal // of `context`, so we cannot just use `ExtensionStorage.sanitize` because @@ -348,10 +348,10 @@ this.storage = class extends ExtensionAPI { .callParentAsyncFunction("storage.managed.get", [serialize(keys)]) .then(deserialize); }, - set(items) { + set() { return Promise.reject({ message: "storage.managed is read-only" }); }, - remove(keys) { + remove() { return Promise.reject({ message: "storage.managed is read-only" }); }, clear() { diff --git a/toolkit/components/extensions/child/ext-test.js b/toolkit/components/extensions/child/ext-test.js index a4178b63ff..3d9835d61f 100644 --- a/toolkit/components/extensions/child/ext-test.js +++ b/toolkit/components/extensions/child/ext-test.js @@ -248,7 +248,7 @@ this.test = class extends ExtensionAPI { }, assertDeepEq(expected, actual, msg) { - // The bindings generated by Schemas.jsm accepts any input, but the + // The bindings generated by Schemas.sys.mjs accepts any input, but the // WebIDL-generated binding expects a structurally cloneable input. // To ensure consistent behavior regardless of which mechanism was // used, verify that the inputs are structurally cloneable. @@ -302,7 +302,7 @@ this.test = class extends ExtensionAPI { promise = Promise.resolve(promise); return promise.then( - result => { + () => { let message = `Promise resolved, expected rejection '${toSource( expectedError )}'`; diff --git a/toolkit/components/extensions/child/ext-userScripts-content.js b/toolkit/components/extensions/child/ext-userScripts-content.js index ee1a1b7a8f..d2edb3c515 100644 --- a/toolkit/components/extensions/child/ext-userScripts-content.js +++ b/toolkit/components/extensions/child/ext-userScripts-content.js @@ -375,7 +375,7 @@ this.userScriptsContent = class extends ExtensionAPI { throw new ExtensionError(USERSCRIPT_DISABLED_ERRORMSG); } - let handler = (event, metadata, scriptSandbox, eventResult) => { + let handler = (event, metadata, scriptSandbox) => { const us = new UserScript({ context, metadata, diff --git a/toolkit/components/extensions/docs/webext-storage.rst b/toolkit/components/extensions/docs/webext-storage.rst index 9b5f2428d6..27ba3ad4d7 100644 --- a/toolkit/components/extensions/docs/webext-storage.rst +++ b/toolkit/components/extensions/docs/webext-storage.rst @@ -207,7 +207,7 @@ the actual result of the function (also a set of changes to send to observers, b beyond this doc). Ultimately, the `PuntResult` ends up back on the main thread once the call is complete -and arranges to callback the JS implementation, which in turn resolves the promise created in `ExtensionStorageSync.jsm` +and arranges to callback the JS implementation, which in turn resolves the promise created in `ExtensionStorageSync.sys.mjs` End result: ----------- diff --git a/toolkit/components/extensions/docs/webidl_bindings.rst b/toolkit/components/extensions/docs/webidl_bindings.rst index be8c63d0a7..7f7f2e53cb 100644 --- a/toolkit/components/extensions/docs/webidl_bindings.rst +++ b/toolkit/components/extensions/docs/webidl_bindings.rst @@ -4,7 +4,7 @@ WebIDL WebExtensions API Bindings While on ``manifest_version: 2`` all the extension globals (extension pages and content scripts) that lives on the main thread and the WebExtensions API bindings can be injected into the extension global from the JS privileged code part of the WebExtensions internals (`See Schemas.inject defined in -Schemas.jsm <https://searchfox.org/mozilla-central/search?q=symbol:Schemas%23inject&redirect=false>`_), +Schemas.sys.mjs <https://searchfox.org/mozilla-central/search?q=symbol:Schemas%23inject&redirect=false>`_), in ``manifest_version: 3`` the extension will be able to declare a background service worker instead of a background page, and the existing WebExtensions API bindings can't be injected into this new extension global, because it lives off of the main thread. diff --git a/toolkit/components/extensions/metrics.yaml b/toolkit/components/extensions/metrics.yaml index 192b12f9f9..6d36dae614 100644 --- a/toolkit/components/extensions/metrics.yaml +++ b/toolkit/components/extensions/metrics.yaml @@ -127,7 +127,7 @@ extensions.apis.dnr: startup_cache_read_size: type: memory_distribution memory_unit: byte - expires: 126 + expires: 138 description: | Amount of data read from the DNR startup cache file. lifetime: application @@ -136,6 +136,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -145,7 +146,7 @@ extensions.apis.dnr: startup_cache_read_time: type: timing_distribution time_unit: millisecond - expires: 126 + expires: 138 description: | Amount of time it takes to read data into the DNR startup cache file. lifetime: application @@ -154,6 +155,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -163,7 +165,7 @@ extensions.apis.dnr: startup_cache_write_size: type: memory_distribution memory_unit: byte - expires: 126 + expires: 138 description: | Amount of data written to the DNR startup cache file. lifetime: application @@ -172,6 +174,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -181,7 +184,7 @@ extensions.apis.dnr: startup_cache_write_time: type: timing_distribution time_unit: millisecond - expires: 126 + expires: 138 description: | Amount of time it takes to write data into the DNR startup cache file. lifetime: application @@ -190,6 +193,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -198,7 +202,7 @@ extensions.apis.dnr: startup_cache_entries: type: labeled_counter - expires: 126 + expires: 138 description: | Counters for startup cache data hits or misses on initializating DNR rules for extensions loaded on application startup. @@ -208,6 +212,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -220,7 +225,7 @@ extensions.apis.dnr: validate_rules_time: type: timing_distribution time_unit: millisecond - expires: 126 + expires: 138 description: | Amount of time it takes to validate DNR rules of individual ruleset when dynamic or static rulesets have been loaded from disk. @@ -230,6 +235,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -239,7 +245,7 @@ extensions.apis.dnr: evaluate_rules_time: type: timing_distribution time_unit: millisecond - expires: 126 + expires: 138 description: | Amount of time it takes to evaluate DNR rules for one network request. lifetime: application @@ -248,6 +254,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: @@ -257,7 +264,7 @@ extensions.apis.dnr: evaluate_rules_count_max: type: quantity unit: rules - expires: 126 + expires: 138 description: | Max amount of DNR rules being evaluated. lifetime: ping @@ -266,6 +273,7 @@ extensions.apis.dnr: bugs: - https://bugzilla.mozilla.org/1803363/ - https://bugzilla.mozilla.org/1850890/ + - https://bugzilla.mozilla.org/1881399/ data_reviews: - https://bugzilla.mozilla.org/show_bug.cgi?id=1803363#c11 data_sensitivity: diff --git a/toolkit/components/extensions/parent/ext-alarms.js b/toolkit/components/extensions/parent/ext-alarms.js index 1eea8397e2..ae4800a242 100644 --- a/toolkit/components/extensions/parent/ext-alarms.js +++ b/toolkit/components/extensions/parent/ext-alarms.js @@ -43,7 +43,7 @@ class Alarm { this.canceled = true; } - observe(subject, topic, data) { + observe() { if (this.canceled) { return; } @@ -97,7 +97,7 @@ this.alarms = class extends ExtensionAPIPersistent { unregister: () => { this.callbacks.delete(callback); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; diff --git a/toolkit/components/extensions/parent/ext-backgroundPage.js b/toolkit/components/extensions/parent/ext-backgroundPage.js index 155220c67a..c10912aa3c 100644 --- a/toolkit/components/extensions/parent/ext-backgroundPage.js +++ b/toolkit/components/extensions/parent/ext-backgroundPage.js @@ -718,7 +718,7 @@ class BackgroundBuilder { } } - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "timer-callback") { let { extension } = this; this.clearIdleTimer(); @@ -1028,7 +1028,7 @@ class BackgroundBuilder { } this.backgroundPage = class extends ExtensionAPI { - async onManifestEntry(entryName) { + async onManifestEntry() { let { extension } = this; // When in PPB background pages all run in a private context. This check diff --git a/toolkit/components/extensions/parent/ext-browsingData.js b/toolkit/components/extensions/parent/ext-browsingData.js index d06f7a3a1b..6d4b721e4f 100644 --- a/toolkit/components/extensions/parent/ext-browsingData.js +++ b/toolkit/components/extensions/parent/ext-browsingData.js @@ -80,7 +80,7 @@ const clearCache = options => { const clearCookies = async function (options) { let cookieMgr = Services.cookies; - // This code has been borrowed from Sanitizer.jsm. + // This code has been borrowed from Sanitizer.sys.mjs. let yieldCounter = 0; if (options.since || options.hostnames || options.cookieStoreId) { @@ -126,7 +126,7 @@ const clearCookies = async function (options) { } }; -// Ideally we could reuse the logic in Sanitizer.jsm or nsIClearDataService, +// Ideally we could reuse the logic in Sanitizer.sys.mjs or nsIClearDataService, // but this API exposes an ability to wipe data at a much finger granularity // than those APIs. (See also Bug 1531276) async function clearQuotaManager(options, dataType) { diff --git a/toolkit/components/extensions/parent/ext-captivePortal.js b/toolkit/components/extensions/parent/ext-captivePortal.js index 547abaa594..e703f074f5 100644 --- a/toolkit/components/extensions/parent/ext-captivePortal.js +++ b/toolkit/components/extensions/parent/ext-captivePortal.js @@ -55,7 +55,7 @@ this.captivePortal = class extends ExtensionAPIPersistent { onStateChanged({ fire }) { this.checkCaptivePortalEnabled(); - let observer = (subject, topic) => { + let observer = () => { fire.async({ state: this.nameForCPSState(gCPS.state) }); }; @@ -70,7 +70,7 @@ this.captivePortal = class extends ExtensionAPIPersistent { "ipc:network:captive-portal-set-state" ); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; @@ -90,13 +90,13 @@ this.captivePortal = class extends ExtensionAPIPersistent { "network:captive-portal-connectivity" ); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; }, "captiveURL.onChange": ({ fire }) => { - let listener = (text, id) => { + let listener = () => { fire.async({ levelOfControl: "not_controllable", value: Services.prefs.getStringPref(CAPTIVE_URL_PREF), @@ -107,7 +107,7 @@ this.captivePortal = class extends ExtensionAPIPersistent { unregister: () => { Services.prefs.removeObserver(CAPTIVE_URL_PREF, listener); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; diff --git a/toolkit/components/extensions/parent/ext-clipboard.js b/toolkit/components/extensions/parent/ext-clipboard.js index 9916b14be7..cab6bf22d3 100644 --- a/toolkit/components/extensions/parent/ext-clipboard.js +++ b/toolkit/components/extensions/parent/ext-clipboard.js @@ -19,7 +19,7 @@ const Transferable = Components.Constructor( ); this.clipboard = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { clipboard: { async setImageData(imageData, imageType) { diff --git a/toolkit/components/extensions/parent/ext-contextualIdentities.js b/toolkit/components/extensions/parent/ext-contextualIdentities.js index c7f28d5e90..c1d6262b6e 100644 --- a/toolkit/components/extensions/parent/ext-contextualIdentities.js +++ b/toolkit/components/extensions/parent/ext-contextualIdentities.js @@ -126,7 +126,7 @@ ExtensionPreferencesManager.addSetting(CONTAINERS_ENABLED_SETTING_NAME, { this.contextualIdentities = class extends ExtensionAPIPersistent { eventRegistrar(eventName) { return ({ fire }) => { - let observer = (subject, topic) => { + let observer = subject => { let convertedIdentity = convertIdentityFromObserver(subject); if (convertedIdentity) { fire.async({ contextualIdentity: convertedIdentity }); diff --git a/toolkit/components/extensions/parent/ext-declarativeNetRequest.js b/toolkit/components/extensions/parent/ext-declarativeNetRequest.js index 766a43d98a..fab1d941a4 100644 --- a/toolkit/components/extensions/parent/ext-declarativeNetRequest.js +++ b/toolkit/components/extensions/parent/ext-declarativeNetRequest.js @@ -39,7 +39,7 @@ this.declarativeNetRequest = class extends ExtensionAPI { ExtensionDNR.clearRuleManager(this.extension); } - getAPI(context) { + getAPI() { const { extension } = this; return { diff --git a/toolkit/components/extensions/parent/ext-dns.js b/toolkit/components/extensions/parent/ext-dns.js index f32243c032..6a6cf5c894 100644 --- a/toolkit/components/extensions/parent/ext-dns.js +++ b/toolkit/components/extensions/parent/ext-dns.js @@ -25,7 +25,7 @@ function getErrorString(nsresult) { } this.dns = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { dns: { resolve: function (hostname, flags) { diff --git a/toolkit/components/extensions/parent/ext-downloads.js b/toolkit/components/extensions/parent/ext-downloads.js index 9cd96e0d65..02af2d1076 100644 --- a/toolkit/components/extensions/parent/ext-downloads.js +++ b/toolkit/components/extensions/parent/ext-downloads.js @@ -212,6 +212,7 @@ class DownloadItem { let timeLeftInSeconds = sizeLeft / this.download.speed; return new Date(Date.now() + timeLeftInSeconds * 1000); } + return undefined; } get state() { @@ -460,7 +461,7 @@ const downloadQuery = query => { // an explicit value to match. function makeMatch(regex, value, field) { if (value == null && regex == null) { - return input => true; + return () => true; } let re; @@ -477,7 +478,7 @@ const downloadQuery = query => { if (re.test(value)) { return input => value == input; } - return input => false; + return () => false; } const matchFilename = makeMatch( @@ -940,7 +941,11 @@ this.downloads = class extends ExtensionAPIPersistent { const picker = Cc["@mozilla.org/filepicker;1"].createInstance( Ci.nsIFilePicker ); - picker.init(window, null, Ci.nsIFilePicker.modeSave); + picker.init( + window.browsingContext, + null, + Ci.nsIFilePicker.modeSave + ); if (lastFilePickerDirectory) { picker.displayDirectory = lastFilePickerDirectory; } else { diff --git a/toolkit/components/extensions/parent/ext-geckoProfiler.js b/toolkit/components/extensions/parent/ext-geckoProfiler.js index 91f2e6e594..2123f1c376 100644 --- a/toolkit/components/extensions/parent/ext-geckoProfiler.js +++ b/toolkit/components/extensions/parent/ext-geckoProfiler.js @@ -25,7 +25,7 @@ ChromeUtils.defineLazyGetter(this, "symbolicationService", () => { const isRunningObserver = { _observers: new Set(), - observe(subject, topic, data) { + observe(subject, topic) { switch (topic) { case "profiler-started": case "profiler-stopped": diff --git a/toolkit/components/extensions/parent/ext-identity.js b/toolkit/components/extensions/parent/ext-identity.js index 5bc643811a..bd53163305 100644 --- a/toolkit/components/extensions/parent/ext-identity.js +++ b/toolkit/components/extensions/parent/ext-identity.js @@ -94,7 +94,7 @@ const openOAuthWindow = (details, redirectURI) => { }; httpObserver = { - observeActivity(channel, type, subtype, timestamp, sizeData, stringData) { + observeActivity(channel) { try { channel.QueryInterface(Ci.nsIChannel); } catch { @@ -123,7 +123,7 @@ const openOAuthWindow = (details, redirectURI) => { }; this.identity = class extends ExtensionAPI { - getAPI(context) { + getAPI() { return { identity: { launchWebAuthFlowInParent: function (details, redirectURI) { diff --git a/toolkit/components/extensions/parent/ext-idle.js b/toolkit/components/extensions/parent/ext-idle.js index f68ea293d7..a0f9dcfff4 100644 --- a/toolkit/components/extensions/parent/ext-idle.js +++ b/toolkit/components/extensions/parent/ext-idle.js @@ -29,7 +29,7 @@ const getIdleObserver = extension => { if (!observer) { observer = new (class extends ExtensionCommon.EventEmitter { - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "idle" || topic == "active") { this.emit("stateChanged", topic); } diff --git a/toolkit/components/extensions/parent/ext-management.js b/toolkit/components/extensions/parent/ext-management.js index e0834d378f..fb28eca92c 100644 --- a/toolkit/components/extensions/parent/ext-management.js +++ b/toolkit/components/extensions/parent/ext-management.js @@ -188,7 +188,7 @@ this.management = class extends ExtensionAPIPersistent { unregister: () => { this.addonListener.off(eventName, listener); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; diff --git a/toolkit/components/extensions/parent/ext-networkStatus.js b/toolkit/components/extensions/parent/ext-networkStatus.js index 7379d746f5..92e631aa52 100644 --- a/toolkit/components/extensions/parent/ext-networkStatus.js +++ b/toolkit/components/extensions/parent/ext-networkStatus.js @@ -55,7 +55,7 @@ this.networkStatus = class extends ExtensionAPI { context, name: "networkStatus.onConnectionChanged", register: fire => { - let observerStatus = (subject, topic, data) => { + let observerStatus = () => { fire.async(getLinkInfo()); }; diff --git a/toolkit/components/extensions/parent/ext-protocolHandlers.js b/toolkit/components/extensions/parent/ext-protocolHandlers.js index 36cdf25d42..099e193f0f 100644 --- a/toolkit/components/extensions/parent/ext-protocolHandlers.js +++ b/toolkit/components/extensions/parent/ext-protocolHandlers.js @@ -37,7 +37,7 @@ const hasHandlerApp = handlerConfig => { }; this.protocolHandlers = class extends ExtensionAPI { - onManifestEntry(entryName) { + onManifestEntry() { let { extension } = this; let { manifest } = extension; diff --git a/toolkit/components/extensions/parent/ext-runtime.js b/toolkit/components/extensions/parent/ext-runtime.js index f4f9ea6616..d1c03d9e0d 100644 --- a/toolkit/components/extensions/parent/ext-runtime.js +++ b/toolkit/components/extensions/parent/ext-runtime.js @@ -90,7 +90,7 @@ this.runtime = class extends ExtensionAPIPersistent { onPerformanceWarning({ fire }) { let { extension } = this; - let observer = (subject, topic) => { + let observer = subject => { let report = subject.QueryInterface(Ci.nsIHangReport); if (report?.addonId !== extension.id) { @@ -119,7 +119,7 @@ this.runtime = class extends ExtensionAPIPersistent { unregister: () => { Services.obs.removeObserver(observer, "process-hang-report"); }, - convert(_fire, context) { + convert(_fire) { fire = _fire; }, }; diff --git a/toolkit/components/extensions/parent/ext-scripting.js b/toolkit/components/extensions/parent/ext-scripting.js index baa05f3aad..1563ec1e90 100644 --- a/toolkit/components/extensions/parent/ext-scripting.js +++ b/toolkit/components/extensions/parent/ext-scripting.js @@ -250,10 +250,8 @@ this.scripting = class extends ExtensionAPI { const scriptIdsMap = gScriptIdsMap.get(extension); return Array.from(scriptIdsMap.entries()) - .filter( - ([id, scriptId]) => !details?.ids || details.ids.includes(id) - ) - .map(([id, scriptId]) => { + .filter(([id]) => !details?.ids || details.ids.includes(id)) + .map(([, scriptId]) => { const options = extension.registeredContentScripts.get(scriptId); return makePublicContentScript(extension, options); diff --git a/toolkit/components/extensions/parent/ext-storage.js b/toolkit/components/extensions/parent/ext-storage.js index 350ca0acfa..b4ee9ab422 100644 --- a/toolkit/components/extensions/parent/ext-storage.js +++ b/toolkit/components/extensions/parent/ext-storage.js @@ -192,8 +192,8 @@ this.storage = class extends ExtensionAPIPersistent { extension, onStorageSyncChanged ); - // May be void if ExtensionStorageSyncKinto.jsm was not used. - // ExtensionStorageSync.jsm does not use the context. + // May be void if ExtensionStorageSyncKinto.sys.mjs was not used. + // ExtensionStorageSync.sys.mjs does not use the context. closeCallback?.(); }; } diff --git a/toolkit/components/extensions/parent/ext-tabs-base.js b/toolkit/components/extensions/parent/ext-tabs-base.js index 64ca9c0627..3d0fe3531d 100644 --- a/toolkit/components/extensions/parent/ext-tabs-base.js +++ b/toolkit/components/extensions/parent/ext-tabs-base.js @@ -199,15 +199,16 @@ class TabBase { } /** - * @property {string | null} url + * @property {string | undefined} url * Returns the current URL of this tab if the extension has permission - * to read it, or null otherwise. + * to read it, or undefined otherwise. * @readonly */ get url() { if (this.hasTabPermission) { return this._url; } + return undefined; } /** @@ -230,15 +231,16 @@ class TabBase { } /** - * @property {nsIURI | null} title + * @property {nsIURI | undefined} title * Returns the current title of this tab if the extension has permission - * to read it, or null otherwise. + * to read it, or undefined otherwise. * @readonly */ get title() { if (this.hasTabPermission) { return this._title; } + return undefined; } /** @@ -253,15 +255,16 @@ class TabBase { } /** - * @property {nsIURI | null} faviconUrl + * @property {nsIURI | undefined} faviconUrl * Returns the current faviron URL of this tab if the extension has permission - * to read it, or null otherwise. + * to read it, or undefined otherwise. * @readonly */ get favIconUrl() { if (this.hasTabPermission) { return this._favIconUrl; } + return undefined; } /** @@ -1165,9 +1168,9 @@ class WindowBase { } /** - * @property {nsIURI | null} title + * @property {nsIURI | undefined} title * Returns the current title of this window if the extension has permission - * to read it, or null otherwise. + * to read it, or undefined otherwise. * @readonly */ get title() { @@ -1176,6 +1179,7 @@ class WindowBase { if (this.activeTab && this.activeTab.hasTabPermission) { return this._title; } + return undefined; } // The JSDoc validator does not support @returns tags in abstract functions or @@ -1184,7 +1188,7 @@ class WindowBase { /** * Returns the window state of the given window. * - * @param {DOMWindow} window + * @param {DOMWindow} _window * The window for which to return a state. * * @returns {string} @@ -1193,7 +1197,7 @@ class WindowBase { * @static * @abstract */ - static getState(window) { + static getState(_window) { throw new Error("Not implemented"); } @@ -1225,12 +1229,12 @@ class WindowBase { /** * Returns the window's tab at the specified index. * - * @param {integer} index + * @param {integer} _index * The index of the desired tab. * * @returns {TabBase|undefined} */ - getTabAtIndex(index) { + getTabAtIndex(_index) { throw new Error("Not implemented"); } /* eslint-enable valid-jsdoc */ @@ -1354,23 +1358,23 @@ class TabTrackerBase extends EventEmitter { /** * Returns the numeric ID for the given native tab. * - * @param {NativeTab} nativeTab + * @param {NativeTab} _nativeTab * The native tab for which to return an ID. * * @returns {integer} * The tab's numeric ID. * @abstract */ - getId(nativeTab) { + getId(_nativeTab) { throw new Error("Not implemented"); } /** * Returns the native tab with the given numeric ID. * - * @param {integer} tabId + * @param {integer} _tabId * The numeric ID of the tab to return. - * @param {*} default_ + * @param {*} _default * The value to return if no tab exists with the given ID. * * @returns {NativeTab} @@ -1379,7 +1383,7 @@ class TabTrackerBase extends EventEmitter { * provided. * @abstract */ - getTab(tabId, default_ = undefined) { + getTab(_tabId, _default) { throw new Error("Not implemented"); } @@ -1394,7 +1398,7 @@ class TabTrackerBase extends EventEmitter { * @abstract */ /* eslint-enable valid-jsdoc */ - getBrowserData(browser) { + getBrowserData() { throw new Error("Not implemented"); } @@ -1450,7 +1454,7 @@ class StatusListener { } } - onLocationChange(browser, webProgress, request, locationURI, flags) { + onLocationChange(browser, webProgress, request, locationURI) { if (webProgress.isTopLevel) { let status = webProgress.isLoadingDocument ? "loading" : "complete"; this.listener({ browser, status, url: locationURI.spec }); @@ -1884,26 +1888,26 @@ class WindowTrackerBase extends EventEmitter { /** * Adds a tab progress listener to the given browser window. * - * @param {DOMWindow} window + * @param {DOMWindow} _window * The browser window to which to add the listener. - * @param {object} listener + * @param {object} _listener * The tab progress listener to add. * @abstract */ - addProgressListener(window, listener) { + addProgressListener(_window, _listener) { throw new Error("Not implemented"); } /** * Removes a tab progress listener from the given browser window. * - * @param {DOMWindow} window + * @param {DOMWindow} _window * The browser window from which to remove the listener. - * @param {object} listener + * @param {object} _listener * The tab progress listener to remove. * @abstract */ - removeProgressListener(window, listener) { + removeProgressListener(_window, _listener) { throw new Error("Not implemented"); } } @@ -2030,14 +2034,14 @@ class TabManagerBase { /** * Determines access using extension context. * - * @param {NativeTab} nativeTab + * @param {NativeTab} _nativeTab * The tab to check access on. * @returns {boolean} * True if the extension has permissions for this tab. * @protected * @abstract */ - canAccessTab(nativeTab) { + canAccessTab(_nativeTab) { throw new Error("Not implemented"); } @@ -2131,7 +2135,7 @@ class TabManagerBase { /** * Returns a TabBase wrapper for the tab with the given ID. * - * @param {integer} tabId + * @param {integer} _tabId * The ID of the tab for which to return a wrapper. * * @returns {TabBase} @@ -2139,22 +2143,21 @@ class TabManagerBase { * If no tab exists with the given ID. * @abstract */ - get(tabId) { + get(_tabId) { throw new Error("Not implemented"); } /** * Returns a new TabBase instance wrapping the given native tab. * - * @param {NativeTab} nativeTab + * @param {NativeTab} _nativeTab * The native tab for which to return a wrapper. * * @returns {TabBase} * @protected * @abstract */ - /* eslint-enable valid-jsdoc */ - wrapTab(nativeTab) { + wrapTab(_nativeTab) { throw new Error("Not implemented"); } } @@ -2272,9 +2275,9 @@ class WindowManagerBase { /** * Returns a WindowBase wrapper for the browser window with the given ID. * - * @param {integer} windowId + * @param {integer} _windowId * The ID of the browser window for which to return a wrapper. - * @param {BaseContext} context + * @param {BaseContext} _context * The extension context for which the matching is being performed. * Used to determine the current window for relevant properties. * @@ -2283,7 +2286,7 @@ class WindowManagerBase { * If no window exists with the given ID. * @abstract */ - get(windowId, context) { + get(_windowId, _context) { throw new Error("Not implemented"); } @@ -2301,14 +2304,14 @@ class WindowManagerBase { /** * Returns a new WindowBase instance wrapping the given browser window. * - * @param {DOMWindow} window + * @param {DOMWindow} _window * The browser window for which to return a wrapper. * * @returns {WindowBase} * @protected * @abstract */ - wrapWindow(window) { + wrapWindow(_window) { throw new Error("Not implemented"); } /* eslint-enable valid-jsdoc */ diff --git a/toolkit/components/extensions/parent/ext-theme.js b/toolkit/components/extensions/parent/ext-theme.js index 1280563dd0..febb04064c 100644 --- a/toolkit/components/extensions/parent/ext-theme.js +++ b/toolkit/components/extensions/parent/ext-theme.js @@ -435,7 +435,7 @@ this.theme = class extends ExtensionAPIPersistent { }, }; - onManifestEntry(entryName) { + onManifestEntry() { let { extension } = this; let { manifest } = extension; diff --git a/toolkit/components/extensions/parent/ext-webNavigation.js b/toolkit/components/extensions/parent/ext-webNavigation.js index c65b61041b..6947149915 100644 --- a/toolkit/components/extensions/parent/ext-webNavigation.js +++ b/toolkit/components/extensions/parent/ext-webNavigation.js @@ -227,7 +227,7 @@ this.webNavigation = class extends ExtensionAPIPersistent { onTabReplaced: new EventManager({ context, name: "webNavigation.onTabReplaced", - register: fire => { + register: () => { return () => {}; }, }).api(), diff --git a/toolkit/components/extensions/storage/webext_storage_bridge/src/lib.rs b/toolkit/components/extensions/storage/webext_storage_bridge/src/lib.rs index 94133ef1e9..c1998fb636 100644 --- a/toolkit/components/extensions/storage/webext_storage_bridge/src/lib.rs +++ b/toolkit/components/extensions/storage/webext_storage_bridge/src/lib.rs @@ -16,11 +16,11 @@ //! and `storage.managed`, which is provisioned in a native manifest and //! read-only. //! -//! * `storage.local` is implemented in `ExtensionStorageIDB.jsm`. +//! * `storage.local` is implemented in `ExtensionStorageIDB.sys.mjs`. //! * `storage.sync` is implemented in a Rust component, `webext_storage`. This //! Rust component is vendored in m-c, and exposed to JavaScript via an XPCOM //! API in `webext_storage_bridge` (this crate). Eventually, we'll change -//! `ExtensionStorageSync.jsm` to call the XPCOM API instead of using the +//! `ExtensionStorageSync.sys.mjs` to call the XPCOM API instead of using the //! old Kinto storage adapter. //! * `storage.managed` is implemented directly in `parent/ext-storage.js`. //! 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"); diff --git a/toolkit/components/extensions/webidl-api/ExtensionAPIRequestForwarder.cpp b/toolkit/components/extensions/webidl-api/ExtensionAPIRequestForwarder.cpp index 5f6a966fc8..2c36c10d7b 100644 --- a/toolkit/components/extensions/webidl-api/ExtensionAPIRequestForwarder.cpp +++ b/toolkit/components/extensions/webidl-api/ExtensionAPIRequestForwarder.cpp @@ -88,9 +88,9 @@ ExtensionAPIRequestForwarder::APIRequestHandler() { MOZ_ASSERT(NS_IsMainThread()); if (MOZ_UNLIKELY(!sAPIRequestHandler)) { - sAPIRequestHandler = - do_ImportModule("resource://gre/modules/ExtensionProcessScript.jsm", - "ExtensionAPIRequestHandler"); + sAPIRequestHandler = do_ImportESModule( + "resource://gre/modules/ExtensionProcessScript.sys.mjs", + "ExtensionAPIRequestHandler"); MOZ_RELEASE_ASSERT(sAPIRequestHandler); ClearOnShutdown(&sAPIRequestHandler); } diff --git a/toolkit/components/extensions/webidl-api/GenerateWebIDLBindings.py b/toolkit/components/extensions/webidl-api/GenerateWebIDLBindings.py index 3b31bd924d..6a4a404ac8 100644 --- a/toolkit/components/extensions/webidl-api/GenerateWebIDLBindings.py +++ b/toolkit/components/extensions/webidl-api/GenerateWebIDLBindings.py @@ -139,8 +139,8 @@ def read_json(json_file_path): """ Helper function used to read the WebExtensions API schema JSON files by ignoring the license comment on the top of some of those files. - Same helper as the one available in Schemas.jsm: - https://searchfox.org/mozilla-central/rev/3434a9df60373a997263107e6f124fb164ddebf2/toolkit/components/extensions/Schemas.jsm#70 + Same helper as the one available in Schemas.sys.mjs: + https://searchfox.org/mozilla-central/rev/b60cb73160843adb5a5a3ec8058e75a69b46acf7/toolkit/components/extensions/Schemas.sys.mjs#53 """ with open(json_file_path) as json_file: txt = json_file.read() diff --git a/toolkit/components/extensions/webrequest/WebRequest.sys.mjs b/toolkit/components/extensions/webrequest/WebRequest.sys.mjs index 1d9bbb2260..bbe044ddea 100644 --- a/toolkit/components/extensions/webrequest/WebRequest.sys.mjs +++ b/toolkit/components/extensions/webrequest/WebRequest.sys.mjs @@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, { WebRequestUpload: "resource://gre/modules/WebRequestUpload.sys.mjs", }); -// WebRequest.jsm's only consumer is ext-webRequest.js, so we can depend on +// WebRequest.sys.mjs's only consumer is ext-webRequest.js, so we can depend on // the apiManager.global being initialized. ChromeUtils.defineLazyGetter(lazy, "tabTracker", () => { return lazy.ExtensionParent.apiManager.global.tabTracker; @@ -1226,7 +1226,7 @@ HttpObserverManager = { return false; }, - examine(channel, topic, data) { + examine(channel) { if (this.listeners.onHeadersReceived.size || this.dnrActive) { this.runChannelListener(channel, "onHeadersReceived"); } |