Bug 1816999 - ESMified browser/components/shell. r=kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D175274
This commit is contained in:
Bilal 2023-04-14 16:59:15 +00:00
parent a1422d972b
commit b7d19f4f6d
18 changed files with 43 additions and 59 deletions

View File

@ -59,7 +59,7 @@ const startupPhases = {
"resource:///modules/AboutNewTab.jsm",
"resource:///modules/BrowserUsageTelemetry.jsm",
"resource:///modules/ContentCrashHandlers.jsm",
"resource:///modules/ShellService.jsm",
"resource:///modules/ShellService.sys.mjs",
"resource://gre/modules/NewTabUtils.sys.mjs",
"resource://gre/modules/PageThumbs.jsm",
"resource://gre/modules/PlacesUtils.sys.mjs",

View File

@ -13,9 +13,12 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
ChromeUtils.defineESModuleGetters(this, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
ContextualIdentityService:
"resource://gre/modules/ContextualIdentityService.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
URILoadingHelper: "resource:///modules/URILoadingHelper.sys.mjs",
});
@ -23,7 +26,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
ExtensionSettingsStore: "resource://gre/modules/ExtensionSettingsStore.jsm",
ShellService: "resource:///modules/ShellService.jsm",
});
XPCOMUtils.defineLazyGetter(this, "ReferrerInfo", () =>

View File

@ -9,18 +9,18 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
FirstStartup: "resource://gre/modules/FirstStartup.sys.mjs",
HeadlessShell: "resource:///modules/HeadlessShell.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
UpdatePing: "resource://gre/modules/UpdatePing.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
HomePage: "resource:///modules/HomePage.jsm",
LaterRun: "resource:///modules/LaterRun.jsm",
ShellService: "resource:///modules/ShellService.jsm",
});
XPCOMUtils.defineLazyServiceGetters(lazy, {
UpdateManager: ["@mozilla.org/updates/update-manager;1", "nsIUpdateManager"],

View File

@ -49,8 +49,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
PluginManager: "resource:///actors/PluginParent.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
ProvenanceData: "resource:///modules/ProvenanceData.sys.mjs",
PublicSuffixList:
"resource://gre/modules/netwerk-dns/PublicSuffixList.sys.mjs",
QuickSuggest: "resource:///modules/QuickSuggest.sys.mjs",
RFPHelper: "resource://gre/modules/RFPHelper.sys.mjs",
@ -62,9 +64,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
SearchSERPTelemetry: "resource:///modules/SearchSERPTelemetry.sys.mjs",
SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs",
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
SpecialMessageActions:
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
TRRRacer: "resource:///modules/TRRPerformance.sys.mjs",
TelemetryUtils: "resource://gre/modules/TelemetryUtils.sys.mjs",
UIState: "resource://services-sync/UIState.sys.mjs",
@ -104,7 +109,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
ShellService: "resource:///modules/ShellService.jsm",
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
TabUnloader: "resource:///modules/TabUnloader.jsm",
});

View File

@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
const { ShellService } = ChromeUtils.importESModule(
"resource:///modules/ShellService.sys.mjs"
);
add_task(async function test_default_browser_check() {

View File

@ -16,17 +16,21 @@ ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
SpecialMessageActions:
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
AboutWelcomeTelemetry:
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeTelemetry.jsm",
AboutWelcomeDefaults:
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeDefaults.jsm",
ShellService: "resource:///modules/ShellService.jsm",
LangPackMatcher: "resource://gre/modules/LangPackMatcher.jsm",
AWScreenUtils: "resource://activity-stream/lib/AWScreenUtils.jsm",
});

View File

