mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1821624
- Convert toolkit/components/messaging-system to ES modules r=Standard8,fxview-reviewers,omc-reviewers,aminomancer,sclements
Differential Revision: https://phabricator.services.mozilla.com/D172406
This commit is contained in:
parent
0fbb298ba4
commit
d0b9714f92
@ -25,12 +25,9 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
|
||||
});
|
||||
|
||||
// We only show the private search banner once per browser session.
|
||||
|
@ -56,6 +56,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.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",
|
||||
@ -101,10 +103,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
|
||||
TabCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
|
||||
TabUnloader: "resource:///modules/TabUnloader.jsm",
|
||||
});
|
||||
|
@ -5,8 +5,8 @@ const { ASRouterTriggerListeners } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterTriggerListeners.jsm"
|
||||
);
|
||||
|
||||
const { SpecialMessageActions } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm"
|
||||
const { SpecialMessageActions } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function cfr_firefoxview_should_show() {
|
||||
|
@ -8,11 +8,13 @@ import { JsonSchema } from "resource://gre/modules/JsonSchema.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
});
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
InfoBar: "resource://activity-stream/lib/InfoBar.jsm",
|
||||
Spotlight: "resource://activity-stream/lib/Spotlight.jsm",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
});
|
||||
|
||||
function dispatchCFRAction({ type, data }, browser) {
|
||||
|
@ -20,8 +20,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("AboutWelcomeChild");
|
||||
});
|
||||
|
@ -16,12 +16,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
AboutWelcomeTelemetry:
|
||||
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeTelemetry.jsm",
|
||||
AboutWelcomeDefaults:
|
||||
@ -32,8 +32,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("AboutWelcomeParent");
|
||||
});
|
||||
|
@ -15,6 +15,9 @@ const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
Downloader: "resource://services-settings/Attachments.sys.mjs",
|
||||
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
@ -38,9 +41,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm",
|
||||
setTimeout: "resource://gre/modules/Timer.jsm",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
Utils: "resource://services-settings/Utils.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetters(lazy, {
|
||||
|
@ -16,8 +16,8 @@ const { TelemetryFeed } = ChromeUtils.import(
|
||||
const { ASRouterParentProcessMessageHandler } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterParentProcessMessageHandler.jsm"
|
||||
);
|
||||
const { SpecialMessageActions } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm"
|
||||
const { SpecialMessageActions } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
|
||||
);
|
||||
const { ASRouterPreferences } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterPreferences.jsm"
|
||||
|
@ -26,6 +26,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
|
||||
Region: "resource://gre/modules/Region.sys.mjs",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.sys.mjs",
|
||||
TelemetrySession: "resource://gre/modules/TelemetrySession.sys.mjs",
|
||||
});
|
||||
@ -34,7 +35,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
ASRouterPreferences: "resource://activity-stream/lib/ASRouterPreferences.jsm",
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
HomePage: "resource:///modules/HomePage.jsm",
|
||||
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
|
@ -22,8 +22,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("ASRouterTriggerListeners");
|
||||
});
|
||||
|
@ -11,12 +11,12 @@ const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
Preferences: "resource://gre/modules/Preferences.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
EveryWindow: "resource:///modules/EveryWindow.jsm",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
@ -67,8 +67,8 @@ ChromeUtils.defineModuleGetter(
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("TopSitesFeed");
|
||||
});
|
||||
|
@ -3,8 +3,8 @@
|
||||
const { OnboardingMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/OnboardingMessageProvider.jsm"
|
||||
);
|
||||
const { SpecialMessageActions } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm"
|
||||
const { SpecialMessageActions } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
|
||||
);
|
||||
const {
|
||||
assertFirefoxViewTabSelected,
|
||||
|
@ -11,7 +11,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
|
||||
QueryCache: "resource://activity-stream/lib/ASRouterTargeting.jsm",
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
});
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
|
||||
@ -22,6 +21,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",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.sys.mjs",
|
||||
TelemetrySession: "resource://gre/modules/TelemetrySession.sys.mjs",
|
||||
});
|
||||
|
@ -12,8 +12,8 @@ const { PanelTestProvider } = ChromeUtils.import(
|
||||
const { BrowserWindowTracker } = ChromeUtils.import(
|
||||
"resource:///modules/BrowserWindowTracker.jsm"
|
||||
);
|
||||
const { SpecialMessageActions } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm"
|
||||
const { SpecialMessageActions } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
|
||||
);
|
||||
|
||||
async function waitForClick(selector, win) {
|
||||
|
@ -5,4 +5,4 @@
|
||||
toolkit.jar:
|
||||
% resource messaging-system %res/messaging-system/
|
||||
res/messaging-system/lib/ (./lib/*)
|
||||
res/messaging-system/targeting/Targeting.jsm (./targeting/Targeting.jsm)
|
||||
res/messaging-system/targeting/Targeting.sys.mjs (./targeting/Targeting.sys.mjs)
|
||||
|
@ -1,17 +1,12 @@
|
||||
/* 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 EXPORTED_SYMBOLS = ["Logger"];
|
||||
|
||||
const { ConsoleAPI } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Console.sys.mjs"
|
||||
);
|
||||
import { ConsoleAPI } from "resource://gre/modules/Console.sys.mjs";
|
||||
|
||||
const LOGGING_PREF = "messaging-system.log";
|
||||
|
||||
class Logger extends ConsoleAPI {
|
||||
export class Logger extends ConsoleAPI {
|
||||
constructor(name) {
|
||||
let consoleOptions = {
|
||||
prefix: name,
|
@ -1,13 +1,9 @@
|
||||
/* 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 EXPORTED_SYMBOLS = ["SpecialMessageActions"];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const DOH_DOORHANGER_DECISION_PREF = "doh-rollout.doorhanger-decision";
|
||||
const NETWORK_TRR_MODE_PREF = "network.trr.mode";
|
||||
|
||||
@ -25,7 +21,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
ColorwayClosetOpener: "resource:///modules/ColorwayClosetOpener.jsm",
|
||||
});
|
||||
|
||||
const SpecialMessageActions = {
|
||||
export const SpecialMessageActions = {
|
||||
// This is overridden by ASRouter.init
|
||||
blockMessageById() {
|
||||
throw new Error("ASRouter not intialized yet");
|
@ -8,11 +8,10 @@ const { JsonSchema } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/JsonSchema.sys.mjs"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SpecialMessageActions",
|
||||
"resource://messaging-system/lib/SpecialMessageActions.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "fetchSMASchema", async () => {
|
||||
const response = await fetch(
|
||||
|
@ -2,14 +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 { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
@ -27,8 +22,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
"resource://gre/modules/components-utils/ClientEnvironment.jsm",
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TargetingContext"];
|
||||
|
||||
const TARGETING_EVENT_CATEGORY = "messaging_experiments";
|
||||
const TARGETING_EVENT_METHOD = "targeting";
|
||||
const DEFAULT_TIMEOUT = 5000;
|
||||
@ -72,7 +65,7 @@ const TargetingEnvironment = {
|
||||
},
|
||||
};
|
||||
|
||||
class TargetingContext {
|
||||
export class TargetingContext {
|
||||
#telemetrySource = null;
|
||||
|
||||
constructor(customContext, options = { source: null }) {
|
@ -1,8 +1,8 @@
|
||||
const { ClientEnvironment } = ChromeUtils.import(
|
||||
"resource://normandy/lib/ClientEnvironment.jsm"
|
||||
);
|
||||
const { TargetingContext } = ChromeUtils.import(
|
||||
"resource://messaging-system/targeting/Targeting.jsm"
|
||||
const { TargetingContext } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/targeting/Targeting.sys.mjs"
|
||||
);
|
||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
|
@ -28,8 +28,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("ExperimentManager");
|
||||
});
|
||||
|
@ -19,19 +19,19 @@ const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
JsonSchema: "resource://gre/modules/JsonSchema.sys.mjs",
|
||||
RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
ASRouterTargeting: "resource://activity-stream/lib/ASRouterTargeting.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
ExperimentManager: "resource://nimbus/lib/ExperimentManager.jsm",
|
||||
CleanupManager: "resource://normandy/lib/CleanupManager.jsm",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
|
||||
const { Logger } = ChromeUtils.import(
|
||||
"resource://messaging-system/lib/Logger.jsm"
|
||||
const { Logger } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/Logger.sys.mjs"
|
||||
);
|
||||
return new Logger("RSLoader");
|
||||
});
|
||||
|
@ -24,19 +24,19 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
LegacyHeartbeat: "resource://normandy/lib/LegacyHeartbeat.sys.mjs",
|
||||
RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
|
||||
RemoteSettingsClient:
|
||||
"resource://services-settings/RemoteSettingsClient.sys.mjs",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
clearTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
LegacyHeartbeat: "resource://normandy/lib/LegacyHeartbeat.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
Storage: "resource://normandy/lib/Storage.jsm",
|
||||
FilterExpressions:
|
||||
"resource://gre/modules/components-utils/FilterExpressions.jsm",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
|
||||
Normandy: "resource://normandy/Normandy.jsm",
|
||||
NormandyApi: "resource://normandy/lib/NormandyApi.jsm",
|
||||
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.jsm",
|
||||
|
Loading…
Reference in New Issue
Block a user