Bug 1854785 - Convert AboutWelcomeChild/AboutWelcomeParent to ES modules. r=amy,fxview-reviewers,sclements

Depends on D189045

Differential Revision: https://phabricator.services.mozilla.com/D189047
This commit is contained in:
Mark Banner 2023-10-05 09:43:29 +00:00
Родитель 234cfa01d5
Коммит 7b16815000
10 изменённых файлов: 22 добавлений и 37 удалений

Просмотреть файл

@ -5,8 +5,8 @@
const browser = window.docShell.chromeEventHandler;
const { document: gDoc, XPCOMUtils } = browser.ownerGlobal;
XPCOMUtils.defineLazyModuleGetters(this, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.jsm",
ChromeUtils.defineESModuleGetters(this, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.sys.mjs",
});
const CONFIG = window.arguments[0];

Просмотреть файл

@ -386,10 +386,10 @@ let JSWINDOWACTORS = {
AboutWelcomeShopping: {
parent: {
moduleURI: "resource:///actors/AboutWelcomeParent.jsm",
esModuleURI: "resource:///actors/AboutWelcomeParent.sys.mjs",
},
child: {
moduleURI: "resource:///actors/AboutWelcomeChild.jsm",
esModuleURI: "resource:///actors/AboutWelcomeChild.sys.mjs",
events: {
Update: {},
},
@ -400,10 +400,10 @@ let JSWINDOWACTORS = {
AboutWelcome: {
parent: {
moduleURI: "resource:///actors/AboutWelcomeParent.jsm",
esModuleURI: "resource:///actors/AboutWelcomeParent.sys.mjs",
},
child: {
moduleURI: "resource:///actors/AboutWelcomeChild.jsm",
esModuleURI: "resource:///actors/AboutWelcomeChild.sys.mjs",
events: {
// This is added so the actor instantiates immediately and makes
// methods available to the page js on load.

Просмотреть файл

@ -37,15 +37,12 @@ const { SessionStoreTestUtils } = ChromeUtils.importESModule(
SessionStoreTestUtils.init(this, window);
ChromeUtils.defineESModuleGetters(this, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.sys.mjs",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
SyncedTabs: "resource://services-sync/SyncedTabs.sys.mjs",
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.jsm",
});
const MOBILE_PROMO_DISMISSED_PREF =
"browser.tabs.firefox-view.mobilePromo.dismissed";
const RECENTLY_CLOSED_STATE_PREF =

Просмотреть файл

@ -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";
const EXPORTED_SYMBOLS = ["AboutWelcomeChild", "AboutWelcomeShoppingChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -29,7 +23,7 @@ XPCOMUtils.defineLazyGetter(lazy, "log", () => {
return new Logger("AboutWelcomeChild");
});
class AboutWelcomeChild extends JSWindowActorChild {
export class AboutWelcomeChild extends JSWindowActorChild {
// Can be used to avoid accesses to the document/contentWindow after it's
// destroyed, which may throw unhandled exceptions.
_destroyed = false;
@ -664,7 +658,7 @@ const MIN_VISITS_TO_SHOW_SURVEY = 5;
// Wait 24 hours after opt in to show survey
const MIN_TIME_AFTER_OPT_IN = 24 * 60 * 60;
class AboutWelcomeShoppingChild extends AboutWelcomeChild {
export class AboutWelcomeShoppingChild extends AboutWelcomeChild {
// Static state used to track session in which user opted-in
static optedInSession = false;

Просмотреть файл

@ -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";
const EXPORTED_SYMBOLS = ["AboutWelcomeParent", "AboutWelcomeShoppingParent"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -124,7 +118,7 @@ class AboutWelcomeObserver {
}
}
class AboutWelcomeParent extends JSWindowActorParent {
export class AboutWelcomeParent extends JSWindowActorParent {
constructor() {
super();
this.startAboutWelcomeObserver();
@ -280,7 +274,7 @@ class AboutWelcomeParent extends JSWindowActorParent {
}
}
class AboutWelcomeShoppingParent extends AboutWelcomeParent {
export class AboutWelcomeShoppingParent extends AboutWelcomeParent {
/**
* Handle messages from AboutWelcomeChild.jsm
*

Просмотреть файл

@ -46,8 +46,8 @@ EXTRA_JS_MODULES += [
]
FINAL_TARGET_FILES.actors += [
"aboutwelcome/AboutWelcomeChild.jsm",
"aboutwelcome/AboutWelcomeParent.jsm",
"aboutwelcome/AboutWelcomeChild.sys.mjs",
"aboutwelcome/AboutWelcomeParent.sys.mjs",
"actors/ASRouterChild.sys.mjs",
"actors/ASRouterParent.sys.mjs",
]

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,7 +1,7 @@
"use strict";
const { AboutWelcomeParent } = ChromeUtils.import(
"resource:///actors/AboutWelcomeParent.jsm"
const { AboutWelcomeParent } = ChromeUtils.importESModule(
"resource:///actors/AboutWelcomeParent.sys.mjs"
);
async function openAboutWelcomeTab() {

Просмотреть файл

@ -7,12 +7,12 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.sys.mjs",
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
PageEventManager: "resource://activity-stream/lib/PageEventManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.jsm",
ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
});