@ -15,8 +15,8 @@ const { AppConstants } = ChromeUtils.importESModule(
const { NewTabUtils } = ChromeUtils.importESModule(
"resource://gre/modules/NewTabUtils.sys.mjs"
);
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
const { ShellService } = ChromeUtils.importESModule(
"resource:///modules/ShellService.sys.mjs"
);
const lazy = {};

View File

@ -19,10 +19,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
ShellService: "resource:///modules/ShellService.jsm",
ShellService: "resource:///modules/ShellService.sys.mjs",
});
XPCOMUtils.defineLazyPreferenceGetter(

View File

@ -52,8 +52,8 @@ async function openAboutWelcome() {
// Stub out the doesAppNeedPin to false so the about:welcome pages do not attempt
// to pin the app.
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
const { ShellService } = ChromeUtils.importESModule(
"resource:///modules/ShellService.sys.mjs"
);
sandbox.stub(ShellService, "doesAppNeedPin").returns(false);

View File

@ -1,7 +1,7 @@
"use strict";
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
const { ShellService } = ChromeUtils.importESModule(
"resource:///modules/ShellService.sys.mjs"
);
const { TelemetryEnvironment } = ChromeUtils.importESModule(

View File

@ -7,7 +7,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
CFRMessageProvider: "resource://activity-stream/lib/CFRMessageProvider.jsm",
HomePage: "resource:///modules/HomePage.jsm",
QueryCache: "resource://activity-stream/lib/ASRouterTargeting.jsm",
ShellService: "resource:///modules/ShellService.jsm",
});
ChromeUtils.defineESModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
@ -21,6 +20,7 @@ ChromeUtils.defineESModuleGetters(this, {
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.sys.mjs",
TelemetrySession: "resource://gre/modules/TelemetrySession.sys.mjs",

View File

@ -2,22 +2,14 @@
* 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 = ["HeadlessShell", "ScreenshotParent"];
const { E10SUtils } = ChromeUtils.importESModule(
"resource://gre/modules/E10SUtils.sys.mjs"
);
const { HiddenFrame } = ChromeUtils.importESModule(
"resource://gre/modules/HiddenFrame.sys.mjs"
);
import { E10SUtils } from "resource://gre/modules/E10SUtils.sys.mjs";
import { HiddenFrame } from "resource://gre/modules/HiddenFrame.sys.mjs";
// Refrences to the progress listeners to keep them from being gc'ed
// before they are called.
const progressListeners = new Set();
class ScreenshotParent extends JSWindowActorParent {
export class ScreenshotParent extends JSWindowActorParent {
getDimensions(params) {
return this.sendQuery("GetDimensions", params);
}
@ -25,10 +17,10 @@ class ScreenshotParent extends JSWindowActorParent {
ChromeUtils.registerWindowActor("Screenshot", {
parent: {
moduleURI: "resource:///modules/HeadlessShell.jsm",
esModuleURI: "resource:///modules/HeadlessShell.sys.mjs",
},
child: {
moduleURI: "resource:///modules/ScreenshotChild.jsm",
esModuleURI: "resource:///modules/ScreenshotChild.sys.mjs",
},
});
@ -169,7 +161,7 @@ async function takeScreenshot(
}
}
let HeadlessShell = {
export let HeadlessShell = {
async handleCmdLineArgs(cmdLine, URLlist) {
try {
// Don't quit even though we don't create a window

View File

@ -2,11 +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";
const EXPORTED_SYMBOLS = ["ScreenshotChild"];
class ScreenshotChild extends JSWindowActorChild {
export class ScreenshotChild extends JSWindowActorChild {
receiveMessage(message) {
if (message.name == "GetDimensions") {
return this.getDimensions();

View File

@ -2,16 +2,9 @@
* 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";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["ShellService"];
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -552,7 +545,7 @@ XPCOMUtils.defineLazyServiceGetters(ShellServiceInternal, {
/**
* The external API exported by this module.
*/
var ShellService = new Proxy(ShellServiceInternal, {
export var ShellService = new Proxy(ShellServiceInternal, {
get(target, name) {
if (name in target) {
return target[name];

View File

@ -69,9 +69,9 @@ if SOURCES:
FINAL_LIBRARY = "browsercomps"
EXTRA_JS_MODULES += [
"HeadlessShell.jsm",
"ScreenshotChild.jsm",
"ShellService.jsm",
"HeadlessShell.sys.mjs",
"ScreenshotChild.sys.mjs",
"ShellService.sys.mjs",
]
for var in (

View File

@ -17,12 +17,12 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.jsm",
Heartbeat: "resource://normandy/lib/Heartbeat.jsm",
ShellService: "resource:///modules/ShellService.jsm",
Storage: "resource://normandy/lib/Storage.jsm",
NormandyUtils: "resource://normandy/lib/NormandyUtils.jsm",
});
ChromeUtils.defineESModuleGetters(lazy, {
ShellService: "resource:///modules/ShellService.sys.mjs",
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
});

View File

@ -1532,8 +1532,8 @@ EnvironmentCache.prototype = {
}
try {
let { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
let { ShellService } = ChromeUtils.importESModule(
"resource:///modules/ShellService.sys.mjs"
);
// This uses the same set of flags used by the pref pane.
return isDefault(ShellService, false, true);

View File

@ -6,11 +6,6 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"ShellService",
"resource:///modules/ShellService.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"AddonManager",
@ -23,6 +18,7 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineESModuleGetters(lazy, {
ShellService: "resource:///modules/ShellService.sys.mjs",
TelemetryArchive: "resource://gre/modules/TelemetryArchive.sys.mjs",
TelemetryController: "resource://gre/modules/TelemetryController.sys.mjs",
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",