diff --git a/dom/push/PushRecord.sys.mjs b/dom/push/PushRecord.sys.mjs index a68e854e38be..aa69a2b22cad 100644 --- a/dom/push/PushRecord.sys.mjs +++ b/dom/push/PushRecord.sys.mjs @@ -6,13 +6,8 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; const lazy = {}; -ChromeUtils.defineModuleGetter( - lazy, - "EventDispatcher", - "resource://gre/modules/Messaging.jsm" -); - ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); diff --git a/mobile/android/chrome/geckoview/geckoview.js b/mobile/android/chrome/geckoview/geckoview.js index 1f8de83b8744..dbacf979b66b 100644 --- a/mobile/android/chrome/geckoview/geckoview.js +++ b/mobile/android/chrome/geckoview/geckoview.js @@ -13,12 +13,12 @@ var { XPCOMUtils } = ChromeUtils.importESModule( ChromeUtils.defineESModuleGetters(this, { E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs", + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { Blocklist: "resource://gre/modules/Blocklist.jsm", - EventDispatcher: "resource://gre/modules/Messaging.jsm", GeckoViewActorManager: "resource://gre/modules/GeckoViewActorManager.jsm", GeckoViewSettings: "resource://gre/modules/GeckoViewSettings.jsm", HistogramStopwatch: "resource://gre/modules/GeckoViewTelemetry.jsm", diff --git a/mobile/android/components/extensions/ExtensionBrowsingData.jsm b/mobile/android/components/extensions/ExtensionBrowsingData.jsm index 1214787d1f50..47321afe7adb 100644 --- a/mobile/android/components/extensions/ExtensionBrowsingData.jsm +++ b/mobile/android/components/extensions/ExtensionBrowsingData.jsm @@ -5,17 +5,14 @@ const EXPORTED_SYMBOLS = ["BrowsingDataDelegate"]; -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); const { ExtensionUtils } = ChromeUtils.import( "resource://gre/modules/ExtensionUtils.jsm" ); const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", }); const { ExtensionError } = ExtensionUtils; diff --git a/mobile/android/components/extensions/ext-android.js b/mobile/android/components/extensions/ext-android.js index 07442aa03681..8dc35960b24f 100644 --- a/mobile/android/components/extensions/ext-android.js +++ b/mobile/android/components/extensions/ext-android.js @@ -19,8 +19,8 @@ ChromeUtils.defineModuleGetter( "resource://gre/modules/GeckoViewWebExtension.jsm" ); -var { EventDispatcher } = ChromeUtils.import( - "resource://gre/modules/Messaging.jsm" +var { EventDispatcher } = ChromeUtils.importESModule( + "resource://gre/modules/Messaging.sys.mjs" ); var { ExtensionCommon } = ChromeUtils.import( diff --git a/mobile/android/components/geckoview/GeckoViewPush.jsm b/mobile/android/components/geckoview/GeckoViewPush.jsm index 60caeafc45df..5899bfd3d898 100644 --- a/mobile/android/components/geckoview/GeckoViewPush.jsm +++ b/mobile/android/components/geckoview/GeckoViewPush.jsm @@ -13,11 +13,9 @@ const { debug, warn } = GeckoViewUtils.initLogging("GeckoViewPush"); const lazy = {}; -ChromeUtils.defineModuleGetter( - lazy, - "EventDispatcher", - "resource://gre/modules/Messaging.jsm" -); +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", +}); // Observer notification topics for push messages and subscription status // changes. These are duplicated and used in `nsIPushNotifier`. They're exposed diff --git a/mobile/android/components/geckoview/GeckoViewStartup.jsm b/mobile/android/components/geckoview/GeckoViewStartup.jsm index ae46e16e978b..18966893f080 100644 --- a/mobile/android/components/geckoview/GeckoViewStartup.jsm +++ b/mobile/android/components/geckoview/GeckoViewStartup.jsm @@ -5,9 +5,6 @@ var EXPORTED_SYMBOLS = ["GeckoViewStartup"]; -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); const { GeckoViewUtils } = ChromeUtils.importESModule( "resource://gre/modules/GeckoViewUtils.sys.mjs" ); @@ -16,13 +13,10 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs", + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", Preferences: "resource://gre/modules/Preferences.sys.mjs", }); -XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", -}); - const { debug, warn } = GeckoViewUtils.initLogging("Startup"); var { DelayedInit } = ChromeUtils.import( diff --git a/mobile/android/modules/geckoview/ChildCrashHandler.jsm b/mobile/android/modules/geckoview/ChildCrashHandler.jsm index 37055b985b68..e0a9f19a1488 100644 --- a/mobile/android/modules/geckoview/ChildCrashHandler.jsm +++ b/mobile/android/modules/geckoview/ChildCrashHandler.jsm @@ -6,9 +6,6 @@ var EXPORTED_SYMBOLS = ["ChildCrashHandler"]; -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); const { GeckoViewUtils } = ChromeUtils.importESModule( "resource://gre/modules/GeckoViewUtils.sys.mjs" ); @@ -18,8 +15,8 @@ const { AppConstants } = ChromeUtils.importESModule( const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", }); const { debug, warn } = GeckoViewUtils.initLogging("ChildCrashHandler"); diff --git a/mobile/android/modules/geckoview/GeckoViewActorChild.jsm b/mobile/android/modules/geckoview/GeckoViewActorChild.jsm index 70583abfe515..9817559d1e24 100644 --- a/mobile/android/modules/geckoview/GeckoViewActorChild.jsm +++ b/mobile/android/modules/geckoview/GeckoViewActorChild.jsm @@ -5,8 +5,8 @@ const { GeckoViewUtils } = ChromeUtils.importESModule( "resource://gre/modules/GeckoViewUtils.sys.mjs" ); -const { EventDispatcher } = ChromeUtils.import( - "resource://gre/modules/Messaging.jsm" +const { EventDispatcher } = ChromeUtils.importESModule( + "resource://gre/modules/Messaging.sys.mjs" ); var EXPORTED_SYMBOLS = ["GeckoViewActorChild"]; diff --git a/mobile/android/modules/geckoview/GeckoViewAutocomplete.jsm b/mobile/android/modules/geckoview/GeckoViewAutocomplete.jsm index 6087384dc976..43c80dd2dfe2 100644 --- a/mobile/android/modules/geckoview/GeckoViewAutocomplete.jsm +++ b/mobile/android/modules/geckoview/GeckoViewAutocomplete.jsm @@ -22,8 +22,11 @@ const { GeckoViewUtils } = ChromeUtils.importESModule( const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", GeckoViewPrompter: "resource://gre/modules/GeckoViewPrompter.jsm", }); diff --git a/mobile/android/modules/geckoview/GeckoViewTab.jsm b/mobile/android/modules/geckoview/GeckoViewTab.jsm index 6cc0035badff..f753f7519ade 100644 --- a/mobile/android/modules/geckoview/GeckoViewTab.jsm +++ b/mobile/android/modules/geckoview/GeckoViewTab.jsm @@ -20,8 +20,11 @@ const { ExtensionError } = ExtensionUtils; const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.jsm", }); diff --git a/mobile/android/modules/geckoview/GeckoViewTestUtils.jsm b/mobile/android/modules/geckoview/GeckoViewTestUtils.jsm index 22221f34c3d3..e8cfad4f4271 100644 --- a/mobile/android/modules/geckoview/GeckoViewTestUtils.jsm +++ b/mobile/android/modules/geckoview/GeckoViewTestUtils.jsm @@ -5,14 +5,10 @@ var EXPORTED_SYMBOLS = ["GeckoViewTabUtil"]; -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", }); const GeckoViewTabUtil = { diff --git a/mobile/android/modules/geckoview/GeckoViewUtils.sys.mjs b/mobile/android/modules/geckoview/GeckoViewUtils.sys.mjs index bfba3a8bd149..2b15807e260d 100644 --- a/mobile/android/modules/geckoview/GeckoViewUtils.sys.mjs +++ b/mobile/android/modules/geckoview/GeckoViewUtils.sys.mjs @@ -9,9 +9,12 @@ import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs"; const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { AndroidLog: "resource://gre/modules/AndroidLog.jsm", - EventDispatcher: "resource://gre/modules/Messaging.jsm", }); /** diff --git a/mobile/android/modules/geckoview/GeckoViewWebExtension.jsm b/mobile/android/modules/geckoview/GeckoViewWebExtension.jsm index dab7ac1cae4d..5814dbec5f23 100644 --- a/mobile/android/modules/geckoview/GeckoViewWebExtension.jsm +++ b/mobile/android/modules/geckoview/GeckoViewWebExtension.jsm @@ -30,12 +30,12 @@ const PRIVATE_BROWSING_PERMISSION = { const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", - EventDispatcher: "resource://gre/modules/Messaging.jsm", Extension: "resource://gre/modules/Extension.jsm", ExtensionData: "resource://gre/modules/Extension.jsm", ExtensionPermissions: "resource://gre/modules/ExtensionPermissions.jsm", diff --git a/mobile/android/modules/geckoview/Messaging.jsm b/mobile/android/modules/geckoview/Messaging.sys.mjs similarity index 98% rename from mobile/android/modules/geckoview/Messaging.jsm rename to mobile/android/modules/geckoview/Messaging.sys.mjs index d7d2bfcbc986..e67161fedec9 100644 --- a/mobile/android/modules/geckoview/Messaging.jsm +++ b/mobile/android/modules/geckoview/Messaging.sys.mjs @@ -1,13 +1,6 @@ /* 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"; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -var EXPORTED_SYMBOLS = ["EventDispatcher"]; const IS_PARENT_PROCESS = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT; @@ -202,7 +195,7 @@ DispatcherDelegate.prototype = { }, }; -var EventDispatcher = { +export var EventDispatcher = { instance: new DispatcherDelegate( IS_PARENT_PROCESS ? Services.androidBridge : undefined ), diff --git a/mobile/android/modules/geckoview/moz.build b/mobile/android/modules/geckoview/moz.build index 880f35710aa2..f8a2bd0f35fa 100644 --- a/mobile/android/modules/geckoview/moz.build +++ b/mobile/android/modules/geckoview/moz.build @@ -36,5 +36,5 @@ EXTRA_JS_MODULES += [ "GeckoViewWebExtension.jsm", "LoadURIDelegate.jsm", "MediaUtils.jsm", - "Messaging.jsm", + "Messaging.sys.mjs", ] diff --git a/mobile/android/modules/test/AppUiTestDelegate.jsm b/mobile/android/modules/test/AppUiTestDelegate.jsm index 3239b3a8cc9b..834daf2d34b0 100644 --- a/mobile/android/modules/test/AppUiTestDelegate.jsm +++ b/mobile/android/modules/test/AppUiTestDelegate.jsm @@ -12,8 +12,11 @@ const { XPCOMUtils } = ChromeUtils.importESModule( const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { - EventDispatcher: "resource://gre/modules/Messaging.jsm", mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.jsm", GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.jsm", }); diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index bafb1a84dcf3..32b914626bcf 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -176,8 +176,8 @@ var Settings = { el.parentElement.addEventListener("click", function(event) { if (event.target.localName === "a") { if (AppConstants.platform == "android") { - var { EventDispatcher } = ChromeUtils.import( - "resource://gre/modules/Messaging.jsm" + var { EventDispatcher } = ChromeUtils.importESModule( + "resource://gre/modules/Messaging.sys.mjs" ); EventDispatcher.instance.sendRequest({ type: "Settings:Show", diff --git a/tools/esmify/map.json b/tools/esmify/map.json index 07f4c71109c4..ae526f233587 100644 --- a/tools/esmify/map.json +++ b/tools/esmify/map.json @@ -1305,8 +1305,6 @@ "mobile/android/modules/geckoview/MediaUtils.jsm", "resource://gre/modules/MessageManagerProxy.jsm": "toolkit/components/extensions/MessageManagerProxy.jsm", - "resource://gre/modules/Messaging.jsm": - "mobile/android/modules/geckoview/Messaging.jsm", "resource://gre/modules/ModulesPing.jsm": "toolkit/components/telemetry/pings/ModulesPing.jsm", "resource://gre/modules/MozProtocolHandler.jsm":