diff --git a/.eslintignore b/.eslintignore index 754d372bd350..5a85e2e4e6d7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -221,7 +221,7 @@ toolkit/components/translation/cld2/ # Uses preprocessing toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js -toolkit/modules/AppConstants.jsm +toolkit/modules/AppConstants.sys.mjs # Tests of ESLint command. tools/lint/test/files diff --git a/browser/base/content/test/performance/browser_startup.js b/browser/base/content/test/performance/browser_startup.js index d36dcff88311..3fced38ebd5d 100644 --- a/browser/base/content/test/performance/browser_startup.js +++ b/browser/base/content/test/performance/browser_startup.js @@ -30,8 +30,8 @@ const startupPhases = { modules: new Set([ "resource:///modules/BrowserGlue.jsm", "resource:///modules/StartupRecorder.jsm", - "resource://gre/modules/AppConstants.jsm", - "resource://gre/modules/ActorManagerParent.jsm", + "resource://gre/modules/AppConstants.sys.mjs", + "resource://gre/modules/ActorManagerParent.sys.mjs", "resource://gre/modules/CustomElementsListener.jsm", "resource://gre/modules/MainProcessSingleton.jsm", "resource://gre/modules/XPCOMUtils.sys.mjs", @@ -63,7 +63,7 @@ const startupPhases = { "resource://gre/modules/NewTabUtils.sys.mjs", "resource://gre/modules/PageThumbs.jsm", "resource://gre/modules/PlacesUtils.sys.mjs", - "resource://gre/modules/Preferences.jsm", + "resource://gre/modules/Preferences.sys.mjs", "resource://gre/modules/SearchService.sys.mjs", "resource://gre/modules/Sqlite.sys.mjs", ]), diff --git a/browser/base/content/test/performance/browser_startup_content.js b/browser/base/content/test/performance/browser_startup_content.js index 20d0b14d30a7..64b6a9d89e59 100644 --- a/browser/base/content/test/performance/browser_startup_content.js +++ b/browser/base/content/test/performance/browser_startup_content.js @@ -23,9 +23,9 @@ const known_scripts = { "chrome://mochikit/content/ShutdownLeaksCollector.jsm", // General utilities - "resource://gre/modules/AppConstants.jsm", - "resource://gre/modules/DeferredTask.jsm", - "resource://gre/modules/Timer.jsm", + "resource://gre/modules/AppConstants.sys.mjs", + "resource://gre/modules/DeferredTask.sys.mjs", + "resource://gre/modules/Timer.sys.mjs", "resource://gre/modules/XPCOMUtils.sys.mjs", // Logging related diff --git a/browser/base/content/test/performance/browser_startup_content_subframe.js b/browser/base/content/test/performance/browser_startup_content_subframe.js index 4bb46261c32d..89ff916d8a41 100644 --- a/browser/base/content/test/performance/browser_startup_content_subframe.js +++ b/browser/base/content/test/performance/browser_startup_content_subframe.js @@ -37,8 +37,8 @@ const known_scripts = { actorModuleURI, // General utilities - "resource://gre/modules/AppConstants.jsm", - "resource://gre/modules/DeferredTask.jsm", + "resource://gre/modules/AppConstants.sys.mjs", + "resource://gre/modules/DeferredTask.sys.mjs", "resource://gre/modules/XPCOMUtils.sys.mjs", // Logging related diff --git a/browser/components/newtab/docs/v2-system-addon/preferences.md b/browser/components/newtab/docs/v2-system-addon/preferences.md index a5f3de756ed0..9b09cd1804d8 100644 --- a/browser/components/newtab/docs/v2-system-addon/preferences.md +++ b/browser/components/newtab/docs/v2-system-addon/preferences.md @@ -74,7 +74,7 @@ prefs.observe("foo", aCallback); prefs.ignore("foo", aCallback); ``` -See [toolkit/modules/Preferences.jsm](https://searchfox.mozilla.org/mozilla-central/source/toolkit/modules/Preferences.jsm) +See :searchfox:`toolkit/modules/Preferences.sys.mjs ` for more information about what methods are available. ## Discovery Stream Preferences diff --git a/devtools/client/performance-new/@types/gecko.d.ts b/devtools/client/performance-new/@types/gecko.d.ts index b42b5e8cd5bf..3e70bde24422 100644 --- a/devtools/client/performance-new/@types/gecko.d.ts +++ b/devtools/client/performance-new/@types/gecko.d.ts @@ -22,7 +22,7 @@ declare namespace MockedExports { */ interface KnownModules { Services: typeof import("Services"); - "resource://gre/modules/AppConstants.jsm": typeof import("resource://gre/modules/AppConstants.jsm"); + "resource://gre/modules/AppConstants.sys.mjs": typeof import("resource://gre/modules/AppConstants.sys.mjs"); "resource:///modules/CustomizableUI.jsm": typeof import("resource:///modules/CustomizableUI.jsm"); "resource:///modules/CustomizableWidgets.jsm": typeof import("resource:///modules/CustomizableWidgets.jsm"); "resource://devtools/shared/loader/Loader.sys.mjs": typeof import("resource://devtools/shared/loader/Loader.sys.mjs"); @@ -200,7 +200,7 @@ declare namespace MockedExports { decorate: (target: object) => void; }; - const AppConstantsJSM: { + const AppConstantsSYSMJS: { AppConstants: { platform: string; }; @@ -334,8 +334,8 @@ declare module "ChromeUtils" { export = ChromeUtils; } -declare module "resource://gre/modules/AppConstants.jsm" { - export = MockedExports.AppConstantsJSM; +declare module "resource://gre/modules/AppConstants.sys.mjs" { + export = MockedExports.AppConstantsSYSMJS; } declare module "resource://gre/modules/WebChannel.jsm" { diff --git a/dom/docs/ipc/jsactors.rst b/dom/docs/ipc/jsactors.rst index c4f08b6d3ff3..04f372ff23f7 100644 --- a/dom/docs/ipc/jsactors.rst +++ b/dom/docs/ipc/jsactors.rst @@ -271,7 +271,7 @@ Message Manager Actors While the JSWindowActor mechanism was being designed and developed, large sections of our framescripts were converted to an "actor style" pattern to make eventual porting to JSWindowActors easier. These Actors use the Message Manager under the hood, but made it much easier to shrink our framescripts, and also allowed us to gain significant memory savings by having the actors be lazily instantiated. -You can find the list of Message Manager Actors (or "Legacy Actors") in `BrowserGlue.jsm `_ and `ActorManagerParent.jsm `_, in the ``LEGACY_ACTORS`` lists. +You can find the list of Message Manager Actors (or "Legacy Actors") in :searchfox:`BrowserGlue.jsm ` and :searchfox:`ActorManagerParent.sys.mjs `, in the ``LEGACY_ACTORS`` lists. .. note:: The split in Message Manager Actors defined between ``BrowserGlue`` and ``ActorManagerParent`` is mainly to keep Firefox Desktop specific Actors separate from Actors that can (in theory) be instantiated for non-Desktop browsers (like Fennec and GeckoView-based browsers). Firefox Desktop-specific Actors should be registered in ``BrowserGlue``. Shared "toolkit" Actors should go into ``ActorManagerParent``. diff --git a/python/mozbuild/mozbuild/repackaging/msix.py b/python/mozbuild/mozbuild/repackaging/msix.py index b6b279c13549..f94d8f1a3f7c 100644 --- a/python/mozbuild/mozbuild/repackaging/msix.py +++ b/python/mozbuild/mozbuild/repackaging/msix.py @@ -185,7 +185,7 @@ def get_embedded_version(version, buildid): return version -def get_appconstants_jsm_values(finder, *args): +def get_appconstants_sys_mjs_values(finder, *args): r"""Extract values, such as the display version like `MOZ_APP_VERSION_DISPLAY: "...";`, from the omnijar. This allows to determine the beta number, like `X.YbW`, where the regular beta version is only `X.Y`. Takes a list of @@ -194,7 +194,7 @@ def get_appconstants_jsm_values(finder, *args): """ lines = defaultdict(list) - for _, f in finder.find("**/modules/AppConstants.jsm"): + for _, f in finder.find("**/modules/AppConstants.sys.mjs"): for line in f.open().read().decode("utf-8").splitlines(): for arg in args: if arg in line: @@ -365,12 +365,12 @@ def repackage_msix( second = next(values) vendor = vendor or second - # For `AppConstants.jsm` and `brand.properties`, which are in the omnijar in packaged builds. - # The nested langpack XPI files can't be read by `mozjar.py`. + # For `AppConstants.sys.mjs` and `brand.properties`, which are in the omnijar in packaged + # builds. The nested langpack XPI files can't be read by `mozjar.py`. unpack_finder = UnpackFinder(finder, unpack_xpi=False) if not version: - values = get_appconstants_jsm_values( + values = get_appconstants_sys_mjs_values( unpack_finder, "MOZ_APP_VERSION_DISPLAY", "MOZ_BUILDID" ) display_version = next(values) @@ -384,8 +384,8 @@ def repackage_msix( "display_version": display_version, "buildid": buildid, }, - "AppConstants.jsm display version is '{display_version}' and build ID is '{buildid}':" - + " embedded version will be '{version}'", + "AppConstants.sys.mjs display version is '{display_version}' and build ID is" + + " '{buildid}': embedded version will be '{version}'", ) # TODO: Bug 1721922: localize this description via Fluent. diff --git a/toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js b/toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js index 4c9317da2081..9bd9b03576d0 100644 --- a/toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js +++ b/toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js @@ -32,7 +32,7 @@ const backgroundtaskPhases = { "resource://gre/modules/AppConstants.jsm", "resource://gre/modules/AsyncShutdown.jsm", "resource://gre/modules/BackgroundTasksManager.sys.mjs", - "resource://gre/modules/Console.jsm", + "resource://gre/modules/Console.sys.mjs", "resource://gre/modules/EnterprisePolicies.sys.mjs", "resource://gre/modules/EnterprisePoliciesParent.sys.mjs", "resource://gre/modules/PromiseUtils.sys.mjs", @@ -123,7 +123,7 @@ const backgroundtaskPhases = { "resource:///modules/backgroundtasks/BackgroundTask_wait.sys.mjs", "resource://gre/modules/ConsoleAPIStorage.jsm", - "resource://gre/modules/Timer.jsm", + "resource://gre/modules/Timer.sys.mjs", // We have a profile marker for this, even though it failed to load! "resource://gre/modules/backgroundtasks/BackgroundTask_wait.sys.mjs", diff --git a/toolkit/modules/ActorManagerParent.jsm b/toolkit/modules/ActorManagerParent.sys.mjs similarity index 98% rename from toolkit/modules/ActorManagerParent.jsm rename to toolkit/modules/ActorManagerParent.sys.mjs index f043562b61dd..009df8490148 100644 --- a/toolkit/modules/ActorManagerParent.jsm +++ b/toolkit/modules/ActorManagerParent.sys.mjs @@ -2,21 +2,14 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; /** * This module handles JavaScript-implemented JSWindowActors, registered through DOM IPC * infrastructure, and are fission-compatible. */ -var EXPORTED_SYMBOLS = ["ActorManagerParent"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); -const { AppConstants } = ChromeUtils.import( - "resource://gre/modules/AppConstants.jsm" -); +import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; /** * Fission-compatible JSProcess implementations. @@ -569,7 +562,7 @@ if (AppConstants.platform != "android") { }; } -var ActorManagerParent = { +export var ActorManagerParent = { _addActors(actors, kind) { let register, unregister; switch (kind) { diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.sys.mjs similarity index 98% rename from toolkit/modules/AppConstants.jsm rename to toolkit/modules/AppConstants.sys.mjs index ebfea3507f75..59ba540c6dcb 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.sys.mjs @@ -5,15 +5,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - const lazy = {}; ChromeUtils.defineModuleGetter(lazy, "AddonManager", "resource://gre/modules/AddonManager.jsm"); -var EXPORTED_SYMBOLS = ["AppConstants"]; - // Immutable for export. -var AppConstants = Object.freeze({ +export var AppConstants = Object.freeze({ // See this wiki page for more details about channel specific build // defines: https://wiki.mozilla.org/Platform/Channel-specific_build_defines NIGHTLY_BUILD: diff --git a/toolkit/modules/Console.jsm b/toolkit/modules/Console.sys.mjs similarity index 99% rename from toolkit/modules/Console.jsm rename to toolkit/modules/Console.sys.mjs index 5fbdab251050..41260b97675c 100644 --- a/toolkit/modules/Console.jsm +++ b/toolkit/modules/Console.sys.mjs @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - /** * Define a 'console' API to roughly match the implementation provided by * Firebug. @@ -20,8 +18,6 @@ * implementation isn't always required (or even well defined) */ -var EXPORTED_SYMBOLS = ["console", "ConsoleAPI"]; - var gTimerRegistry = new Map(); /** @@ -610,7 +606,7 @@ function sendConsoleAPIMessage(aConsole, aLevel, aFrame, aArgs, aOptions = {}) { * @return {object} * A console API instance object */ -function ConsoleAPI(aConsoleOptions = {}) { +export function ConsoleAPI(aConsoleOptions = {}) { // Normalize console options to set default values // in order to avoid runtime checks on each console method call. this.dump = aConsoleOptions.dump || dump; @@ -756,4 +752,4 @@ ConsoleAPI.prototype = { }, }; -var console = new ConsoleAPI(); +export var console = new ConsoleAPI(); diff --git a/toolkit/modules/ContentDOMReference.jsm b/toolkit/modules/ContentDOMReference.sys.mjs similarity index 96% rename from toolkit/modules/ContentDOMReference.jsm rename to toolkit/modules/ContentDOMReference.sys.mjs index 4ee66f746e50..ef4896ff6747 100644 --- a/toolkit/modules/ContentDOMReference.jsm +++ b/toolkit/modules/ContentDOMReference.sys.mjs @@ -14,11 +14,7 @@ * between processes during runtime. */ -var EXPORTED_SYMBOLS = ["ContentDOMReference"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -55,7 +51,7 @@ const finalizerRoots = new WeakMap(); */ var gRegistry = new WeakMap(); -var ContentDOMReference = { +export var ContentDOMReference = { _init() { Services.obs.addObserver(this, FINALIZATION_TOPIC); }, diff --git a/toolkit/modules/DeferredTask.jsm b/toolkit/modules/DeferredTask.sys.mjs similarity index 99% rename from toolkit/modules/DeferredTask.jsm rename to toolkit/modules/DeferredTask.sys.mjs index ec4d0b7fe87d..ebdfc4453d5e 100644 --- a/toolkit/modules/DeferredTask.jsm +++ b/toolkit/modules/DeferredTask.sys.mjs @@ -4,10 +4,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - -var EXPORTED_SYMBOLS = ["DeferredTask"]; - const lazy = {}; /** @@ -114,7 +110,7 @@ const Timer = Components.Constructor( * aDelayMs have elapsed. If omitted, waits indefinitely for an idle * callback. */ -var DeferredTask = function(aTaskFn, aDelayMs, aIdleTimeoutMs) { +export var DeferredTask = function(aTaskFn, aDelayMs, aIdleTimeoutMs) { this._taskFn = aTaskFn; this._delayMs = aDelayMs; this._timeoutMs = aIdleTimeoutMs; diff --git a/toolkit/modules/Deprecated.jsm b/toolkit/modules/Deprecated.sys.mjs similarity index 96% rename from toolkit/modules/Deprecated.jsm rename to toolkit/modules/Deprecated.sys.mjs index b96bfa497ea2..cd430b9676e6 100644 --- a/toolkit/modules/Deprecated.jsm +++ b/toolkit/modules/Deprecated.sys.mjs @@ -2,10 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - -var EXPORTED_SYMBOLS = ["Deprecated"]; - const PREF_DEPRECATION_WARNINGS = "devtools.errorconsole.deprecation_warnings"; // A flag that indicates whether deprecation warnings should be logged. @@ -43,7 +39,7 @@ function stringifyCallstack(aStack) { return msg; } -var Deprecated = { +export var Deprecated = { /** * Log a deprecation warning. * diff --git a/toolkit/modules/E10SUtils.jsm b/toolkit/modules/E10SUtils.sys.mjs similarity index 99% rename from toolkit/modules/E10SUtils.jsm rename to toolkit/modules/E10SUtils.sys.mjs index c5d9d40437c4..41f4f1f01b19 100644 --- a/toolkit/modules/E10SUtils.jsm +++ b/toolkit/modules/E10SUtils.sys.mjs @@ -2,13 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - -var EXPORTED_SYMBOLS = ["E10SUtils"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -269,7 +263,7 @@ const SYSTEM_WORKERS_REMOTE_TYPES_ALLOWED = [ PRIVILEGEDABOUT_REMOTE_TYPE, ]; -var E10SUtils = { +export var E10SUtils = { DEFAULT_REMOTE_TYPE, NOT_REMOTE, WEB_REMOTE_TYPE, diff --git a/toolkit/modules/EventEmitter.jsm b/toolkit/modules/EventEmitter.sys.mjs similarity index 98% rename from toolkit/modules/EventEmitter.jsm rename to toolkit/modules/EventEmitter.sys.mjs index e09e4ae31926..1be8fead7625 100644 --- a/toolkit/modules/EventEmitter.jsm +++ b/toolkit/modules/EventEmitter.sys.mjs @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - const lazy = {}; ChromeUtils.defineModuleGetter( @@ -12,9 +10,7 @@ ChromeUtils.defineModuleGetter( "resource://gre/modules/Console.jsm" ); -var EXPORTED_SYMBOLS = ["EventEmitter"]; - -function EventEmitter() {} +export function EventEmitter() {} let loggingEnabled = Services.prefs.getBoolPref("toolkit.dump.emit"); Services.prefs.addObserver("toolkit.dump.emit", { diff --git a/toolkit/modules/Preferences.jsm b/toolkit/modules/Preferences.sys.mjs similarity index 99% rename from toolkit/modules/Preferences.jsm rename to toolkit/modules/Preferences.sys.mjs index 0a551854efa5..d4b78ae36357 100644 --- a/toolkit/modules/Preferences.jsm +++ b/toolkit/modules/Preferences.sys.mjs @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var EXPORTED_SYMBOLS = ["Preferences"]; - // The minimum and maximum integers that can be set as preferences. // The range of valid values is narrower than the range of valid JS values // because the native preferences code treats integers as NSPR PRInt32s, @@ -11,7 +9,7 @@ var EXPORTED_SYMBOLS = ["Preferences"]; const MAX_INT = 0x7fffffff; // Math.pow(2, 31) - 1 const MIN_INT = -0x80000000; -function Preferences(args) { +export function Preferences(args) { this._cachedPrefBranch = null; if (isObject(args)) { if (args.branch) { diff --git a/toolkit/modules/PrivateBrowsingUtils.jsm b/toolkit/modules/PrivateBrowsingUtils.sys.mjs similarity index 96% rename from toolkit/modules/PrivateBrowsingUtils.jsm rename to toolkit/modules/PrivateBrowsingUtils.sys.mjs index f59215314bd3..487a43bfbf60 100644 --- a/toolkit/modules/PrivateBrowsingUtils.jsm +++ b/toolkit/modules/PrivateBrowsingUtils.sys.mjs @@ -2,15 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -var EXPORTED_SYMBOLS = ["PrivateBrowsingUtils"]; - const kAutoStartPref = "browser.privatebrowsing.autostart"; // This will be set to true when the PB mode is autostarted from the command // line for the current session. var gTemporaryAutoStartMode = false; -var PrivateBrowsingUtils = { +export var PrivateBrowsingUtils = { get enabled() { return Services.policies.isAllowed("privatebrowsing"); }, diff --git a/toolkit/modules/Timer.jsm b/toolkit/modules/Timer.sys.mjs similarity index 80% rename from toolkit/modules/Timer.jsm rename to toolkit/modules/Timer.sys.mjs index 31ed913aeed5..1d76079196ea 100644 --- a/toolkit/modules/Timer.jsm +++ b/toolkit/modules/Timer.sys.mjs @@ -2,23 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - /** * JS module implementation of setTimeout and clearTimeout. */ -var EXPORTED_SYMBOLS = [ - "setTimeout", - "setTimeoutWithTarget", - "clearTimeout", - "setInterval", - "setIntervalWithTarget", - "clearInterval", - "requestIdleCallback", - "cancelIdleCallback", -]; - // This gives us >=2^30 unique timer IDs, enough for 1 per ms for 12.4 days. var gNextId = 1; // setTimeout and setInterval must return a positive integer @@ -78,11 +65,16 @@ function _setTimeoutOrIsInterval( return id; } -function setTimeout(aCallback, aMilliseconds, ...aArgs) { +export function setTimeout(aCallback, aMilliseconds, ...aArgs) { return _setTimeoutOrIsInterval(aCallback, aMilliseconds, false, null, aArgs); } -function setTimeoutWithTarget(aCallback, aMilliseconds, aTarget, ...aArgs) { +export function setTimeoutWithTarget( + aCallback, + aMilliseconds, + aTarget, + ...aArgs +) { return _setTimeoutOrIsInterval( aCallback, aMilliseconds, @@ -92,11 +84,16 @@ function setTimeoutWithTarget(aCallback, aMilliseconds, aTarget, ...aArgs) { ); } -function setInterval(aCallback, aMilliseconds, ...aArgs) { +export function setInterval(aCallback, aMilliseconds, ...aArgs) { return _setTimeoutOrIsInterval(aCallback, aMilliseconds, true, null, aArgs); } -function setIntervalWithTarget(aCallback, aMilliseconds, aTarget, ...aArgs) { +export function setIntervalWithTarget( + aCallback, + aMilliseconds, + aTarget, + ...aArgs +) { return _setTimeoutOrIsInterval( aCallback, aMilliseconds, @@ -112,10 +109,10 @@ function clear(aId) { gTimerTable.delete(aId); } } -var clearInterval = clear; -var clearTimeout = clear; +export var clearInterval = clear; +export var clearTimeout = clear; -function requestIdleCallback(aCallback, aOptions) { +export function requestIdleCallback(aCallback, aOptions) { if (typeof aCallback !== "function") { throw new Error("callback is not a function in requestIdleCallback"); } @@ -133,7 +130,7 @@ function requestIdleCallback(aCallback, aOptions) { return id; } -function cancelIdleCallback(aId) { +export function cancelIdleCallback(aId) { if (gTimerTable.has(aId)) { gTimerTable.delete(aId); } diff --git a/toolkit/modules/WebChannel.jsm b/toolkit/modules/WebChannel.sys.mjs similarity index 98% rename from toolkit/modules/WebChannel.jsm rename to toolkit/modules/WebChannel.sys.mjs index fa0aef3384c7..730d96529b73 100644 --- a/toolkit/modules/WebChannel.jsm +++ b/toolkit/modules/WebChannel.sys.mjs @@ -7,8 +7,6 @@ * to create a two-way communication channel between chrome and content code. */ -var EXPORTED_SYMBOLS = ["WebChannel", "WebChannelBroker"]; - const ERRNO_UNKNOWN_ERROR = 999; const ERROR_UNKNOWN = "UNKNOWN_ERROR"; @@ -17,7 +15,7 @@ const ERROR_UNKNOWN = "UNKNOWN_ERROR"; * This object handles channel registration, origin validation and message multiplexing. */ -var WebChannelBroker = Object.create({ +export var WebChannelBroker = Object.create({ /** * Register a new channel that callbacks messages * based on proper origin and channel name @@ -86,7 +84,7 @@ var WebChannelBroker = Object.create({ * permission manager. * @constructor */ -var WebChannel = function(id, originOrPermission) { +export var WebChannel = function(id, originOrPermission) { if (!id || !originOrPermission) { throw new Error("WebChannel id and originOrPermission are required."); } diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index c0c6e7651597..17dee611f315 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -54,16 +54,16 @@ with Files("AsanReporter.sys.mjs"): with Files("Color.sys.mjs"): BUG_COMPONENT = ("Toolkit", "Find Toolbar") -with Files("Console.jsm"): +with Files("Console.sys.mjs"): BUG_COMPONENT = ("DevTools", "Console") with Files("DateTimePicker*.jsm"): BUG_COMPONENT = ("Core", "Layout: Form Controls") -with Files("DeferredTask.jsm"): +with Files("DeferredTask.sys.mjs"): BUG_COMPONENT = ("Toolkit", "Async Tooling") -with Files("E10SUtils.jsm"): +with Files("E10SUtils.sys.mjs"): BUG_COMPONENT = ("Core", "Security: Process Sandboxing") with Files("nsIE10SUtils.idl"): @@ -105,7 +105,7 @@ with Files("PermissionsUtils.sys.mjs"): with Files("PopupNotifications.sys.mjs"): BUG_COMPONENT = ("Toolkit", "Notifications and Alerts") -with Files("PrivateBrowsingUtils.jsm"): +with Files("PrivateBrowsingUtils.sys.mjs"): BUG_COMPONENT = ("Firefox", "Private Browsing") with Files("Promise*.jsm"): @@ -149,7 +149,7 @@ with Files("docs/**"): EXTRA_JS_MODULES += [ "AboutPagesUtils.sys.mjs", - "ActorManagerParent.jsm", + "ActorManagerParent.sys.mjs", "AppMenuNotifications.sys.mjs", "AsyncPrefs.sys.mjs", "BinarySearch.sys.mjs", @@ -158,14 +158,14 @@ EXTRA_JS_MODULES += [ "CanonicalJSON.jsm", "CertUtils.sys.mjs", "Color.sys.mjs", - "Console.jsm", - "ContentDOMReference.jsm", + "Console.sys.mjs", + "ContentDOMReference.sys.mjs", "CreditCard.sys.mjs", "DateTimePickerPanel.sys.mjs", - "DeferredTask.jsm", - "Deprecated.jsm", - "E10SUtils.jsm", - "EventEmitter.jsm", + "DeferredTask.sys.mjs", + "Deprecated.sys.mjs", + "E10SUtils.sys.mjs", + "EventEmitter.sys.mjs", "FileUtils.sys.mjs", "FindBarContent.sys.mjs", "Finder.sys.mjs", @@ -194,8 +194,8 @@ EXTRA_JS_MODULES += [ "OSKeyStore.sys.mjs", "PermissionsUtils.sys.mjs", "PopupNotifications.sys.mjs", - "Preferences.jsm", - "PrivateBrowsingUtils.jsm", + "Preferences.sys.mjs", + "PrivateBrowsingUtils.sys.mjs", "ProcessType.sys.mjs", "ProfileAge.sys.mjs", "PromiseUtils.sys.mjs", @@ -209,10 +209,10 @@ EXTRA_JS_MODULES += [ "ShortcutUtils.sys.mjs", "Sqlite.sys.mjs", "SubDialog.sys.mjs", - "Timer.jsm", + "Timer.sys.mjs", "Troubleshoot.sys.mjs", "UpdateUtils.sys.mjs", - "WebChannel.jsm", + "WebChannel.sys.mjs", ] if CONFIG["MOZ_ASAN_REPORTER"]: @@ -242,7 +242,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk", "cocoa"): DEFINES["HAVE_SHELL_SERVICE"] = 1 EXTRA_PP_JS_MODULES += [ - "AppConstants.jsm", + "AppConstants.sys.mjs", ] if "Android" != CONFIG["OS_TARGET"]: