Bug 1797472 - Convert Messaging.jsm to ESM. r=geckoview-reviewers,owlish

Differential Revision: https://phabricator.services.mozilla.com/D160349
This commit is contained in:
Makoto Kato 2022-11-02 14:31:59 +00:00
parent 2c8e232176
commit 1b99d3294e
18 changed files with 37 additions and 57 deletions

View File

@ -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",
});

View File

@ -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",

View File

@ -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;

View File

@ -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(

View File

@ -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

View File

@ -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(

View File

@ -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");

View File

@ -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"];

View File

@ -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",
});

View File

@ -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",
});

View File

@ -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 = {

View File

@ -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",
});
/**

View File

@ -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",

View File

@ -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
),

View File

@ -36,5 +36,5 @@ EXTRA_JS_MODULES += [
"GeckoViewWebExtension.jsm",
"LoadURIDelegate.jsm",
"MediaUtils.jsm",
"Messaging.jsm",
"Messaging.sys.mjs",
]

View File

@ -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",
});

View File

@ -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",

View File

@ -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":