diff options
Diffstat (limited to 'toolkit/components/extensions/parent')
21 files changed, 78 insertions, 72 deletions
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(), |