diff --git a/.eslintignore b/.eslintignore index 9fa022ae27c1..15ed4091741b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -183,7 +183,7 @@ services/common/kinto-http-client.js services/common/kinto-offline-client.js # Webpack-bundled library -services/fxaccounts/FxAccountsPairingChannel.sys.mjs +services/fxaccounts/FxAccountsPairingChannel.js # Servo is imported. servo/ diff --git a/browser/actors/AboutProtectionsParent.sys.mjs b/browser/actors/AboutProtectionsParent.sys.mjs index 5ee2ab918d4d..9f06e44e02d2 100644 --- a/browser/actors/AboutProtectionsParent.sys.mjs +++ b/browser/actors/AboutProtectionsParent.sys.mjs @@ -21,8 +21,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js index 769cc7190dae..00978632165d 100644 --- a/browser/base/content/browser-sync.js +++ b/browser/base/content/browser-sync.js @@ -9,10 +9,17 @@ const { UIState } = ChromeUtils.importESModule( "resource://services-sync/UIState.sys.mjs" ); +ChromeUtils.defineModuleGetter( + this, + "FxAccounts", + "resource://gre/modules/FxAccounts.jsm" +); +ChromeUtils.defineModuleGetter( + this, + "EnsureFxAccountsWebChannel", + "resource://gre/modules/FxAccountsWebChannel.jsm" +); ChromeUtils.defineESModuleGetters(this, { - EnsureFxAccountsWebChannel: - "resource://gre/modules/FxAccountsWebChannel.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", SyncedTabs: "resource://services-sync/SyncedTabs.sys.mjs", Weave: "resource://services-sync/main.sys.mjs", }); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index c9f1dd9b4ae2..3839c19f5329 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -104,8 +104,8 @@ XPCOMUtils.defineLazyModuleGetters(this, { }); XPCOMUtils.defineLazyGetter(this, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/base/content/test/performance/browser_startup.js b/browser/base/content/test/performance/browser_startup.js index 478dd353e109..9f643dc7ccf1 100644 --- a/browser/base/content/test/performance/browser_startup.js +++ b/browser/base/content/test/performance/browser_startup.js @@ -83,8 +83,8 @@ const startupPhases = { "resource://gre/modules/BookmarkHTMLUtils.sys.mjs", "resource://gre/modules/Bookmarks.sys.mjs", "resource://gre/modules/ContextualIdentityService.sys.mjs", - "resource://gre/modules/FxAccounts.sys.mjs", - "resource://gre/modules/FxAccountsStorage.sys.mjs", + "resource://gre/modules/FxAccounts.jsm", + "resource://gre/modules/FxAccountsStorage.jsm", "resource://gre/modules/PlacesBackups.sys.mjs", "resource://gre/modules/PlacesExpiration.sys.mjs", "resource://gre/modules/PlacesSyncUtils.sys.mjs", diff --git a/browser/base/content/test/sync/browser_fxa_web_channel.js b/browser/base/content/test/sync/browser_fxa_web_channel.js index 844a9ec3904b..f95f94e1677f 100644 --- a/browser/base/content/test/sync/browser_fxa_web_channel.js +++ b/browser/base/content/test/sync/browser_fxa_web_channel.js @@ -10,8 +10,8 @@ ChromeUtils.defineESModuleGetters(this, { WebChannel: "resource://gre/modules/WebChannel.sys.mjs", }); -var { FxAccountsWebChannel } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsWebChannel.sys.mjs" +var { FxAccountsWebChannel } = ChromeUtils.import( + "resource://gre/modules/FxAccountsWebChannel.jsm" ); // eslint-disable-next-line @microsoft/sdl/no-insecure-url diff --git a/browser/components/BrowserGlue.sys.mjs b/browser/components/BrowserGlue.sys.mjs index 2ab20c9df4c0..e0883cbfed88 100644 --- a/browser/components/BrowserGlue.sys.mjs +++ b/browser/components/BrowserGlue.sys.mjs @@ -27,7 +27,6 @@ ChromeUtils.defineESModuleGetters(lazy, { "resource:///modules/DownloadsViewableInternally.sys.mjs", E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", Integration: "resource://gre/modules/Integration.sys.mjs", Interactions: "resource:///modules/Interactions.sys.mjs", Log: "resource://gre/modules/Log.sys.mjs", @@ -42,7 +41,6 @@ ChromeUtils.defineESModuleGetters(lazy, { PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", QuickSuggest: "resource:///modules/QuickSuggest.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", ScreenshotsUtils: "resource:///modules/ScreenshotsUtils.sys.mjs", SearchSERPTelemetry: "resource:///modules/SearchSERPTelemetry.sys.mjs", SessionStartup: "resource:///modules/sessionstore/SessionStartup.sys.mjs", @@ -76,6 +74,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm", ExtensionsUI: "resource:///modules/ExtensionsUI.jsm", FeatureGate: "resource://featuregates/FeatureGate.jsm", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", HomePage: "resource:///modules/HomePage.jsm", NetUtil: "resource://gre/modules/NetUtil.jsm", NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", @@ -90,6 +89,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { PluralForm: "resource://gre/modules/PluralForm.jsm", ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm", PublicSuffixList: "resource://gre/modules/netwerk-dns/PublicSuffixList.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", RemoteSecuritySettings: "resource://gre/modules/psm/RemoteSecuritySettings.jsm", diff --git a/browser/components/aboutlogins/LoginBreaches.sys.mjs b/browser/components/aboutlogins/LoginBreaches.sys.mjs index 98fd0c1185cb..3240c2f11dbf 100644 --- a/browser/components/aboutlogins/LoginBreaches.sys.mjs +++ b/browser/components/aboutlogins/LoginBreaches.sys.mjs @@ -11,14 +11,10 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", }); export const LoginBreaches = { diff --git a/browser/components/aboutlogins/tests/browser/head.js b/browser/components/aboutlogins/tests/browser/head.js index 643b83b06e99..98b0b4d9b049 100644 --- a/browser/components/aboutlogins/tests/browser/head.js +++ b/browser/components/aboutlogins/tests/browser/head.js @@ -4,8 +4,8 @@ let { LoginBreaches } = ChromeUtils.importESModule( "resource:///modules/LoginBreaches.sys.mjs" ); -let { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +let { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); let { _AboutLogins } = ChromeUtils.importESModule( "resource:///actors/AboutLoginsParent.sys.mjs" diff --git a/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js b/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js index 22768b8a9deb..aab64d4b22fd 100644 --- a/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js +++ b/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js @@ -4,8 +4,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); // Initializing BrowserGlue requires a profile on Windows. diff --git a/browser/components/customizableui/test/browser_synced_tabs_menu.js b/browser/components/customizableui/test/browser_synced_tabs_menu.js index 3865aee3c88b..3017fe04c54d 100644 --- a/browser/components/customizableui/test/browser_synced_tabs_menu.js +++ b/browser/components/customizableui/test/browser_synced_tabs_menu.js @@ -6,8 +6,8 @@ requestLongerTimeout(2); -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); let { SyncedTabs } = ChromeUtils.importESModule( "resource://services-sync/SyncedTabs.sys.mjs" diff --git a/browser/components/doh/DoHConfig.sys.mjs b/browser/components/doh/DoHConfig.sys.mjs index a8736bdc2e20..fcb7e7b06e0f 100644 --- a/browser/components/doh/DoHConfig.sys.mjs +++ b/browser/components/doh/DoHConfig.sys.mjs @@ -8,8 +8,9 @@ * sourced from either Remote Settings or pref values, with Remote Settings * being preferred. */ - -import { RemoteSettings } from "resource://services-settings/remote-settings.sys.mjs"; +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" +); const lazy = {}; diff --git a/browser/components/doh/DoHTestUtils.sys.mjs b/browser/components/doh/DoHTestUtils.sys.mjs index b89c1fe966ab..c65fc913ae17 100644 --- a/browser/components/doh/DoHTestUtils.sys.mjs +++ b/browser/components/doh/DoHTestUtils.sys.mjs @@ -4,8 +4,13 @@ const lazy = {}; +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); + ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TestUtils: "resource://testing-common/TestUtils.sys.mjs", }); diff --git a/browser/components/doh/test/browser/head.js b/browser/components/doh/test/browser/head.js index e587a8589cfa..7eb70457660e 100644 --- a/browser/components/doh/test/browser/head.js +++ b/browser/components/doh/test/browser/head.js @@ -7,11 +7,11 @@ ChromeUtils.defineESModuleGetters(this, { Preferences: "resource://gre/modules/Preferences.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", RegionTestUtils: "resource://testing-common/RegionTestUtils.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { ASRouter: "resource://activity-stream/lib/ASRouter.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyServiceGetter( diff --git a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_home.js b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_home.js index 67b9d379b42d..55cf0701c403 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_home.js +++ b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_home.js @@ -7,12 +7,12 @@ const { AddonTestUtils } = ChromeUtils.import( ); ChromeUtils.defineESModuleGetters(this, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { HomePage: "resource:///modules/HomePage.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js index 3ae1507345e9..d73f3d99949c 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js +++ b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js @@ -8,12 +8,12 @@ const { AddonTestUtils } = ChromeUtils.import( ChromeUtils.defineESModuleGetters(this, { PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { AddonManager: "resource://gre/modules/AddonManager.jsm", HomePage: "resource:///modules/HomePage.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js index 80ddc0afbcfd..1fc35af3f1f9 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js +++ b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js @@ -15,8 +15,8 @@ const { SearchUtils } = ChromeUtils.importESModule( "resource://gre/modules/SearchUtils.sys.mjs" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm"); diff --git a/browser/components/firefoxview/firefox-view-tabs-setup-manager.sys.mjs b/browser/components/firefoxview/firefox-view-tabs-setup-manager.sys.mjs index 0f2296323e63..b72a1845c7c5 100644 --- a/browser/components/firefoxview/firefox-view-tabs-setup-manager.sys.mjs +++ b/browser/components/firefoxview/firefox-view-tabs-setup-manager.sys.mjs @@ -24,8 +24,8 @@ XPCOMUtils.defineLazyGetter(lazy, "syncUtils", () => { }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/components/ion/content/ion.js b/browser/components/ion/content/ion.js index e9c9e3b7badc..330bf2940557 100644 --- a/browser/components/ion/content/ion.js +++ b/browser/components/ion/content/ion.js @@ -15,8 +15,8 @@ const { AddonManager } = ChromeUtils.import( "resource://gre/modules/AddonManager.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { TelemetryController } = ChromeUtils.importESModule( diff --git a/browser/components/newtab/aboutwelcome/AboutWelcomeParent.jsm b/browser/components/newtab/aboutwelcome/AboutWelcomeParent.jsm index 2c9a5fbce365..f700eda5b9bf 100644 --- a/browser/components/newtab/aboutwelcome/AboutWelcomeParent.jsm +++ b/browser/components/newtab/aboutwelcome/AboutWelcomeParent.jsm @@ -15,13 +15,13 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs", BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", MigrationUtils: "resource:///modules/MigrationUtils.jsm", SpecialMessageActions: "resource://messaging-system/lib/SpecialMessageActions.jsm", diff --git a/browser/components/newtab/lib/ASRouter.jsm b/browser/components/newtab/lib/ASRouter.jsm index 305875b37dc3..2f08d7780586 100644 --- a/browser/components/newtab/lib/ASRouter.jsm +++ b/browser/components/newtab/lib/ASRouter.jsm @@ -11,12 +11,6 @@ const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); const lazy = {}; - -ChromeUtils.defineESModuleGetters(lazy, { - Downloader: "resource://services-settings/Attachments.sys.mjs", - MacAttribution: "resource:///modules/MacAttribution.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { SnippetsTestMessageProvider: "resource://activity-stream/lib/SnippetsTestMessageProvider.jsm", @@ -34,6 +28,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { ASRouterTriggerListeners: "resource://activity-stream/lib/ASRouterTriggerListeners.jsm", KintoHttpClient: "resource://services-common/kinto-http-client.js", + Downloader: "resource://services-settings/Attachments.jsm", RemoteImages: "resource://activity-stream/lib/RemoteImages.jsm", RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm", ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm", @@ -44,6 +39,9 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { TargetingContext: "resource://messaging-system/targeting/Targeting.jsm", Utils: "resource://services-settings/Utils.jsm", }); +ChromeUtils.defineESModuleGetters(lazy, { + MacAttribution: "resource:///modules/MacAttribution.sys.mjs", +}); XPCOMUtils.defineLazyServiceGetters(lazy, { BrowserHandler: ["@mozilla.org/browser/clh;1", "nsIBrowserHandler"], }); @@ -57,8 +55,8 @@ const { CFRMessageProvider } = ChromeUtils.import( const { OnboardingMessageProvider } = ChromeUtils.import( "resource://activity-stream/lib/OnboardingMessageProvider.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { CFRPageActions } = ChromeUtils.import( "resource://activity-stream/lib/CFRPageActions.jsm" diff --git a/browser/components/newtab/lib/ASRouterTargeting.jsm b/browser/components/newtab/lib/ASRouterTargeting.jsm index b95bb2fc2c0c..262c5a682e88 100644 --- a/browser/components/newtab/lib/ASRouterTargeting.jsm +++ b/browser/components/newtab/lib/ASRouterTargeting.jsm @@ -48,8 +48,8 @@ ChromeUtils.defineModuleGetter( ); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/components/newtab/lib/DiscoveryStreamFeed.jsm b/browser/components/newtab/lib/DiscoveryStreamFeed.jsm index fda87dd16c5b..1f1aec6bdc53 100644 --- a/browser/components/newtab/lib/DiscoveryStreamFeed.jsm +++ b/browser/components/newtab/lib/DiscoveryStreamFeed.jsm @@ -7,8 +7,12 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", }); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); ChromeUtils.defineModuleGetter( lazy, "pktApi", diff --git a/browser/components/newtab/lib/FaviconFeed.jsm b/browser/components/newtab/lib/FaviconFeed.jsm index ea33fa8b13ad..ad8276284640 100644 --- a/browser/components/newtab/lib/FaviconFeed.jsm +++ b/browser/components/newtab/lib/FaviconFeed.jsm @@ -9,8 +9,8 @@ const { actionTypes: at } = ChromeUtils.importESModule( const { getDomain } = ChromeUtils.import( "resource://activity-stream/lib/TippyTopProvider.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const lazy = {}; diff --git a/browser/components/newtab/lib/PersonalityProvider/PersonalityProvider.jsm b/browser/components/newtab/lib/PersonalityProvider/PersonalityProvider.jsm index c8e4dfc58129..5812666bc943 100644 --- a/browser/components/newtab/lib/PersonalityProvider/PersonalityProvider.jsm +++ b/browser/components/newtab/lib/PersonalityProvider/PersonalityProvider.jsm @@ -5,10 +5,11 @@ const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); ChromeUtils.defineModuleGetter( lazy, @@ -16,6 +17,10 @@ ChromeUtils.defineModuleGetter( "resource://services-settings/Utils.jsm" ); +ChromeUtils.defineESModuleGetters(lazy, { + NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", +}); + const { BasePromiseWorker } = ChromeUtils.import( "resource://gre/modules/PromiseWorker.jsm" ); diff --git a/browser/components/newtab/lib/RemoteImages.jsm b/browser/components/newtab/lib/RemoteImages.jsm index 1843fd1543e0..6d49a5dd45fa 100644 --- a/browser/components/newtab/lib/RemoteImages.jsm +++ b/browser/components/newtab/lib/RemoteImages.jsm @@ -9,15 +9,17 @@ const { JSONFile } = ChromeUtils.importESModule( const { PromiseUtils } = ChromeUtils.importESModule( "resource://gre/modules/PromiseUtils.sys.mjs" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - Downloader: "resource://services-settings/Attachments.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "Downloader", + "resource://services-settings/Attachments.jsm" +); ChromeUtils.defineModuleGetter( lazy, diff --git a/browser/components/newtab/lib/SiteClassifier.jsm b/browser/components/newtab/lib/SiteClassifier.jsm index 0b174676b95f..9527745bef25 100644 --- a/browser/components/newtab/lib/SiteClassifier.jsm +++ b/browser/components/newtab/lib/SiteClassifier.jsm @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); // Returns whether the passed in params match the criteria. diff --git a/browser/components/newtab/lib/TopSitesFeed.jsm b/browser/components/newtab/lib/TopSitesFeed.jsm index 2aab84ab3dba..fb52dd336162 100644 --- a/browser/components/newtab/lib/TopSitesFeed.jsm +++ b/browser/components/newtab/lib/TopSitesFeed.jsm @@ -53,7 +53,6 @@ ChromeUtils.defineModuleGetter( ChromeUtils.defineESModuleGetters(lazy, { NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", }); ChromeUtils.defineModuleGetter( lazy, @@ -65,6 +64,11 @@ ChromeUtils.defineModuleGetter( "PageThumbs", "resource://gre/modules/PageThumbs.jsm" ); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); XPCOMUtils.defineLazyGetter(lazy, "log", () => { const { Logger } = ChromeUtils.import( diff --git a/browser/components/newtab/test/browser/browser_asrouter_bug1761522.js b/browser/components/newtab/test/browser/browser_asrouter_bug1761522.js index 1c492ea2423f..1caa01267eee 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_bug1761522.js +++ b/browser/components/newtab/test/browser/browser_asrouter_bug1761522.js @@ -13,8 +13,8 @@ const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js"); const { RemoteL10n } = ChromeUtils.import( "resource://activity-stream/lib/RemoteL10n.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); // This pref is used to override the Remote Settings server URL in tests. diff --git a/browser/components/newtab/test/browser/browser_asrouter_experimentsAPILoader.js b/browser/components/newtab/test/browser/browser_asrouter_experimentsAPILoader.js index d8ea5f7384a6..0c2225ddc5e3 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_experimentsAPILoader.js +++ b/browser/components/newtab/test/browser/browser_asrouter_experimentsAPILoader.js @@ -1,5 +1,5 @@ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { ASRouter } = ChromeUtils.import( "resource://activity-stream/lib/ASRouter.jsm" diff --git a/browser/components/newtab/test/browser/browser_asrouter_group_frequency.js b/browser/components/newtab/test/browser/browser_asrouter_group_frequency.js index b864c97209b1..03f5625eaaf2 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_group_frequency.js +++ b/browser/components/newtab/test/browser/browser_asrouter_group_frequency.js @@ -1,8 +1,8 @@ const { ASRouter } = ChromeUtils.import( "resource://activity-stream/lib/ASRouter.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { CFRMessageProvider } = ChromeUtils.import( "resource://activity-stream/lib/CFRMessageProvider.jsm" diff --git a/browser/components/newtab/test/browser/browser_asrouter_group_userprefs.js b/browser/components/newtab/test/browser/browser_asrouter_group_userprefs.js index fd60bf225356..0dbde2a73aee 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_group_userprefs.js +++ b/browser/components/newtab/test/browser/browser_asrouter_group_userprefs.js @@ -1,8 +1,8 @@ const { ASRouter } = ChromeUtils.import( "resource://activity-stream/lib/ASRouter.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { CFRMessageProvider } = ChromeUtils.import( "resource://activity-stream/lib/CFRMessageProvider.jsm" diff --git a/browser/components/newtab/test/browser/browser_asrouter_momentspagehub.js b/browser/components/newtab/test/browser/browser_asrouter_momentspagehub.js index 1d0129a8ed91..aa9fa1663125 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_momentspagehub.js +++ b/browser/components/newtab/test/browser/browser_asrouter_momentspagehub.js @@ -4,8 +4,8 @@ const { PanelTestProvider } = ChromeUtils.import( const { MomentsPageHub } = ChromeUtils.import( "resource://activity-stream/lib/MomentsPageHub.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { ASRouter } = ChromeUtils.import( "resource://activity-stream/lib/ASRouter.jsm" diff --git a/browser/components/newtab/test/browser/browser_asrouter_remoteimages.js b/browser/components/newtab/test/browser/browser_asrouter_remoteimages.js index cf382d9fb06d..e9ea52c3d33a 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_remoteimages.js +++ b/browser/components/newtab/test/browser/browser_asrouter_remoteimages.js @@ -9,8 +9,8 @@ const { ASRouter } = ChromeUtils.import( const { BrowserUtils } = ChromeUtils.importESModule( "resource://gre/modules/BrowserUtils.sys.mjs" ); -const { Downloader } = ChromeUtils.importESModule( - "resource://services-settings/Attachments.sys.mjs" +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" ); const { ExperimentFakes } = ChromeUtils.import( "resource://testing-common/NimbusTestUtils.jsm" @@ -26,8 +26,8 @@ const { const { RemoteImagesTestUtils, RemoteSettingsServer } = ChromeUtils.import( "resource://testing-common/RemoteImagesTestUtils.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { RemoteSettingsExperimentLoader } = ChromeUtils.import( "resource://nimbus/lib/RemoteSettingsExperimentLoader.jsm" diff --git a/browser/components/newtab/test/browser/browser_asrouter_targeting.js b/browser/components/newtab/test/browser/browser_asrouter_targeting.js index b00241d5988d..90ceb3ab3b6a 100644 --- a/browser/components/newtab/test/browser/browser_asrouter_targeting.js +++ b/browser/components/newtab/test/browser/browser_asrouter_targeting.js @@ -7,6 +7,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { CFRMessageProvider: "resource://activity-stream/lib/CFRMessageProvider.jsm", ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm", ExperimentFakes: "resource://testing-common/NimbusTestUtils.jsm", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", HomePage: "resource:///modules/HomePage.jsm", NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", QueryCache: "resource://activity-stream/lib/ASRouterTargeting.jsm", @@ -17,7 +18,6 @@ ChromeUtils.defineESModuleGetters(this, { AppConstants: "resource://gre/modules/AppConstants.sys.mjs", AttributionCode: "resource:///modules/AttributionCode.sys.mjs", BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs", ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs", diff --git a/browser/components/newtab/test/browser/head.js b/browser/components/newtab/test/browser/head.js index 8fbb228a552a..6e9d820b9afd 100644 --- a/browser/components/newtab/test/browser/head.js +++ b/browser/components/newtab/test/browser/head.js @@ -14,8 +14,8 @@ ChromeUtils.defineModuleGetter( "resource://activity-stream/lib/ASRouterTargeting.jsm" ); // eslint-disable-next-line no-unused-vars -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); // We import sinon here to make it available across all mochitest test files // eslint-disable-next-line no-unused-vars diff --git a/browser/components/preferences/dialogs/browserLanguages.js b/browser/components/preferences/dialogs/browserLanguages.js index 80a727216532..3aa4f9af9c11 100644 --- a/browser/components/preferences/dialogs/browserLanguages.js +++ b/browser/components/preferences/dialogs/browserLanguages.js @@ -17,9 +17,11 @@ ChromeUtils.defineModuleGetter( "AddonRepository", "resource://gre/modules/addons/AddonRepository.jsm" ); -ChromeUtils.defineESModuleGetters(this, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + this, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); ChromeUtils.defineModuleGetter( this, "SelectionChangedMenulist", diff --git a/browser/components/preferences/fxaPairDevice.js b/browser/components/preferences/fxaPairDevice.js index 8f5c26734db5..5de2bab36463 100644 --- a/browser/components/preferences/fxaPairDevice.js +++ b/browser/components/preferences/fxaPairDevice.js @@ -5,8 +5,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule( "resource://gre/modules/XPCOMUtils.sys.mjs" ); -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const { Weave } = ChromeUtils.importESModule( "resource://services-sync/main.sys.mjs" @@ -14,9 +14,11 @@ const { Weave } = ChromeUtils.importESModule( ChromeUtils.defineESModuleGetters(this, { EventEmitter: "resource://gre/modules/EventEmitter.sys.mjs", - FxAccountsPairingFlow: "resource://gre/modules/FxAccountsPairing.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(this, { + FxAccountsPairingFlow: "resource://gre/modules/FxAccountsPairing.jsm", +}); const { require } = ChromeUtils.importESModule( "resource://devtools/shared/loader/Loader.sys.mjs" ); diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js index f9b38959458f..20b3f9dc6f1e 100644 --- a/browser/components/preferences/preferences.js +++ b/browser/components/preferences/preferences.js @@ -42,8 +42,8 @@ var { Weave } = ChromeUtils.importESModule( "resource://services-sync/main.sys.mjs" ); -var { FxAccounts, getFxAccountsSingleton } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +var { FxAccounts, getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); var fxAccounts = getFxAccountsSingleton(); diff --git a/browser/components/preferences/tests/browser_sync_pairing.js b/browser/components/preferences/tests/browser_sync_pairing.js index 3401e169d61a..76da5b3e3b39 100644 --- a/browser/components/preferences/tests/browser_sync_pairing.js +++ b/browser/components/preferences/tests/browser_sync_pairing.js @@ -6,8 +6,8 @@ const { UIState } = ChromeUtils.importESModule( "resource://services-sync/UIState.sys.mjs" ); -const { FxAccountsPairingFlow } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsPairing.sys.mjs" +const { FxAccountsPairingFlow } = ChromeUtils.import( + "resource://gre/modules/FxAccountsPairing.jsm" ); // Use sinon for mocking. diff --git a/browser/components/search/SearchSERPTelemetry.sys.mjs b/browser/components/search/SearchSERPTelemetry.sys.mjs index 2a9697435dd5..a495c8c551ac 100644 --- a/browser/components/search/SearchSERPTelemetry.sys.mjs +++ b/browser/components/search/SearchSERPTelemetry.sys.mjs @@ -8,10 +8,13 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { BrowserSearchTelemetry: "resource:///modules/BrowserSearchTelemetry.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", +}); + // The various histograms and scalars that we report to. const SEARCH_CONTENT_SCALAR_BASE = "browser.search.content."; const SEARCH_WITH_ADS_SCALAR_BASE = "browser.search.withads."; diff --git a/browser/components/uitour/UITour.jsm b/browser/components/uitour/UITour.jsm index a5be3346653e..f3b10886518a 100644 --- a/browser/components/uitour/UITour.jsm +++ b/browser/components/uitour/UITour.jsm @@ -16,7 +16,6 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AboutReaderParent: "resource:///actors/AboutReaderParent.sys.mjs", BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs", ResetProfile: "resource://gre/modules/ResetProfile.sys.mjs", TelemetryController: "resource://gre/modules/TelemetryController.sys.mjs", @@ -27,12 +26,13 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm", CustomizableUI: "resource:///modules/CustomizableUI.jsm", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", PanelMultiView: "resource:///modules/PanelMultiView.jsm", }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/components/uitour/test/browser_fxa.js b/browser/components/uitour/test/browser_fxa.js index ebb8cab6e704..b12d68c976a7 100644 --- a/browser/components/uitour/test/browser_fxa.js +++ b/browser/components/uitour/test/browser_fxa.js @@ -8,8 +8,8 @@ const { UIState } = ChromeUtils.importESModule( ); XPCOMUtils.defineLazyGetter(this, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/browser/components/urlbar/private/RemoteSettingsClient.sys.mjs b/browser/components/urlbar/private/RemoteSettingsClient.sys.mjs index d6f4cd2bd8a8..d35f1363f281 100644 --- a/browser/components/urlbar/private/RemoteSettingsClient.sys.mjs +++ b/browser/components/urlbar/private/RemoteSettingsClient.sys.mjs @@ -2,6 +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/. */ +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { BaseFeature } from "resource:///modules/urlbar/private/BaseFeature.sys.mjs"; const lazy = {}; @@ -9,11 +10,14 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { EventEmitter: "resource://gre/modules/EventEmitter.sys.mjs", QuickSuggest: "resource:///modules/QuickSuggest.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TaskQueue: "resource:///modules/UrlbarUtils.sys.mjs", UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", +}); + const RS_COLLECTION = "quicksuggest"; // Categories that should show "Firefox Suggest" instead of "Sponsored" diff --git a/browser/modules/test/unit/test_HomePage.js b/browser/modules/test/unit/test_HomePage.js index fc91767a762d..5a6ec95f6e05 100644 --- a/browser/modules/test/unit/test_HomePage.js +++ b/browser/modules/test/unit/test_HomePage.js @@ -8,12 +8,10 @@ const { XPCOMUtils } = ChromeUtils.importESModule( "resource://gre/modules/XPCOMUtils.sys.mjs" ); -ChromeUtils.defineESModuleGetters(this, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(this, { HomePage: "resource:///modules/HomePage.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", + // RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/browser/modules/test/unit/test_HomePage_ignore.js b/browser/modules/test/unit/test_HomePage_ignore.js index 30c09f74f4b1..d62d55738ae4 100644 --- a/browser/modules/test/unit/test_HomePage_ignore.js +++ b/browser/modules/test/unit/test_HomePage_ignore.js @@ -9,12 +9,12 @@ const { XPCOMUtils } = ChromeUtils.importESModule( ); ChromeUtils.defineESModuleGetters(this, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { HomePage: "resource:///modules/HomePage.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/devtools/client/inspector/shared/compatibility-user-settings.js b/devtools/client/inspector/shared/compatibility-user-settings.js index 40366d048611..c1e41dda9b9e 100644 --- a/devtools/client/inspector/shared/compatibility-user-settings.js +++ b/devtools/client/inspector/shared/compatibility-user-settings.js @@ -4,8 +4,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const TARGET_BROWSER_ID = [ diff --git a/devtools/client/shared/devices.js b/devtools/client/shared/devices.js index 6bb3135e613e..d01923e10968 100644 --- a/devtools/client/shared/devices.js +++ b/devtools/client/shared/devices.js @@ -9,8 +9,8 @@ const L10N = new LocalizationHelper( "devtools/client/locales/device.properties" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); loader.lazyRequireGetter( diff --git a/netwerk/dns/PublicSuffixList.jsm b/netwerk/dns/PublicSuffixList.jsm index 675d4cec4067..1759053fc47f 100644 --- a/netwerk/dns/PublicSuffixList.jsm +++ b/netwerk/dns/PublicSuffixList.jsm @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const FileUtils = ChromeUtils.importESModule( "resource://gre/modules/FileUtils.sys.mjs" diff --git a/netwerk/url-classifier/UrlClassifierExceptionListService.jsm b/netwerk/url-classifier/UrlClassifierExceptionListService.jsm index 24c0834e1c3b..29e3bf13d1e3 100644 --- a/netwerk/url-classifier/UrlClassifierExceptionListService.jsm +++ b/netwerk/url-classifier/UrlClassifierExceptionListService.jsm @@ -6,9 +6,11 @@ function UrlClassifierExceptionListService() {} const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); const COLLECTION_NAME = "url-classifier-skip-urls"; diff --git a/security/manager/ssl/RemoteSecuritySettings.jsm b/security/manager/ssl/RemoteSecuritySettings.jsm index 6207a69bae9a..fdc61b82bb05 100644 --- a/security/manager/ssl/RemoteSecuritySettings.jsm +++ b/security/manager/ssl/RemoteSecuritySettings.jsm @@ -5,8 +5,8 @@ const EXPORTED_SYMBOLS = ["RemoteSecuritySettings"]; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { XPCOMUtils } = ChromeUtils.importESModule( diff --git a/security/manager/ssl/tests/unit/test_blocklist_onecrl.js b/security/manager/ssl/tests/unit/test_blocklist_onecrl.js index 59821fbcd9dd..618964c46b68 100644 --- a/security/manager/ssl/tests/unit/test_blocklist_onecrl.js +++ b/security/manager/ssl/tests/unit/test_blocklist_onecrl.js @@ -3,8 +3,8 @@ do_get_profile(); const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm"); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { RemoteSecuritySettings } = ChromeUtils.import( "resource://gre/modules/psm/RemoteSecuritySettings.jsm" diff --git a/services/automation/.eslintrc.js b/services/automation/.eslintrc.js new file mode 100644 index 000000000000..21c7383fe2ad --- /dev/null +++ b/services/automation/.eslintrc.js @@ -0,0 +1,17 @@ +/* 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"; + +module.exports = { + env: { + browser: true, + }, + rules: { + "no-unused-vars": [ + "error", + { args: "none", varsIgnorePattern: "^EXPORTED_SYMBOLS|^Sync" }, + ], + }, +}; diff --git a/services/automation/ServicesAutomation.jsm b/services/automation/ServicesAutomation.jsm index f14e0fbfa287..26dbb93865f3 100644 --- a/services/automation/ServicesAutomation.jsm +++ b/services/automation/ServicesAutomation.jsm @@ -32,8 +32,6 @@ const { XPCOMUtils } = ChromeUtils.importESModule( const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - FxAccountsClient: "resource://gre/modules/FxAccountsClient.sys.mjs", - FxAccountsConfig: "resource://gre/modules/FxAccountsConfig.sys.mjs", Log: "resource://gre/modules/Log.sys.mjs", Svc: "resource://services-sync/util.sys.mjs", Weave: "resource://services-sync/main.sys.mjs", @@ -41,9 +39,14 @@ ChromeUtils.defineESModuleGetters(lazy, { setTimeout: "resource://gre/modules/Timer.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(lazy, { + FxAccountsClient: "resource://gre/modules/FxAccountsClient.jsm", + FxAccountsConfig: "resource://gre/modules/FxAccountsConfig.jsm", +}); + XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/automation/moz.build b/services/automation/moz.build index a6ca3edc789f..796ec0b180d6 100644 --- a/services/automation/moz.build +++ b/services/automation/moz.build @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. with Files("**"): - BUG_COMPONENT = ("Firefox", "Sync") + BUG_COMPONENT = ("Firefox", "Services Automation") EXTRA_COMPONENTS += [ "AutomationComponents.manifest", diff --git a/services/common/hawkrequest.js b/services/common/hawkrequest.js index 2072e845d3c6..0d14dc151bcc 100644 --- a/services/common/hawkrequest.js +++ b/services/common/hawkrequest.js @@ -21,8 +21,8 @@ const { RESTRequest } = ChromeUtils.import( const { CommonUtils } = ChromeUtils.import( "resource://services-common/utils.js" ); -const { Credentials } = ChromeUtils.importESModule( - "resource://gre/modules/Credentials.sys.mjs" +const { Credentials } = ChromeUtils.import( + "resource://gre/modules/Credentials.jsm" ); const lazy = {}; diff --git a/services/fxaccounts/Credentials.sys.mjs b/services/fxaccounts/Credentials.jsm similarity index 95% rename from services/fxaccounts/Credentials.sys.mjs rename to services/fxaccounts/Credentials.jsm index 155dab3a3070..302caea1a665 100644 --- a/services/fxaccounts/Credentials.sys.mjs +++ b/services/fxaccounts/Credentials.jsm @@ -9,8 +9,13 @@ * See https://github.com/mozilla/fxa-auth-server/wiki/onepw-protocol */ -import { Log } from "resource://gre/modules/Log.sys.mjs"; +"use strict"; +var EXPORTED_SYMBOLS = ["Credentials"]; + +const { Log } = ChromeUtils.importESModule( + "resource://gre/modules/Log.sys.mjs" +); const { CryptoUtils } = ChromeUtils.import( "resource://services-crypto/utils.js" ); @@ -40,7 +45,7 @@ var log = Log.repository.getLogger("Identity.FxAccounts"); log.level = LOG_LEVEL; log.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter())); -export var Credentials = Object.freeze({ +var Credentials = Object.freeze({ /** * Make constants accessible to tests */ diff --git a/services/fxaccounts/FxAccounts.sys.mjs b/services/fxaccounts/FxAccounts.jsm similarity index 97% rename from services/fxaccounts/FxAccounts.sys.mjs rename to services/fxaccounts/FxAccounts.jsm index 8a4317e50610..cf4c1c6c6e78 100644 --- a/services/fxaccounts/FxAccounts.sys.mjs +++ b/services/fxaccounts/FxAccounts.jsm @@ -1,17 +1,23 @@ /* 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"; -import { PromiseUtils } from "resource://gre/modules/PromiseUtils.sys.mjs"; - +const { PromiseUtils } = ChromeUtils.importESModule( + "resource://gre/modules/PromiseUtils.sys.mjs" +); const { CryptoUtils } = ChromeUtils.import( "resource://services-crypto/utils.js" ); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs"; - -import { FxAccountsStorageManager } from "resource://gre/modules/FxAccountsStorage.sys.mjs"; - +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { clearTimeout, setTimeout } = ChromeUtils.importESModule( + "resource://gre/modules/Timer.sys.mjs" +); +const { FxAccountsStorageManager } = ChromeUtils.import( + "resource://gre/modules/FxAccountsStorage.jsm" +); const { ERRNO_INVALID_AUTH_TOKEN, ERROR_AUTH_ERROR, @@ -41,16 +47,47 @@ const { const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - FxAccountsClient: "resource://gre/modules/FxAccountsClient.sys.mjs", - FxAccountsCommands: "resource://gre/modules/FxAccountsCommands.sys.mjs", - FxAccountsConfig: "resource://gre/modules/FxAccountsConfig.sys.mjs", - FxAccountsDevice: "resource://gre/modules/FxAccountsDevice.sys.mjs", - FxAccountsKeys: "resource://gre/modules/FxAccountsKeys.sys.mjs", - FxAccountsProfile: "resource://gre/modules/FxAccountsProfile.sys.mjs", - FxAccountsTelemetry: "resource://gre/modules/FxAccountsTelemetry.sys.mjs", - Preferences: "resource://gre/modules/Preferences.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsClient", + "resource://gre/modules/FxAccountsClient.jsm" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsConfig", + "resource://gre/modules/FxAccountsConfig.jsm" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsCommands", + "resource://gre/modules/FxAccountsCommands.js" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsDevice", + "resource://gre/modules/FxAccountsDevice.jsm" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsKeys", + "resource://gre/modules/FxAccountsKeys.jsm" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsProfile", + "resource://gre/modules/FxAccountsProfile.jsm" +); + +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsTelemetry", + "resource://gre/modules/FxAccountsTelemetry.jsm" +); XPCOMUtils.defineLazyGetter(lazy, "mpLocked", () => { return ChromeUtils.importESModule("resource://services-sync/util.sys.mjs") @@ -62,6 +99,10 @@ XPCOMUtils.defineLazyGetter(lazy, "ensureMPUnlocked", () => { .Utils.ensureMPUnlocked; }); +ChromeUtils.defineESModuleGetters(lazy, { + Preferences: "resource://gre/modules/Preferences.sys.mjs", +}); + XPCOMUtils.defineLazyPreferenceGetter( lazy, "FXA_ENABLED", @@ -88,7 +129,7 @@ XPCOMUtils.defineLazyPreferenceGetter( // } // If the state has changed between the function being called and the promise // being resolved, the .resolve() call will actually be rejected. -export function AccountState(storageManager) { +function AccountState(storageManager) { this.storageManager = storageManager; this.inFlightTokenRequests = new Map(); this.promiseInitialized = this.storageManager @@ -334,7 +375,7 @@ function copyObjectProperties(from, to, thisObj, keys) { * (although |./mach doc| is broken on windows (bug 1232403) and on Linux for * markh (some obscure npm issue he gave up on) - so later...) */ -export class FxAccounts { +class FxAccounts { constructor(mocks = null) { this._internal = new FxAccountsInternal(); if (mocks) { @@ -1604,8 +1645,7 @@ FxAccountsInternal.prototype = { }; let fxAccountsSingleton = null; - -export function getFxAccountsSingleton() { +function getFxAccountsSingleton() { if (fxAccountsSingleton) { return fxAccountsSingleton; } @@ -1620,3 +1660,4 @@ export function getFxAccountsSingleton() { } // `AccountState` is exported for tests. +var EXPORTED_SYMBOLS = ["getFxAccountsSingleton", "FxAccounts", "AccountState"]; diff --git a/services/fxaccounts/FxAccountsClient.sys.mjs b/services/fxaccounts/FxAccountsClient.jsm similarity index 99% rename from services/fxaccounts/FxAccountsClient.sys.mjs rename to services/fxaccounts/FxAccountsClient.jsm index cd44adf45437..c81a0cf404ac 100644 --- a/services/fxaccounts/FxAccountsClient.sys.mjs +++ b/services/fxaccounts/FxAccountsClient.jsm @@ -2,6 +2,8 @@ * 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/. */ +var EXPORTED_SYMBOLS = ["FxAccountsClient"]; + const { CommonUtils } = ChromeUtils.import( "resource://services-common/utils.js" ); @@ -23,7 +25,9 @@ const { ERRNO_INVALID_AUTH_TOKEN, log, } = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -import { Credentials } from "resource://gre/modules/Credentials.sys.mjs"; +const { Credentials } = ChromeUtils.import( + "resource://gre/modules/Credentials.jsm" +); const HOST_PREF = "identity.fxaccounts.auth.uri"; @@ -32,9 +36,7 @@ const SIGNUP = "/account/create"; // Devices older than this many days will not appear in the devices list const DEVICES_FILTER_DAYS = 21; -export var FxAccountsClient = function( - host = Services.prefs.getCharPref(HOST_PREF) -) { +var FxAccountsClient = function(host = Services.prefs.getCharPref(HOST_PREF)) { this.host = host; // The FxA auth server expects requests to certain endpoints to be authorized diff --git a/services/fxaccounts/FxAccountsCommands.sys.mjs b/services/fxaccounts/FxAccountsCommands.js similarity index 98% rename from services/fxaccounts/FxAccountsCommands.sys.mjs rename to services/fxaccounts/FxAccountsCommands.js index 0f745f6ee537..bd58438db852 100644 --- a/services/fxaccounts/FxAccountsCommands.sys.mjs +++ b/services/fxaccounts/FxAccountsCommands.js @@ -2,6 +2,8 @@ * 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/. */ +const EXPORTED_SYMBOLS = ["SendTab", "FxAccountsCommands"]; + const { COMMAND_SENDTAB, COMMAND_SENDTAB_TAIL, @@ -14,8 +16,9 @@ ChromeUtils.defineModuleGetter( "PushCrypto", "resource://gre/modules/PushCrypto.jsm" ); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; - +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const { Observers } = ChromeUtils.import( "resource://services-common/observers.js" ); @@ -36,7 +39,7 @@ XPCOMUtils.defineLazyPreferenceGetter( } ); -export class FxAccountsCommands { +class FxAccountsCommands { constructor(fxAccountsInternal) { this._fxai = fxAccountsInternal; this.sendTab = new SendTab(this, fxAccountsInternal); @@ -245,7 +248,7 @@ export class FxAccountsCommands { * the push keys to deliver the tabs using same mechanism we use for web-push. * However, clients use the send-tab keys for end-to-end encryption. */ -export class SendTab { +class SendTab { constructor(commands, fxAccountsInternal) { this._commands = commands; this._fxai = fxAccountsInternal; diff --git a/services/fxaccounts/FxAccountsConfig.sys.mjs b/services/fxaccounts/FxAccountsConfig.jsm similarity index 96% rename from services/fxaccounts/FxAccountsConfig.sys.mjs rename to services/fxaccounts/FxAccountsConfig.jsm index 6ca815a8d00c..ea485c56d321 100644 --- a/services/fxaccounts/FxAccountsConfig.sys.mjs +++ b/services/fxaccounts/FxAccountsConfig.jsm @@ -1,6 +1,8 @@ /* 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"; +var EXPORTED_SYMBOLS = ["FxAccountsConfig"]; const { RESTRequest } = ChromeUtils.import( "resource://services-common/rest.js" @@ -8,20 +10,23 @@ const { RESTRequest } = ChromeUtils.import( const { log } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" ); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); -ChromeUtils.defineESModuleGetters(lazy, { - EnsureFxAccountsWebChannel: - "resource://gre/modules/FxAccountsWebChannel.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "EnsureFxAccountsWebChannel", + "resource://gre/modules/FxAccountsWebChannel.jsm" +); XPCOMUtils.defineLazyPreferenceGetter( lazy, @@ -52,7 +57,7 @@ const CONFIG_PREFS = [ ]; const SYNC_PARAM = "sync"; -export var FxAccountsConfig = { +var FxAccountsConfig = { async promiseEmailURI(email, entrypoint, extraParams = {}) { return this._buildURL("", { extraParams: { entrypoint, email, service: SYNC_PARAM, ...extraParams }, diff --git a/services/fxaccounts/FxAccountsDevice.sys.mjs b/services/fxaccounts/FxAccountsDevice.jsm similarity index 99% rename from services/fxaccounts/FxAccountsDevice.sys.mjs rename to services/fxaccounts/FxAccountsDevice.jsm index ba5ebd0025f4..e2d945e3399b 100644 --- a/services/fxaccounts/FxAccountsDevice.sys.mjs +++ b/services/fxaccounts/FxAccountsDevice.jsm @@ -1,8 +1,11 @@ /* 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"; -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const { log, @@ -54,7 +57,7 @@ function sanitizeDeviceName(name) { } // Everything to do with FxA devices. -export class FxAccountsDevice { +class FxAccountsDevice { constructor(fxai) { this._fxai = fxai; this._deviceListCache = null; @@ -650,3 +653,5 @@ FxAccountsDevice.prototype.QueryInterface = ChromeUtils.generateQI([ function urlsafeBase64Encode(buffer) { return ChromeUtils.base64URLEncode(new Uint8Array(buffer), { pad: false }); } + +var EXPORTED_SYMBOLS = ["FxAccountsDevice"]; diff --git a/services/fxaccounts/FxAccountsKeys.sys.mjs b/services/fxaccounts/FxAccountsKeys.jsm similarity index 99% rename from services/fxaccounts/FxAccountsKeys.sys.mjs rename to services/fxaccounts/FxAccountsKeys.jsm index 97f86ab76994..e4cf5339ed30 100644 --- a/services/fxaccounts/FxAccountsKeys.sys.mjs +++ b/services/fxaccounts/FxAccountsKeys.jsm @@ -1,9 +1,11 @@ /* 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"; -import { PromiseUtils } from "resource://gre/modules/PromiseUtils.sys.mjs"; - +const { PromiseUtils } = ChromeUtils.importESModule( + "resource://gre/modules/PromiseUtils.sys.mjs" +); const { CommonUtils } = ChromeUtils.import( "resource://services-common/utils.js" ); @@ -54,7 +56,7 @@ const DEPRECATED_KEY_SCOPES = [DEPRECATED_SCOPE_ECOSYSTEM_TELEMETRY]; * possible. We intend to remove support for Firefox ever directly handling `kB` * at some point in the future. */ -export class FxAccountsKeys { +class FxAccountsKeys { constructor(fxAccountsInternal) { this._fxai = fxAccountsInternal; } @@ -747,3 +749,5 @@ export class FxAccountsKeys { return CryptoUtils.digestBytes(bytes, hasher); } } + +var EXPORTED_SYMBOLS = ["FxAccountsKeys"]; diff --git a/services/fxaccounts/FxAccountsPairing.sys.mjs b/services/fxaccounts/FxAccountsPairing.jsm similarity index 97% rename from services/fxaccounts/FxAccountsPairing.sys.mjs rename to services/fxaccounts/FxAccountsPairing.jsm index 2953dc50581c..371e792f4980 100644 --- a/services/fxaccounts/FxAccountsPairing.sys.mjs +++ b/services/fxaccounts/FxAccountsPairing.jsm @@ -2,6 +2,8 @@ // 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 { log, PREF_REMOTE_PAIRING_URI, @@ -11,19 +13,16 @@ const { COMMAND_PAIR_HEARTBEAT, COMMAND_PAIR_COMPLETE, } = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -import { - getFxAccountsSingleton, - FxAccounts, -} from "resource://gre/modules/FxAccounts.sys.mjs"; - +const { getFxAccountsSingleton, FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); const fxAccounts = getFxAccountsSingleton(); -import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; - +const { setTimeout, clearTimeout } = ChromeUtils.importESModule( + "resource://gre/modules/Timer.sys.mjs" +); ChromeUtils.import("resource://services-common/utils.js"); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - FxAccountsPairingChannel: - "resource://gre/modules/FxAccountsPairingChannel.sys.mjs", Weave: "resource://services-sync/main.sys.mjs", }); ChromeUtils.defineModuleGetter( @@ -31,6 +30,11 @@ ChromeUtils.defineModuleGetter( "jwcrypto", "resource://services-crypto/jwcrypto.jsm" ); +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsPairingChannel", + "resource://gre/modules/FxAccountsPairingChannel.js" +); const PAIRING_REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob:pair-auth-webchannel"; // A pairing flow is not tied to a specific browser window, can also finish in @@ -169,8 +173,7 @@ class Errored extends State { } const flows = new Map(); - -export class FxAccountsPairingFlow { +class FxAccountsPairingFlow { static get(channelId) { return flows.get(channelId); } @@ -515,3 +518,5 @@ export class FxAccountsPairingFlow { ); } } + +const EXPORTED_SYMBOLS = ["FxAccountsPairingFlow"]; diff --git a/services/fxaccounts/FxAccountsPairingChannel.sys.mjs b/services/fxaccounts/FxAccountsPairingChannel.js similarity index 99% rename from services/fxaccounts/FxAccountsPairingChannel.sys.mjs rename to services/fxaccounts/FxAccountsPairingChannel.js index cb6d3fdb91a4..0e9597d6fb18 100644 --- a/services/fxaccounts/FxAccountsPairingChannel.sys.mjs +++ b/services/fxaccounts/FxAccountsPairingChannel.js @@ -22,14 +22,15 @@ // from Firefox browser code, hence the presence of these privileged browser APIs. // If you're trying to use this from ordinary web content you're in for a bad time. -import { setTimeout } from "resource://gre/modules/Timer.sys.mjs"; - +const {setTimeout} = ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs"); // We cannot use WebSocket from chrome code without a window, // see https://bugzilla.mozilla.org/show_bug.cgi?id=784686 const browser = Services.appShell.createWindowlessBrowser(true); const {WebSocket} = browser.document.ownerGlobal; -export var FxAccountsPairingChannel = +const EXPORTED_SYMBOLS = ["FxAccountsPairingChannel"]; + +var FxAccountsPairingChannel = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -703,7 +704,7 @@ async function verifyHmac(keyBytes, signature, message) { hash: { name: 'SHA-256' }, name: 'HMAC', }, false, ['verify']); - if (! (await crypto.subtle.verify({ name: 'HMAC' }, key, signature, message))) { + if (! await crypto.subtle.verify({ name: 'HMAC' }, key, signature, message)) { // Yes, we really do throw 'decrypt_error' when failing to verify a HMAC, // and a 'bad_record_mac' error when failing to decrypt. throw new TLSError(ALERT_DESCRIPTION.DECRYPT_ERROR); diff --git a/services/fxaccounts/FxAccountsProfile.sys.mjs b/services/fxaccounts/FxAccountsProfile.jsm similarity index 94% rename from services/fxaccounts/FxAccountsProfile.sys.mjs rename to services/fxaccounts/FxAccountsProfile.jsm index 7e8da5cf0301..49594d992c6e 100644 --- a/services/fxaccounts/FxAccountsProfile.sys.mjs +++ b/services/fxaccounts/FxAccountsProfile.jsm @@ -2,6 +2,8 @@ * 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"; + /** * Firefox Accounts Profile helper. * @@ -10,21 +12,25 @@ * the user's profile in open browser tabs, and cacheing/invalidating profile data. */ +var EXPORTED_SYMBOLS = ["FxAccountsProfile"]; + const { ON_PROFILE_CHANGE_NOTIFICATION, log } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" ); -import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; - +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); const fxAccounts = getFxAccountsSingleton(); const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - FxAccountsProfileClient: - "resource://gre/modules/FxAccountsProfileClient.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsProfileClient", + "resource://gre/modules/FxAccountsProfileClient.jsm" +); -export var FxAccountsProfile = function(options = {}) { +var FxAccountsProfile = function(options = {}) { this._currentFetchPromise = null; this._cachedAt = 0; // when we saved the cached version. this._isNotifying = false; // are we sending a notification? diff --git a/services/fxaccounts/FxAccountsProfileClient.sys.mjs b/services/fxaccounts/FxAccountsProfileClient.jsm similarity index 96% rename from services/fxaccounts/FxAccountsProfileClient.sys.mjs rename to services/fxaccounts/FxAccountsProfileClient.jsm index 9165e67386d5..c554699ef58b 100644 --- a/services/fxaccounts/FxAccountsProfileClient.sys.mjs +++ b/services/fxaccounts/FxAccountsProfileClient.jsm @@ -7,6 +7,11 @@ */ "use strict;"; +var EXPORTED_SYMBOLS = [ + "FxAccountsProfileClient", + "FxAccountsProfileClientError", +]; + const { ERRNO_NETWORK, ERRNO_PARSE, @@ -20,8 +25,9 @@ const { SCOPE_PROFILE, SCOPE_PROFILE_WRITE, } = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; - +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); const fxAccounts = getFxAccountsSingleton(); const { RESTRequest } = ChromeUtils.import( "resource://services-common/rest.js" @@ -38,7 +44,7 @@ const { RESTRequest } = ChromeUtils.import( * The bearer token to access the profile server * @constructor */ -export var FxAccountsProfileClient = function(options) { +var FxAccountsProfileClient = function(options) { if (!options || !options.serverURL) { throw new Error("Missing 'serverURL' configuration option"); } @@ -238,7 +244,7 @@ FxAccountsProfileClient.prototype = { * Error message * @constructor */ -export var FxAccountsProfileClientError = function(details) { +var FxAccountsProfileClientError = function(details) { details = details || {}; this.name = "FxAccountsProfileClientError"; diff --git a/services/fxaccounts/FxAccountsPush.sys.mjs b/services/fxaccounts/FxAccountsPush.jsm similarity index 97% rename from services/fxaccounts/FxAccountsPush.sys.mjs rename to services/fxaccounts/FxAccountsPush.jsm index 76151eb6b24c..32160135cca1 100644 --- a/services/fxaccounts/FxAccountsPush.sys.mjs +++ b/services/fxaccounts/FxAccountsPush.jsm @@ -26,7 +26,7 @@ const { * Object, custom options that used for testing * @constructor */ -export function FxAccountsPushService(options = {}) { +function FxAccountsPushService(options = {}) { this.log = log; if (options.log) { @@ -83,8 +83,8 @@ FxAccountsPushService.prototype = { if (options.fxai) { this.fxai = options.fxai; } else { - const { getFxAccountsSingleton } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccounts = getFxAccountsSingleton(); this.fxai = fxAccounts._internal; @@ -312,3 +312,5 @@ FxAccountsPushService.prototype = { }); }, }; + +var EXPORTED_SYMBOLS = ["FxAccountsPushService"]; diff --git a/services/fxaccounts/FxAccountsStorage.sys.mjs b/services/fxaccounts/FxAccountsStorage.jsm similarity index 98% rename from services/fxaccounts/FxAccountsStorage.sys.mjs rename to services/fxaccounts/FxAccountsStorage.jsm index a3222275f1b2..7b1afba4f6c9 100644 --- a/services/fxaccounts/FxAccountsStorage.sys.mjs +++ b/services/fxaccounts/FxAccountsStorage.jsm @@ -1,6 +1,14 @@ /* 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"; + +var EXPORTED_SYMBOLS = [ + "FxAccountsStorageManagerCanStoreField", + "FxAccountsStorageManager", + // Exported for tests. + "LoginManagerStorage", +]; const { DATA_FORMAT_VERSION, @@ -14,7 +22,7 @@ const { // A helper function so code can check what fields are able to be stored by // the storage manager without having a reference to a manager instance. -export function FxAccountsStorageManagerCanStoreField(fieldName) { +function FxAccountsStorageManagerCanStoreField(fieldName) { return ( FXA_PWDMGR_PLAINTEXT_FIELDS.has(fieldName) || FXA_PWDMGR_SECURE_FIELDS.has(fieldName) @@ -22,7 +30,7 @@ export function FxAccountsStorageManagerCanStoreField(fieldName) { } // The storage manager object. -export var FxAccountsStorageManager = function(options = {}) { +var FxAccountsStorageManager = function(options = {}) { this.options = { filename: options.filename || DEFAULT_STORAGE_FILENAME, baseDir: options.baseDir || Services.dirsvc.get("ProfD", Ci.nsIFile).path, @@ -467,7 +475,6 @@ JSONStorage.prototype = { }; function StorageLockedError() {} - /** * LoginManagerStorage constructor that creates instances that set/get * data stored securely in the nsILoginManager. @@ -475,7 +482,7 @@ function StorageLockedError() {} * @return instance */ -export function LoginManagerStorage() {} +function LoginManagerStorage() {} LoginManagerStorage.prototype = { STORAGE_LOCKED: StorageLockedError, diff --git a/services/fxaccounts/FxAccountsTelemetry.sys.mjs b/services/fxaccounts/FxAccountsTelemetry.jsm similarity index 97% rename from services/fxaccounts/FxAccountsTelemetry.sys.mjs rename to services/fxaccounts/FxAccountsTelemetry.jsm index b2b9f6ca3682..1d8cb6fc6f21 100644 --- a/services/fxaccounts/FxAccountsTelemetry.sys.mjs +++ b/services/fxaccounts/FxAccountsTelemetry.jsm @@ -2,12 +2,16 @@ * 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"; + // FxA Telemetry support. For hysterical raisins, the actual implementation // is inside "sync". We should move the core implementation somewhere that's // sanely shared (eg, services-common?), but let's wait and see where we end up // first... -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; @@ -30,7 +34,7 @@ XPCOMUtils.defineLazyPreferenceGetter( "" ); -export class FxAccountsTelemetry { +class FxAccountsTelemetry { constructor(fxai) { this._fxai = fxai; Services.telemetry.setEventRecordingEnabled("fxa", true); @@ -172,3 +176,5 @@ export class FxAccountsTelemetry { } } } + +var EXPORTED_SYMBOLS = ["FxAccountsTelemetry"]; diff --git a/services/fxaccounts/FxAccountsWebChannel.sys.mjs b/services/fxaccounts/FxAccountsWebChannel.jsm similarity index 96% rename from services/fxaccounts/FxAccountsWebChannel.sys.mjs rename to services/fxaccounts/FxAccountsWebChannel.jsm index 9b4dd1b38274..50c85c953683 100644 --- a/services/fxaccounts/FxAccountsWebChannel.sys.mjs +++ b/services/fxaccounts/FxAccountsWebChannel.jsm @@ -1,6 +1,7 @@ /* 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"; /** * Firefox Accounts Web Channel. @@ -9,8 +10,16 @@ * about account state changes. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +var EXPORTED_SYMBOLS = [ + "EnsureFxAccountsWebChannel", + // These are exported for tests. + "FxAccountsWebChannel", + "FxAccountsWebChannelHelpers", +]; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const { COMMAND_PROFILE_CHANGE, COMMAND_LOGIN, @@ -38,23 +47,30 @@ const { const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - FxAccountsPairingFlow: "resource://gre/modules/FxAccountsPairing.sys.mjs", - FxAccountsStorageManagerCanStoreField: - "resource://gre/modules/FxAccountsStorage.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", Weave: "resource://services-sync/main.sys.mjs", WebChannel: "resource://gre/modules/WebChannel.sys.mjs", }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsStorageManagerCanStoreField", + "resource://gre/modules/FxAccountsStorage.jsm" +); ChromeUtils.defineModuleGetter( lazy, "CryptoUtils", "resource://services-crypto/utils.js" ); +ChromeUtils.defineModuleGetter( + lazy, + "FxAccountsPairingFlow", + "resource://gre/modules/FxAccountsPairing.jsm" +); XPCOMUtils.defineLazyPreferenceGetter( lazy, "pairingEnabled", @@ -125,7 +141,7 @@ function getErrorDetails(error) { * Helpers functions. Should only be passed in for testing. * @constructor */ -export function FxAccountsWebChannel(options) { +function FxAccountsWebChannel(options) { if (!options) { throw new Error("Missing configuration options"); } @@ -390,7 +406,7 @@ FxAccountsWebChannel.prototype = { }, }; -export function FxAccountsWebChannelHelpers(options) { +function FxAccountsWebChannelHelpers(options) { options = options || {}; this._fxAccounts = options.fxAccounts || lazy.fxAccounts; @@ -727,13 +743,12 @@ FxAccountsWebChannelHelpers.prototype = { }; var singleton; - // The entry-point for this module, which ensures only one of our channels is // ever created - we require this because the WebChannel is global in scope // (eg, it uses the observer service to tell interested parties of interesting // things) and allowing multiple channels would cause such notifications to be // sent multiple times. -export var EnsureFxAccountsWebChannel = () => { +var EnsureFxAccountsWebChannel = () => { let contentUri = Services.urlFormatter.formatURLPref( "identity.fxaccounts.remote.root" ); diff --git a/services/fxaccounts/components.conf b/services/fxaccounts/components.conf index 992c88d0cbf8..74fb0bcf3eb1 100644 --- a/services/fxaccounts/components.conf +++ b/services/fxaccounts/components.conf @@ -8,7 +8,7 @@ Classes = [ { 'cid': '{1b7db999-2ecd-4abf-bb95-a726896798ca}', 'contract_ids': ['@mozilla.org/fxaccounts/push;1'], - 'esModule': 'resource://gre/modules/FxAccountsPush.sys.mjs', + 'jsm': 'resource://gre/modules/FxAccountsPush.jsm', 'constructor': 'FxAccountsPushService', 'processes': ProcessSelector.MAIN_PROCESS_ONLY, 'categories': {'push': 'chrome://fxa-device-update'}, diff --git a/services/fxaccounts/moz.build b/services/fxaccounts/moz.build index a99a5b0d591e..57cfb77e9bde 100644 --- a/services/fxaccounts/moz.build +++ b/services/fxaccounts/moz.build @@ -14,22 +14,22 @@ BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] XPCSHELL_TESTS_MANIFESTS += ["tests/xpcshell/xpcshell.ini"] EXTRA_JS_MODULES += [ - "Credentials.sys.mjs", - "FxAccounts.sys.mjs", - "FxAccountsClient.sys.mjs", - "FxAccountsCommands.sys.mjs", + "Credentials.jsm", + "FxAccounts.jsm", + "FxAccountsClient.jsm", + "FxAccountsCommands.js", "FxAccountsCommon.js", - "FxAccountsConfig.sys.mjs", - "FxAccountsDevice.sys.mjs", - "FxAccountsKeys.sys.mjs", - "FxAccountsPairing.sys.mjs", - "FxAccountsPairingChannel.sys.mjs", - "FxAccountsProfile.sys.mjs", - "FxAccountsProfileClient.sys.mjs", - "FxAccountsPush.sys.mjs", - "FxAccountsStorage.sys.mjs", - "FxAccountsTelemetry.sys.mjs", - "FxAccountsWebChannel.sys.mjs", + "FxAccountsConfig.jsm", + "FxAccountsDevice.jsm", + "FxAccountsKeys.jsm", + "FxAccountsPairing.jsm", + "FxAccountsPairingChannel.js", + "FxAccountsProfile.jsm", + "FxAccountsProfileClient.jsm", + "FxAccountsPush.jsm", + "FxAccountsStorage.jsm", + "FxAccountsTelemetry.jsm", + "FxAccountsWebChannel.jsm", ] XPCOM_MANIFESTS += [ diff --git a/services/fxaccounts/tests/browser/browser_device_connected.js b/services/fxaccounts/tests/browser/browser_device_connected.js index 315029a32cae..d13441d3f645 100644 --- a/services/fxaccounts/tests/browser/browser_device_connected.js +++ b/services/fxaccounts/tests/browser/browser_device_connected.js @@ -1,8 +1,8 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService( diff --git a/services/fxaccounts/tests/xpcshell/test_accounts.js b/services/fxaccounts/tests/xpcshell/test_accounts.js index 8dd2612f3d58..ab4fb58b0767 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts.js @@ -6,11 +6,11 @@ const { CryptoUtils } = ChromeUtils.import( "resource://services-crypto/utils.js" ); -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); const { ERRNO_INVALID_AUTH_TOKEN, @@ -27,8 +27,8 @@ const { PromiseUtils } = ChromeUtils.importESModule( ); // We grab some additional stuff via backstage passes. -var { AccountState } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +var { AccountState } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const MOCK_TOKEN_RESPONSE = { diff --git a/services/fxaccounts/tests/xpcshell/test_accounts_config.js b/services/fxaccounts/tests/xpcshell/test_accounts_config.js index ca7c32d8bf82..ccdb9d426f52 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts_config.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts_config.js @@ -3,8 +3,8 @@ "use strict"; -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); add_task( diff --git a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js index 9fedf7573708..613d1ec5b4c2 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js @@ -3,14 +3,14 @@ "use strict"; -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); -const { FxAccountsDevice } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsDevice.sys.mjs" +const { FxAccountsDevice } = ChromeUtils.import( + "resource://gre/modules/FxAccountsDevice.jsm" ); const { ERRNO_DEVICE_SESSION_CONFLICT, @@ -20,8 +20,8 @@ const { ON_DEVICE_DISCONNECTED_NOTIFICATION, ON_DEVICELIST_UPDATED, } = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -var { AccountState } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +var { AccountState } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); initTestLogging("Trace"); diff --git a/services/fxaccounts/tests/xpcshell/test_client.js b/services/fxaccounts/tests/xpcshell/test_client.js index 276c0436be2e..6d0a08b44fb0 100644 --- a/services/fxaccounts/tests/xpcshell/test_client.js +++ b/services/fxaccounts/tests/xpcshell/test_client.js @@ -3,8 +3,8 @@ "use strict"; -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); const FAKE_SESSION_TOKEN = diff --git a/services/fxaccounts/tests/xpcshell/test_commands.js b/services/fxaccounts/tests/xpcshell/test_commands.js index a1b2b26487c6..5e0824eda33f 100644 --- a/services/fxaccounts/tests/xpcshell/test_commands.js +++ b/services/fxaccounts/tests/xpcshell/test_commands.js @@ -3,12 +3,12 @@ "use strict"; -const { FxAccountsCommands, SendTab } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsCommands.sys.mjs" +const { FxAccountsCommands, SendTab } = ChromeUtils.import( + "resource://gre/modules/FxAccountsCommands.js" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); const { COMMAND_SENDTAB, COMMAND_SENDTAB_TAIL } = ChromeUtils.import( diff --git a/services/fxaccounts/tests/xpcshell/test_credentials.js b/services/fxaccounts/tests/xpcshell/test_credentials.js index 907a1e61f4f9..d41ef4ab42be 100644 --- a/services/fxaccounts/tests/xpcshell/test_credentials.js +++ b/services/fxaccounts/tests/xpcshell/test_credentials.js @@ -1,8 +1,8 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -const { Credentials } = ChromeUtils.importESModule( - "resource://gre/modules/Credentials.sys.mjs" +const { Credentials } = ChromeUtils.import( + "resource://gre/modules/Credentials.jsm" ); const { CryptoUtils } = ChromeUtils.import( "resource://services-crypto/utils.js" diff --git a/services/fxaccounts/tests/xpcshell/test_device.js b/services/fxaccounts/tests/xpcshell/test_device.js index 704d4e735210..85f29532d017 100644 --- a/services/fxaccounts/tests/xpcshell/test_device.js +++ b/services/fxaccounts/tests/xpcshell/test_device.js @@ -3,8 +3,8 @@ "use strict"; -const { getFxAccountsSingleton } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccounts = getFxAccountsSingleton(); diff --git a/services/fxaccounts/tests/xpcshell/test_keys.js b/services/fxaccounts/tests/xpcshell/test_keys.js index de8bbd59b2be..3af0dfa61717 100644 --- a/services/fxaccounts/tests/xpcshell/test_keys.js +++ b/services/fxaccounts/tests/xpcshell/test_keys.js @@ -3,8 +3,8 @@ "use strict"; -const { FxAccountsKeys } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsKeys.sys.mjs" +const { FxAccountsKeys } = ChromeUtils.import( + "resource://gre/modules/FxAccountsKeys.jsm" ); // Ref https://github.com/mozilla/fxa-crypto-relier/ for the details diff --git a/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js b/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js index 745f40157cc5..7ce2c7b0c2f8 100644 --- a/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js +++ b/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js @@ -8,8 +8,8 @@ // See verbose logging from FxAccounts.jsm Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace"); -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" @@ -17,8 +17,8 @@ const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.import( // Use a backstage pass to get at our LoginManagerStorage object, so we can // mock the prototype. -var { LoginManagerStorage } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsStorage.sys.mjs" +var { LoginManagerStorage } = ChromeUtils.import( + "resource://gre/modules/FxAccountsStorage.jsm" ); var isLoggedIn = true; LoginManagerStorage.prototype.__defineGetter__("_isLoggedIn", () => isLoggedIn); diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js b/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js index 5ade769c2bd5..ecd6cafb7fb3 100644 --- a/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js +++ b/services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js @@ -3,16 +3,16 @@ "use strict"; -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); // We grab some additional stuff via backstage passes. -var { AccountState } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +var { AccountState } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); function promiseNotification(topic) { diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js b/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js index ac3951e00a86..ee7eeb85892a 100644 --- a/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js +++ b/services/fxaccounts/tests/xpcshell/test_oauth_tokens.js @@ -3,14 +3,14 @@ "use strict"; -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); -var { AccountState } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +var { AccountState } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); function promiseNotification(topic) { diff --git a/services/fxaccounts/tests/xpcshell/test_pairing.js b/services/fxaccounts/tests/xpcshell/test_pairing.js index 1f98594c995f..ca3cc49a735c 100644 --- a/services/fxaccounts/tests/xpcshell/test_pairing.js +++ b/services/fxaccounts/tests/xpcshell/test_pairing.js @@ -3,8 +3,8 @@ "use strict"; -const { FxAccountsPairingFlow } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsPairing.sys.mjs" +const { FxAccountsPairingFlow } = ChromeUtils.import( + "resource://gre/modules/FxAccountsPairing.jsm" ); const { EventEmitter } = ChromeUtils.importESModule( "resource://gre/modules/EventEmitter.sys.mjs" diff --git a/services/fxaccounts/tests/xpcshell/test_profile.js b/services/fxaccounts/tests/xpcshell/test_profile.js index 99c7fa863778..aef4604060fe 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile.js +++ b/services/fxaccounts/tests/xpcshell/test_profile.js @@ -6,11 +6,11 @@ const { ON_PROFILE_CHANGE_NOTIFICATION, log } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" ); -const { FxAccountsProfileClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsProfileClient.sys.mjs" +const { FxAccountsProfileClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsProfileClient.jsm" ); -const { FxAccountsProfile } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsProfile.sys.mjs" +const { FxAccountsProfile } = ChromeUtils.import( + "resource://gre/modules/FxAccountsProfile.jsm" ); const { PromiseUtils } = ChromeUtils.importESModule( "resource://gre/modules/PromiseUtils.sys.mjs" diff --git a/services/fxaccounts/tests/xpcshell/test_profile_client.js b/services/fxaccounts/tests/xpcshell/test_profile_client.js index 5e5408022049..595426325d22 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile_client.js +++ b/services/fxaccounts/tests/xpcshell/test_profile_client.js @@ -16,9 +16,7 @@ const { const { FxAccountsProfileClient, FxAccountsProfileClientError, -} = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsProfileClient.sys.mjs" -); +} = ChromeUtils.import("resource://gre/modules/FxAccountsProfileClient.jsm"); const STATUS_SUCCESS = 200; diff --git a/services/fxaccounts/tests/xpcshell/test_push_service.js b/services/fxaccounts/tests/xpcshell/test_push_service.js index 0e8e66807d75..3748d93511e9 100644 --- a/services/fxaccounts/tests/xpcshell/test_push_service.js +++ b/services/fxaccounts/tests/xpcshell/test_push_service.js @@ -5,6 +5,7 @@ // Tests for the FxA push service. +/* eslint-disable no-shadow */ /* eslint-disable mozilla/use-chromeutils-generateqi */ const { @@ -21,13 +22,16 @@ const { log, } = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -const { FxAccountsPushService } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsPush.sys.mjs" +let importScope = {}; +Services.scriptloader.loadSubScript( + "resource://gre/modules/FxAccountsPush.jsm", + importScope ); +const FxAccountsPushService = importScope.FxAccountsPushService; XPCOMUtils.defineLazyServiceGetter( this, - "PushService", + "pushService", "@mozilla.org/push/Service;1", "nsIPushService" ); @@ -39,8 +43,8 @@ const MOCK_ENDPOINT = "http://mochi.test:8888"; // tests do not allow external connections, mock the PushService let mockPushService = { - pushTopic: PushService.pushTopic, - subscriptionChangeTopic: PushService.subscriptionChangeTopic, + pushTopic: pushService.pushTopic, + subscriptionChangeTopic: pushService.subscriptionChangeTopic, subscribe(scope, principal, cb) { cb(Cr.NS_OK, { endpoint: MOCK_ENDPOINT, @@ -212,8 +216,8 @@ add_task(async function observePushTopicDeviceDisconnected_current_device() { }; let signoutCalled = false; - let { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + let { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccountsMock = new FxAccounts({ newAccountState() { @@ -268,8 +272,8 @@ add_task(async function observePushTopicDeviceDisconnected_another_device() { }; let signoutCalled = false; - let { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + let { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccountsMock = new FxAccounts({ newAccountState() { diff --git a/services/fxaccounts/tests/xpcshell/test_storage_manager.js b/services/fxaccounts/tests/xpcshell/test_storage_manager.js index bb04db7fa2f7..82310e3d3d89 100644 --- a/services/fxaccounts/tests/xpcshell/test_storage_manager.js +++ b/services/fxaccounts/tests/xpcshell/test_storage_manager.js @@ -5,8 +5,8 @@ // Tests for the FxA storage manager. -const { FxAccountsStorageManager } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsStorage.sys.mjs" +const { FxAccountsStorageManager } = ChromeUtils.import( + "resource://gre/modules/FxAccountsStorage.jsm" ); const { DATA_FORMAT_VERSION, log } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" diff --git a/services/fxaccounts/tests/xpcshell/test_telemetry.js b/services/fxaccounts/tests/xpcshell/test_telemetry.js index 3b9d318404ba..6ecd0fad1196 100644 --- a/services/fxaccounts/tests/xpcshell/test_telemetry.js +++ b/services/fxaccounts/tests/xpcshell/test_telemetry.js @@ -3,8 +3,8 @@ "use strict"; -const { getFxAccountsSingleton } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccounts = getFxAccountsSingleton(); diff --git a/services/fxaccounts/tests/xpcshell/test_web_channel.js b/services/fxaccounts/tests/xpcshell/test_web_channel.js index e0731380132e..010c9edb6b3f 100644 --- a/services/fxaccounts/tests/xpcshell/test_web_channel.js +++ b/services/fxaccounts/tests/xpcshell/test_web_channel.js @@ -14,9 +14,7 @@ const { CryptoUtils } = ChromeUtils.import( const { FxAccountsWebChannel, FxAccountsWebChannelHelpers, -} = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsWebChannel.sys.mjs" -); +} = ChromeUtils.import("resource://gre/modules/FxAccountsWebChannel.jsm"); const URL_STRING = "https://example.com"; diff --git a/services/settings/Attachments.sys.mjs b/services/settings/Attachments.jsm similarity index 98% rename from services/settings/Attachments.sys.mjs rename to services/settings/Attachments.jsm index ce4a0dd1ba03..d8fc0a211d61 100644 --- a/services/settings/Attachments.sys.mjs +++ b/services/settings/Attachments.jsm @@ -2,16 +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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +var EXPORTED_SYMBOLS = ["Downloader"]; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; - -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettingsWorker: - "resource://services-settings/RemoteSettingsWorker.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettingsWorker: "resource://services-settings/RemoteSettingsWorker.jsm", Utils: "resource://services-settings/Utils.jsm", }); @@ -94,7 +92,7 @@ class LazyRecordAndBuffer { } } -export class Downloader { +class Downloader { static get DownloadError() { return DownloadError; } diff --git a/services/settings/Database.sys.mjs b/services/settings/Database.jsm similarity index 99% rename from services/settings/Database.sys.mjs rename to services/settings/Database.jsm index b4d79a34f11b..5ee84c108fd7 100644 --- a/services/settings/Database.sys.mjs +++ b/services/settings/Database.jsm @@ -2,7 +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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; @@ -18,12 +20,14 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { }); XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log); +var EXPORTED_SYMBOLS = ["Database"]; + /** * Database is a tiny wrapper with the objective * of providing major kinto-offline-client collection API. * (with the objective of getting rid of kinto-offline-client) */ -export class Database { +class Database { static destroy() { return destroyIDB(); } diff --git a/services/settings/RemoteSettingsClient.sys.mjs b/services/settings/RemoteSettingsClient.jsm similarity index 98% rename from services/settings/RemoteSettingsClient.sys.mjs rename to services/settings/RemoteSettingsClient.jsm index 893baca7d490..82b16c8a249b 100644 --- a/services/settings/RemoteSettingsClient.sys.mjs +++ b/services/settings/RemoteSettingsClient.jsm @@ -2,25 +2,30 @@ * 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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; -import { Downloader } from "resource://services-settings/Attachments.sys.mjs"; +var EXPORTED_SYMBOLS = ["RemoteSettingsClient"]; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" +); const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - Database: "resource://services-settings/Database.sys.mjs", - RemoteSettingsWorker: - "resource://services-settings/RemoteSettingsWorker.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { ClientEnvironmentBase: "resource://gre/modules/components-utils/ClientEnvironment.jsm", + Database: "resource://services-settings/Database.jsm", IDBHelpers: "resource://services-settings/IDBHelpers.jsm", KintoHttpClient: "resource://services-common/kinto-http-client.js", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", + RemoteSettingsWorker: "resource://services-settings/RemoteSettingsWorker.jsm", SharedUtils: "resource://services-settings/SharedUtils.jsm", UptakeTelemetry: "resource://services-common/uptake-telemetry.js", Utils: "resource://services-settings/Utils.jsm", @@ -262,7 +267,7 @@ class AttachmentDownloader extends Downloader { } } -export class RemoteSettingsClient extends EventEmitter { +class RemoteSettingsClient extends EventEmitter { static get APIError() { return APIError; } diff --git a/services/settings/RemoteSettingsComponents.sys.mjs b/services/settings/RemoteSettingsComponents.jsm similarity index 75% rename from services/settings/RemoteSettingsComponents.sys.mjs rename to services/settings/RemoteSettingsComponents.jsm index 131546c14ac9..e3f24e67e042 100644 --- a/services/settings/RemoteSettingsComponents.sys.mjs +++ b/services/settings/RemoteSettingsComponents.jsm @@ -1,14 +1,19 @@ /* 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"; + +var EXPORTED_SYMBOLS = ["RemoteSettingsTimer"]; const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); -export var RemoteSettingsTimer = function() {}; +var RemoteSettingsTimer = function() {}; RemoteSettingsTimer.prototype = { QueryInterface: ChromeUtils.generateQI(["nsITimerCallback"]), classID: Components.ID("{5e756573-234a-49ea-bbe4-59ec7a70657d}"), diff --git a/services/settings/RemoteSettingsWorker.js b/services/settings/RemoteSettingsWorker.js index 96ca53011206..662b3a8a206e 100644 --- a/services/settings/RemoteSettingsWorker.js +++ b/services/settings/RemoteSettingsWorker.js @@ -129,7 +129,7 @@ const Agent = { /** * Wrap worker invocations in order to return the `callbackId` along * the result. This will allow to transform the worker invocations - * into promises in `RemoteSettingsWorker.sys.mjs`. + * into promises in `RemoteSettingsWorker.jsm`. */ self.onmessage = event => { const { callbackId, method, args = [] } = event.data; @@ -157,7 +157,7 @@ let gPendingTransactions = new Set(); */ async function importDumpIDB(bucket, collection, records, timestamp) { // Open the DB. It will exist since if we are running this, it means - // we already tried to read the timestamp in `remote-settings.sys.mjs` + // we already tried to read the timestamp in `remote-settings.js` const db = await IDBHelpers.openIDB(false /* do not allow upgrades */); // try...finally to ensure we always close the db. diff --git a/services/settings/RemoteSettingsWorker.sys.mjs b/services/settings/RemoteSettingsWorker.jsm similarity index 95% rename from services/settings/RemoteSettingsWorker.sys.mjs rename to services/settings/RemoteSettingsWorker.jsm index c08adbca983e..b47ceff9d0f3 100644 --- a/services/settings/RemoteSettingsWorker.sys.mjs +++ b/services/settings/RemoteSettingsWorker.jsm @@ -2,12 +2,19 @@ * 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"; + /** * Interface to a dedicated thread handling for Remote Settings heavy operations. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { setTimeout, clearTimeout } = ChromeUtils.importESModule( + "resource://gre/modules/Timer.sys.mjs" +); -import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; +var EXPORTED_SYMBOLS = ["RemoteSettingsWorker"]; const lazy = {}; @@ -233,6 +240,6 @@ try { gShutdown = true; } -export var RemoteSettingsWorker = new Worker( +var RemoteSettingsWorker = new Worker( "resource://services-settings/RemoteSettingsWorker.js" ); diff --git a/services/settings/SyncHistory.sys.mjs b/services/settings/SyncHistory.jsm similarity index 95% rename from services/settings/SyncHistory.sys.mjs rename to services/settings/SyncHistory.jsm index 933956c40df6..21ddeb5aa02d 100644 --- a/services/settings/SyncHistory.sys.mjs +++ b/services/settings/SyncHistory.jsm @@ -2,7 +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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; @@ -10,6 +12,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { KeyValueService: "resource://gre/modules/kvstore.jsm", }); +var EXPORTED_SYMBOLS = ["SyncHistory"]; + /** * A helper to keep track of synchronization statuses. * @@ -17,7 +21,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { * because the eventual goal is to be able to detect `IndexedDB` issues and act * accordingly. */ -export class SyncHistory { +class SyncHistory { // Internal reference to underlying rkv store. #store; diff --git a/services/settings/components.conf b/services/settings/components.conf index fbc4df9bfc79..9a737802eeab 100644 --- a/services/settings/components.conf +++ b/services/settings/components.conf @@ -8,7 +8,7 @@ Classes = [ { 'cid': '{5e756573-234a-49ea-bbe4-59ec7a70657d}', 'contract_ids': ['@mozilla.org/services/settings;1'], - 'esModule': 'resource://services-settings/RemoteSettingsComponents.sys.mjs', + 'jsm': 'resource://services-settings/RemoteSettingsComponents.jsm', 'constructor': 'RemoteSettingsTimer', }, ] diff --git a/services/settings/docs/index.rst b/services/settings/docs/index.rst index 846a8349361b..7f9270e574b8 100644 --- a/services/settings/docs/index.rst +++ b/services/settings/docs/index.rst @@ -4,7 +4,7 @@ Remote Settings =============== -The :searchfox:`remote-settings.sys.mjs ` module offers the ability to fetch remote settings that are kept in sync with Mozilla servers. +The `remote-settings.js `_ module offers the ability to fetch remote settings that are kept in sync with Mozilla servers. Usage @@ -14,7 +14,7 @@ The ``get()`` method returns the list of entries for a specific key. Each entry .. code-block:: js - const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.sys.mjs"); + const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js"); const data = await RemoteSettings("a-key").get(); diff --git a/services/settings/moz.build b/services/settings/moz.build index 1926cd6bf730..31740e3c7577 100644 --- a/services/settings/moz.build +++ b/services/settings/moz.build @@ -15,16 +15,16 @@ EXTRA_COMPONENTS += [ ] EXTRA_JS_MODULES["services-settings"] += [ - "Attachments.sys.mjs", - "Database.sys.mjs", + "Attachments.jsm", + "Database.jsm", "IDBHelpers.jsm", - "remote-settings.sys.mjs", - "RemoteSettingsClient.sys.mjs", - "RemoteSettingsComponents.sys.mjs", + "remote-settings.js", + "RemoteSettingsClient.jsm", + "RemoteSettingsComponents.jsm", "RemoteSettingsWorker.js", - "RemoteSettingsWorker.sys.mjs", + "RemoteSettingsWorker.jsm", "SharedUtils.jsm", - "SyncHistory.sys.mjs", + "SyncHistory.jsm", "Utils.jsm", ] diff --git a/services/settings/remote-settings.sys.mjs b/services/settings/remote-settings.js similarity index 96% rename from services/settings/remote-settings.sys.mjs rename to services/settings/remote-settings.js index 5ffcc75c1a76..1ecadd51d35f 100644 --- a/services/settings/remote-settings.sys.mjs +++ b/services/settings/remote-settings.js @@ -4,23 +4,30 @@ /* global __URI__ */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; + +var EXPORTED_SYMBOLS = [ + "RemoteSettings", + "jexlFilterFunc", + "remoteSettingsBroadcastHandler", +]; + +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, { - Database: "resource://services-settings/Database.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", - SyncHistory: "resource://services-settings/SyncHistory.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { UptakeTelemetry: "resource://services-common/uptake-telemetry.js", pushBroadcastService: "resource://gre/modules/PushBroadcastService.jsm", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", + SyncHistory: "resource://services-settings/SyncHistory.jsm", + Database: "resource://services-settings/Database.jsm", Utils: "resource://services-settings/Utils.jsm", - FilterExpressions: "resource://gre/modules/components-utils/FilterExpressions.jsm", }); @@ -77,7 +84,7 @@ XPCOMUtils.defineLazyPreferenceGetter( * @param {ClientEnvironment} environment Information about version, language, platform etc. * @returns {?Object} the entry or null if excluded. */ -export async function jexlFilterFunc(entry, environment) { +async function jexlFilterFunc(entry, environment) { const { filter_expression } = entry; if (!filter_expression) { return entry; @@ -589,9 +596,9 @@ function remoteSettingsFunction() { return remoteSettings; } -export var RemoteSettings = remoteSettingsFunction(); +var RemoteSettings = remoteSettingsFunction(); -export var remoteSettingsBroadcastHandler = { +var remoteSettingsBroadcastHandler = { async receivedBroadcastMessage(version, broadcastID, context) { const { phase } = context; const isStartup = [ diff --git a/services/settings/test/unit/test_attachments_downloader.js b/services/settings/test/unit/test_attachments_downloader.js index ddcc0882fea7..175890e07aa5 100644 --- a/services/settings/test/unit/test_attachments_downloader.js +++ b/services/settings/test/unit/test_attachments_downloader.js @@ -1,13 +1,13 @@ /* import-globals-from ../../../common/tests/unit/head_helpers.js */ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { UptakeTelemetry } = ChromeUtils.import( "resource://services-common/uptake-telemetry.js" ); -const { Downloader } = ChromeUtils.importESModule( - "resource://services-settings/Attachments.sys.mjs" +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" ); const { TelemetryTestUtils } = ChromeUtils.importESModule( "resource://testing-common/TelemetryTestUtils.sys.mjs" diff --git a/services/settings/test/unit/test_remote_settings.js b/services/settings/test/unit/test_remote_settings.js index ece99cb5c0b4..11e384373460 100644 --- a/services/settings/test/unit/test_remote_settings.js +++ b/services/settings/test/unit/test_remote_settings.js @@ -10,8 +10,8 @@ const { setTimeout } = ChromeUtils.importESModule( "resource://gre/modules/Timer.sys.mjs" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm"); const { UptakeTelemetry, Policy } = ChromeUtils.import( diff --git a/services/settings/test/unit/test_remote_settings_jexl_filters.js b/services/settings/test/unit/test_remote_settings_jexl_filters.js index 56d35bdd2b90..c08bfe0b7955 100644 --- a/services/settings/test/unit/test_remote_settings_jexl_filters.js +++ b/services/settings/test/unit/test_remote_settings_jexl_filters.js @@ -1,5 +1,5 @@ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); let client; diff --git a/services/settings/test/unit/test_remote_settings_offline.js b/services/settings/test/unit/test_remote_settings_offline.js index d3403d4d899d..2dbb76642a4b 100644 --- a/services/settings/test/unit/test_remote_settings_offline.js +++ b/services/settings/test/unit/test_remote_settings_offline.js @@ -1,8 +1,8 @@ -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); -const { RemoteSettingsWorker } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsWorker.sys.mjs" +const { RemoteSettingsWorker } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsWorker.jsm" ); const { SharedUtils } = ChromeUtils.import( "resource://services-settings/SharedUtils.jsm" diff --git a/services/settings/test/unit/test_remote_settings_poll.js b/services/settings/test/unit/test_remote_settings_poll.js index f6b46a9d3b86..b1d374c1c201 100644 --- a/services/settings/test/unit/test_remote_settings_poll.js +++ b/services/settings/test/unit/test_remote_settings_poll.js @@ -10,22 +10,20 @@ const { setTimeout } = ChromeUtils.importESModule( const { UptakeTelemetry, Policy } = ChromeUtils.import( "resource://services-common/uptake-telemetry.js" ); -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); const { pushBroadcastService } = ChromeUtils.import( "resource://gre/modules/PushBroadcastService.jsm" ); -const { SyncHistory } = ChromeUtils.importESModule( - "resource://services-settings/SyncHistory.sys.mjs" +const { SyncHistory } = ChromeUtils.import( + "resource://services-settings/SyncHistory.jsm" ); const { RemoteSettings, remoteSettingsBroadcastHandler, BROADCAST_ID, -} = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" -); +} = ChromeUtils.import("resource://services-settings/remote-settings.js"); const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm"); const { TelemetryTestUtils } = ChromeUtils.importESModule( "resource://testing-common/TelemetryTestUtils.sys.mjs" diff --git a/services/settings/test/unit/test_remote_settings_recover_broken.js b/services/settings/test/unit/test_remote_settings_recover_broken.js index 34abc7c32dae..09ad08a17594 100644 --- a/services/settings/test/unit/test_remote_settings_recover_broken.js +++ b/services/settings/test/unit/test_remote_settings_recover_broken.js @@ -1,13 +1,13 @@ /* import-globals-from ../../../common/tests/unit/head_helpers.js */ -const { SyncHistory } = ChromeUtils.importESModule( - "resource://services-settings/SyncHistory.sys.mjs" +const { SyncHistory } = ChromeUtils.import( + "resource://services-settings/SyncHistory.jsm" ); -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm"); diff --git a/services/settings/test/unit/test_remote_settings_signatures.js b/services/settings/test/unit/test_remote_settings_signatures.js index d19481c6b73c..d16a0a1370dc 100644 --- a/services/settings/test/unit/test_remote_settings_signatures.js +++ b/services/settings/test/unit/test_remote_settings_signatures.js @@ -1,11 +1,11 @@ /* import-globals-from ../../../common/tests/unit/head_helpers.js */ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); const { UptakeTelemetry, Policy } = ChromeUtils.import( "resource://services-common/uptake-telemetry.js" diff --git a/services/settings/test/unit/test_remote_settings_sync_history.js b/services/settings/test/unit/test_remote_settings_sync_history.js index 1fdc3d1adccc..9a14db1fcf55 100644 --- a/services/settings/test/unit/test_remote_settings_sync_history.js +++ b/services/settings/test/unit/test_remote_settings_sync_history.js @@ -1,7 +1,7 @@ "use strict"; -const { SyncHistory } = ChromeUtils.importESModule( - "resource://services-settings/SyncHistory.sys.mjs" +const { SyncHistory } = ChromeUtils.import( + "resource://services-settings/SyncHistory.jsm" ); async function clear_state() { diff --git a/services/settings/test/unit/test_remote_settings_worker.js b/services/settings/test/unit/test_remote_settings_worker.js index 287b5d56645e..fb600e91cebc 100644 --- a/services/settings/test/unit/test_remote_settings_worker.js +++ b/services/settings/test/unit/test_remote_settings_worker.js @@ -7,14 +7,14 @@ const { TestUtils } = ChromeUtils.importESModule( "resource://testing-common/TestUtils.sys.mjs" ); -const { RemoteSettingsWorker } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsWorker.sys.mjs" +const { RemoteSettingsWorker } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsWorker.jsm" ); -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); -const { Database } = ChromeUtils.importESModule( - "resource://services-settings/Database.sys.mjs" +const { Database } = ChromeUtils.import( + "resource://services-settings/Database.jsm" ); XPCOMUtils.defineLazyGlobalGetters(this, ["indexedDB"]); diff --git a/services/settings/test/unit/test_shutdown_handling.js b/services/settings/test/unit/test_shutdown_handling.js index a35ab6080a4e..28a17652675f 100644 --- a/services/settings/test/unit/test_shutdown_handling.js +++ b/services/settings/test/unit/test_shutdown_handling.js @@ -7,14 +7,14 @@ const { TestUtils } = ChromeUtils.importESModule( "resource://testing-common/TestUtils.sys.mjs" ); -const { Database } = ChromeUtils.importESModule( - "resource://services-settings/Database.sys.mjs" +const { Database } = ChromeUtils.import( + "resource://services-settings/Database.jsm" ); -const { RemoteSettingsWorker } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsWorker.sys.mjs" +const { RemoteSettingsWorker } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsWorker.jsm" ); -const { RemoteSettingsClient } = ChromeUtils.importESModule( - "resource://services-settings/RemoteSettingsClient.sys.mjs" +const { RemoteSettingsClient } = ChromeUtils.import( + "resource://services-settings/RemoteSettingsClient.jsm" ); add_task(async function test_shutdown_abort_after_start() { diff --git a/services/sync/modules-testing/utils.sys.mjs b/services/sync/modules-testing/utils.sys.mjs index 812482989cf3..9fd5101b9337 100644 --- a/services/sync/modules-testing/utils.sys.mjs +++ b/services/sync/modules-testing/utils.sys.mjs @@ -17,16 +17,21 @@ import { fakeSHA256HMAC, } from "resource://testing-common/services/sync/fakeservices.sys.mjs"; -import { - FxAccounts, - AccountState, -} from "resource://gre/modules/FxAccounts.sys.mjs"; -import { FxAccountsClient } from "resource://gre/modules/FxAccountsClient.sys.mjs"; - +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" +); const { SCOPE_OLD_SYNC, LEGACY_SCOPE_WEBEXT_SYNC } = ChromeUtils.import( "resource://gre/modules/FxAccountsCommon.js" ); +// and grab non-exported stuff via a backstage pass. +export const { AccountState } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); + // A mock "storage manager" for FxAccounts that doesn't actually write anywhere. export function MockFxaStorageManager() {} diff --git a/services/sync/modules/SyncDisconnect.sys.mjs b/services/sync/modules/SyncDisconnect.sys.mjs index 766f15822440..fb72fef253e8 100644 --- a/services/sync/modules/SyncDisconnect.sys.mjs +++ b/services/sync/modules/SyncDisconnect.sys.mjs @@ -21,8 +21,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/sync/modules/UIState.sys.mjs b/services/sync/modules/UIState.sys.mjs index b8229aae9e23..d3108b7a360a 100644 --- a/services/sync/modules/UIState.sys.mjs +++ b/services/sync/modules/UIState.sys.mjs @@ -231,8 +231,8 @@ const UIStateInternal = { import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; XPCOMUtils.defineLazyGetter(UIStateInternal, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/sync/modules/engines/clients.sys.mjs b/services/sync/modules/engines/clients.sys.mjs index 15f65d16ccf1..c4a59e2b63b0 100644 --- a/services/sync/modules/engines/clients.sys.mjs +++ b/services/sync/modules/engines/clients.sys.mjs @@ -41,8 +41,8 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/sync/modules/policies.sys.mjs b/services/sync/modules/policies.sys.mjs index 6b711bbe6a1c..8eb6b6698402 100644 --- a/services/sync/modules/policies.sys.mjs +++ b/services/sync/modules/policies.sys.mjs @@ -55,8 +55,8 @@ ChromeUtils.defineModuleGetter( "resource://gre/modules/AddonManager.jsm" ); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); XPCOMUtils.defineLazyServiceGetter( diff --git a/services/sync/modules/service.sys.mjs b/services/sync/modules/service.sys.mjs index ddadd80a7376..4b556cf8a4be 100644 --- a/services/sync/modules/service.sys.mjs +++ b/services/sync/modules/service.sys.mjs @@ -62,8 +62,9 @@ import { Status } from "resource://services-sync/status.sys.mjs"; ChromeUtils.importESModule("resource://services-sync/telemetry.sys.mjs"); import { Svc, Utils } from "resource://services-sync/util.sys.mjs"; -import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; - +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); const fxAccounts = getFxAccountsSingleton(); function getEngineModules() { diff --git a/services/sync/modules/sync_auth.sys.mjs b/services/sync/modules/sync_auth.sys.mjs index c0388295d9fd..f59f6ff9c10e 100644 --- a/services/sync/modules/sync_auth.sys.mjs +++ b/services/sync/modules/sync_auth.sys.mjs @@ -32,8 +32,8 @@ ChromeUtils.defineESModuleGetters(lazy, { }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/sync/modules/telemetry.sys.mjs b/services/sync/modules/telemetry.sys.mjs index 2795d5ae2cc8..fbea05475012 100644 --- a/services/sync/modules/telemetry.sys.mjs +++ b/services/sync/modules/telemetry.sys.mjs @@ -20,7 +20,6 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AuthenticationError: "resource://services-sync/sync_auth.sys.mjs", - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", Resource: "resource://services-sync/resource.sys.mjs", Status: "resource://services-sync/status.sys.mjs", Svc: "resource://services-sync/util.sys.mjs", @@ -32,13 +31,14 @@ ChromeUtils.defineESModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, { Async: "resource://services-common/async.js", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", Observers: "resource://services-common/observers.js", }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/services/sync/tests/unit/head_helpers.js b/services/sync/tests/unit/head_helpers.js index 7147fe7fab41..f59ad6710256 100644 --- a/services/sync/tests/unit/head_helpers.js +++ b/services/sync/tests/unit/head_helpers.js @@ -38,6 +38,7 @@ var { ObjectUtils } = ChromeUtils.import( "resource://gre/modules/ObjectUtils.jsm" ); var { + AccountState, MockFxaStorageManager, SyncTestingInfrastructure, configureFxAccountIdentity, diff --git a/services/sync/tests/unit/head_http_server.js b/services/sync/tests/unit/head_http_server.js index e93b4fe08bc3..38a7008dbc93 100644 --- a/services/sync/tests/unit/head_http_server.js +++ b/services/sync/tests/unit/head_http_server.js @@ -11,6 +11,7 @@ var { TestUtils } = ChromeUtils.importESModule( "resource://testing-common/TestUtils.sys.mjs" ); var { + AccountState, MockFxaStorageManager, SyncTestingInfrastructure, configureFxAccountIdentity, diff --git a/services/sync/tests/unit/test_sync_auth_manager.js b/services/sync/tests/unit/test_sync_auth_manager.js index 59aece5204ca..0864ceee1045 100644 --- a/services/sync/tests/unit/test_sync_auth_manager.js +++ b/services/sync/tests/unit/test_sync_auth_manager.js @@ -15,11 +15,11 @@ const { const { HawkClient } = ChromeUtils.import( "resource://services-common/hawkclient.js" ); -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); -const { FxAccountsClient } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsClient.sys.mjs" +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" ); const { ERRNO_INVALID_AUTH_TOKEN, @@ -35,9 +35,6 @@ const { Status } = ChromeUtils.importESModule( const { TokenServerClient, TokenServerClientServerError } = ChromeUtils.import( "resource://services-common/tokenserverclient.js" ); -const { AccountState } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" -); const SECOND_MS = 1000; const MINUTE_MS = SECOND_MS * 60; diff --git a/services/sync/tests/unit/test_syncscheduler.js b/services/sync/tests/unit/test_syncscheduler.js index 47087610fb6c..d2d9129f600a 100644 --- a/services/sync/tests/unit/test_syncscheduler.js +++ b/services/sync/tests/unit/test_syncscheduler.js @@ -1,8 +1,8 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const { FxAccounts } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { FxAccounts } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const { SyncAuthManager } = ChromeUtils.importESModule( "resource://services-sync/sync_auth.sys.mjs" diff --git a/services/sync/tests/unit/test_telemetry.js b/services/sync/tests/unit/test_telemetry.js index f495f4e8c438..1f01aab375e2 100644 --- a/services/sync/tests/unit/test_telemetry.js +++ b/services/sync/tests/unit/test_telemetry.js @@ -13,8 +13,8 @@ const { Resource } = ChromeUtils.importESModule( const { RotaryEngine } = ChromeUtils.importESModule( "resource://testing-common/services/sync/rotaryengine.sys.mjs" ); -const { getFxAccountsSingleton } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ); const fxAccounts = getFxAccountsSingleton(); diff --git a/services/sync/tps/extensions/tps/resource/auth/fxaccounts.sys.mjs b/services/sync/tps/extensions/tps/resource/auth/fxaccounts.sys.mjs index 81c0fd578add..c20d84e059ff 100644 --- a/services/sync/tps/extensions/tps/resource/auth/fxaccounts.sys.mjs +++ b/services/sync/tps/extensions/tps/resource/auth/fxaccounts.sys.mjs @@ -5,11 +5,16 @@ import { Log } from "resource://gre/modules/Log.sys.mjs"; import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs"; -import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; - +const { getFxAccountsSingleton } = ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" +); const fxAccounts = getFxAccountsSingleton(); -import { FxAccountsClient } from "resource://gre/modules/FxAccountsClient.sys.mjs"; -import { FxAccountsConfig } from "resource://gre/modules/FxAccountsConfig.sys.mjs"; +const { FxAccountsClient } = ChromeUtils.import( + "resource://gre/modules/FxAccountsClient.jsm" +); +const { FxAccountsConfig } = ChromeUtils.import( + "resource://gre/modules/FxAccountsConfig.jsm" +); import { Logger } from "resource://tps/logger.sys.mjs"; /** diff --git a/toolkit/components/antitracking/PartitioningExceptionListService.jsm b/toolkit/components/antitracking/PartitioningExceptionListService.jsm index 4e77702d3a2d..b024524ba6d3 100644 --- a/toolkit/components/antitracking/PartitioningExceptionListService.jsm +++ b/toolkit/components/antitracking/PartitioningExceptionListService.jsm @@ -6,9 +6,11 @@ const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); const COLLECTION_NAME = "partitioning-exempt-urls"; const PREF_NAME = "privacy.restrict3rdpartystorage.skip_list"; diff --git a/toolkit/components/antitracking/URLDecorationAnnotationsService.jsm b/toolkit/components/antitracking/URLDecorationAnnotationsService.jsm index 72f6d2b92bf8..e1c038679d3b 100644 --- a/toolkit/components/antitracking/URLDecorationAnnotationsService.jsm +++ b/toolkit/components/antitracking/URLDecorationAnnotationsService.jsm @@ -6,9 +6,11 @@ function URLDecorationAnnotationsService() {} const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); const COLLECTION_NAME = "anti-tracking-url-decoration"; const PREF_NAME = "privacy.restrict3rdpartystorage.url_decorations"; diff --git a/toolkit/components/antitracking/URLQueryStrippingListService.jsm b/toolkit/components/antitracking/URLQueryStrippingListService.jsm index d167811cb234..108900caba31 100644 --- a/toolkit/components/antitracking/URLQueryStrippingListService.jsm +++ b/toolkit/components/antitracking/URLQueryStrippingListService.jsm @@ -4,10 +4,14 @@ "use strict"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); + const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", }); const COLLECTION_NAME = "query-stripping"; diff --git a/toolkit/components/antitracking/test/browser/browser_storageAccessWithDynamicFpi.js b/toolkit/components/antitracking/test/browser/browser_storageAccessWithDynamicFpi.js index 63d5fccf5856..8ab41991989e 100644 --- a/toolkit/components/antitracking/test/browser/browser_storageAccessWithDynamicFpi.js +++ b/toolkit/components/antitracking/test/browser/browser_storageAccessWithDynamicFpi.js @@ -5,8 +5,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); XPCOMUtils.defineLazyServiceGetter( diff --git a/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping.js b/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping.js index 8f668f7810fe..66ef2e12e6c2 100644 --- a/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping.js +++ b/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping.js @@ -5,8 +5,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { Preferences } = ChromeUtils.importESModule( "resource://gre/modules/Preferences.sys.mjs" diff --git a/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping_alwaysPartition.js b/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping_alwaysPartition.js index b035cb3340da..7e8602cad413 100644 --- a/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping_alwaysPartition.js +++ b/toolkit/components/antitracking/test/browser/browser_urlDecorationStripping_alwaysPartition.js @@ -7,8 +7,8 @@ const trackerBlocked = Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { Preferences } = ChromeUtils.importESModule( "resource://gre/modules/Preferences.sys.mjs" diff --git a/toolkit/components/antitracking/test/browser/browser_urlQueryStrippingListService.js b/toolkit/components/antitracking/test/browser/browser_urlQueryStrippingListService.js index 1d46986ff1eb..fb3b8309e4ae 100644 --- a/toolkit/components/antitracking/test/browser/browser_urlQueryStrippingListService.js +++ b/toolkit/components/antitracking/test/browser/browser_urlQueryStrippingListService.js @@ -5,8 +5,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); XPCOMUtils.defineLazyServiceGetter( diff --git a/toolkit/components/antitracking/test/xpcshell/test_ExceptionListService.js b/toolkit/components/antitracking/test/xpcshell/test_ExceptionListService.js index 35c394368af2..613e405ee15b 100644 --- a/toolkit/components/antitracking/test/xpcshell/test_ExceptionListService.js +++ b/toolkit/components/antitracking/test/xpcshell/test_ExceptionListService.js @@ -7,8 +7,8 @@ /* Unit tests for the nsIPartitioningExceptionListService implementation. */ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const COLLECTION_NAME = "partitioning-exempt-urls"; diff --git a/toolkit/components/backgroundtasks/BackgroundTask_message.sys.mjs b/toolkit/components/backgroundtasks/BackgroundTask_message.sys.mjs index 1d9e4cb79b83..dbbfa53d3960 100644 --- a/toolkit/components/backgroundtasks/BackgroundTask_message.sys.mjs +++ b/toolkit/components/backgroundtasks/BackgroundTask_message.sys.mjs @@ -63,15 +63,14 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { IndexedDB: "resource://gre/modules/IndexedDB.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { ClientEnvironmentBase: "resource://gre/modules/components-utils/ClientEnvironment.jsm", ExtensionUtils: "resource://gre/modules/ExtensionUtils.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", ToastNotification: "resource://activity-stream/lib/ToastNotification.jsm", Utils: "resource://services-settings/Utils.jsm", }); diff --git a/toolkit/components/cookiebanners/CookieBannerListService.jsm b/toolkit/components/cookiebanners/CookieBannerListService.jsm index 70e9a33e23b4..4d1f2f8b5996 100644 --- a/toolkit/components/cookiebanners/CookieBannerListService.jsm +++ b/toolkit/components/cookiebanners/CookieBannerListService.jsm @@ -13,7 +13,10 @@ const { XPCOMUtils } = ChromeUtils.importESModule( ChromeUtils.defineESModuleGetters(lazy, { JsonSchema: "resource://gre/modules/JsonSchema.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", +}); + +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyPreferenceGetter( diff --git a/toolkit/components/cookiebanners/test/unit/test_cookiebannerlistservice.js b/toolkit/components/cookiebanners/test/unit/test_cookiebannerlistservice.js index 3b968a56303d..b954fa4128aa 100644 --- a/toolkit/components/cookiebanners/test/unit/test_cookiebannerlistservice.js +++ b/toolkit/components/cookiebanners/test/unit/test_cookiebannerlistservice.js @@ -3,8 +3,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); let { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm"); diff --git a/toolkit/components/extensions/ExtensionStorageSyncKinto.jsm b/toolkit/components/extensions/ExtensionStorageSyncKinto.jsm index 0e07a45f46b1..1a19b264694d 100644 --- a/toolkit/components/extensions/ExtensionStorageSyncKinto.jsm +++ b/toolkit/components/extensions/ExtensionStorageSyncKinto.jsm @@ -65,8 +65,8 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { }); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js index 7b25676048b1..7fcbb02a3c63 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync_kinto.js @@ -26,8 +26,8 @@ const { const { BulkKeyBundle } = ChromeUtils.importESModule( "resource://services-sync/keys.sys.mjs" ); -const { FxAccountsKeys } = ChromeUtils.importESModule( - "resource://gre/modules/FxAccountsKeys.sys.mjs" +const { FxAccountsKeys } = ChromeUtils.import( + "resource://gre/modules/FxAccountsKeys.jsm" ); const { Utils } = ChromeUtils.importESModule( "resource://services-sync/util.sys.mjs" diff --git a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm index 93b1dda27ecd..d2cec2b5c497 100644 --- a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm +++ b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm @@ -14,13 +14,13 @@ const NETWORK_TRR_MODE_PREF = "network.trr.mode"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs", MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", UITour: "resource:///modules/UITour.jsm", + FxAccounts: "resource://gre/modules/FxAccounts.jsm", Spotlight: "resource://activity-stream/lib/Spotlight.jsm", ColorwayClosetOpener: "resource:///modules/ColorwayClosetOpener.jsm", }); diff --git a/toolkit/components/nimbus/ExperimentAPI.jsm b/toolkit/components/nimbus/ExperimentAPI.jsm index 84067e330cc8..e9421b48e335 100644 --- a/toolkit/components/nimbus/ExperimentAPI.jsm +++ b/toolkit/components/nimbus/ExperimentAPI.jsm @@ -19,13 +19,10 @@ const { AppConstants } = ChromeUtils.importESModule( const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { ExperimentStore: "resource://nimbus/lib/ExperimentStore.jsm", ExperimentManager: "resource://nimbus/lib/ExperimentManager.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", FeatureManifest: "resource://nimbus/FeatureManifest.js", }); diff --git a/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm b/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm index 4c005c1586b9..9c27dff85402 100644 --- a/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm +++ b/toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm @@ -17,13 +17,13 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { JsonSchema: "resource://gre/modules/JsonSchema.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.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", + RemoteSettings: "resource://services-settings/remote-settings.js", CleanupManager: "resource://normandy/lib/CleanupManager.jsm", NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", }); diff --git a/toolkit/components/nimbus/test/browser/browser_remotesettings_experiment_enroll.js b/toolkit/components/nimbus/test/browser/browser_remotesettings_experiment_enroll.js index 889f645082c3..10143a74cb8c 100644 --- a/toolkit/components/nimbus/test/browser/browser_remotesettings_experiment_enroll.js +++ b/toolkit/components/nimbus/test/browser/browser_remotesettings_experiment_enroll.js @@ -1,7 +1,7 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { RemoteSettingsExperimentLoader } = ChromeUtils.import( "resource://nimbus/lib/RemoteSettingsExperimentLoader.jsm" diff --git a/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_force_enrollment.js b/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_force_enrollment.js index 26d10b127f09..584b595dacbb 100644 --- a/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_force_enrollment.js +++ b/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_force_enrollment.js @@ -3,8 +3,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { RemoteSettingsExperimentLoader } = ChromeUtils.import( "resource://nimbus/lib/RemoteSettingsExperimentLoader.jsm" diff --git a/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js b/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js index 0a6f5326e64d..e1484d0e110d 100644 --- a/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js +++ b/toolkit/components/nimbus/test/browser/browser_remotesettingsexperimentloader_remote_defaults.js @@ -3,8 +3,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { _ExperimentFeature: ExperimentFeature, diff --git a/toolkit/components/normandy/lib/RecipeRunner.jsm b/toolkit/components/normandy/lib/RecipeRunner.jsm index 881393c67702..fe1713c988e7 100644 --- a/toolkit/components/normandy/lib/RecipeRunner.jsm +++ b/toolkit/components/normandy/lib/RecipeRunner.jsm @@ -24,14 +24,12 @@ XPCOMUtils.defineLazyServiceGetter( ); ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", clearTimeout: "resource://gre/modules/Timer.sys.mjs", setTimeout: "resource://gre/modules/Timer.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", Storage: "resource://normandy/lib/Storage.jsm", FilterExpressions: "resource://gre/modules/components-utils/FilterExpressions.jsm", @@ -43,6 +41,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { Uptake: "resource://normandy/lib/Uptake.jsm", ActionsManager: "resource://normandy/lib/ActionsManager.jsm", BaseAction: "resource://normandy/actions/BaseAction.jsm", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", }); var EXPORTED_SYMBOLS = ["RecipeRunner"]; diff --git a/toolkit/components/normandy/test/browser/browser_RecipeRunner.js b/toolkit/components/normandy/test/browser/browser_RecipeRunner.js index dd1073490c67..fb2ccf32f586 100644 --- a/toolkit/components/normandy/test/browser/browser_RecipeRunner.js +++ b/toolkit/components/normandy/test/browser/browser_RecipeRunner.js @@ -25,8 +25,8 @@ const { ActionsManager } = ChromeUtils.import( ); const { Uptake } = ChromeUtils.import("resource://normandy/lib/Uptake.jsm"); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); add_task(async function getFilterContext() { diff --git a/toolkit/components/passwordmgr/FirefoxRelay.jsm b/toolkit/components/passwordmgr/FirefoxRelay.jsm index e1b64e98684b..c1745350b3e1 100644 --- a/toolkit/components/passwordmgr/FirefoxRelay.jsm +++ b/toolkit/components/passwordmgr/FirefoxRelay.jsm @@ -39,8 +39,8 @@ XPCOMUtils.defineLazyGetter(lazy, "log", () => LoginHelper.createLogger("FirefoxRelay") ); XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => - ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton() ); XPCOMUtils.defineLazyGetter(lazy, "strings", function() { diff --git a/toolkit/components/passwordmgr/LoginRecipes.jsm b/toolkit/components/passwordmgr/LoginRecipes.jsm index 12520d931568..229007ce59e4 100644 --- a/toolkit/components/passwordmgr/LoginRecipes.jsm +++ b/toolkit/components/passwordmgr/LoginRecipes.jsm @@ -36,8 +36,8 @@ XPCOMUtils.defineLazyGetter(lazy, "log", () => lazy.LoginHelper.createLogger("LoginRecipes") ); -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", }); /** diff --git a/toolkit/components/passwordmgr/LoginRelatedRealms.jsm b/toolkit/components/passwordmgr/LoginRelatedRealms.jsm index 8729df9ea325..ddac961c0962 100644 --- a/toolkit/components/passwordmgr/LoginRelatedRealms.jsm +++ b/toolkit/components/passwordmgr/LoginRelatedRealms.jsm @@ -10,12 +10,9 @@ const { XPCOMUtils } = ChromeUtils.importESModule( const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyGetter(lazy, "log", () => { diff --git a/toolkit/components/passwordmgr/PasswordRulesManager.jsm b/toolkit/components/passwordmgr/PasswordRulesManager.jsm index ee115a41e719..fdae2d9a2bc8 100644 --- a/toolkit/components/passwordmgr/PasswordRulesManager.jsm +++ b/toolkit/components/passwordmgr/PasswordRulesManager.jsm @@ -10,14 +10,11 @@ const { XPCOMUtils } = ChromeUtils.importESModule( const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.jsm", PasswordGenerator: "resource://gre/modules/PasswordGenerator.jsm", PasswordRulesParser: "resource://gre/modules/PasswordRulesParser.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyGetter(lazy, "log", () => { diff --git a/toolkit/components/passwordmgr/test/LoginTestUtils.jsm b/toolkit/components/passwordmgr/test/LoginTestUtils.jsm index 1a86669dd9fa..15a3b04bb78d 100644 --- a/toolkit/components/passwordmgr/test/LoginTestUtils.jsm +++ b/toolkit/components/passwordmgr/test/LoginTestUtils.jsm @@ -9,10 +9,14 @@ const EXPORTED_SYMBOLS = ["LoginTestUtils"]; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); + const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", }); let { Assert: AssertCls } = ChromeUtils.importESModule( diff --git a/toolkit/components/passwordmgr/test/unit/test_PasswordRulesManager_generatePassword.js b/toolkit/components/passwordmgr/test/unit/test_PasswordRulesManager_generatePassword.js index d1ef52535b0f..470d466d1d74 100644 --- a/toolkit/components/passwordmgr/test/unit/test_PasswordRulesManager_generatePassword.js +++ b/toolkit/components/passwordmgr/test/unit/test_PasswordRulesManager_generatePassword.js @@ -12,8 +12,8 @@ const { PasswordRulesManagerParent } = ChromeUtils.import( const { PasswordRulesParser } = ChromeUtils.import( "resource://gre/modules/PasswordRulesParser.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { TelemetryTestUtils } = ChromeUtils.importESModule( "resource://testing-common/TelemetryTestUtils.sys.mjs" diff --git a/toolkit/components/passwordmgr/test/unit/test_findRelatedRealms.js b/toolkit/components/passwordmgr/test/unit/test_findRelatedRealms.js index b98abefff6f9..3891b4f77cef 100644 --- a/toolkit/components/passwordmgr/test/unit/test_findRelatedRealms.js +++ b/toolkit/components/passwordmgr/test/unit/test_findRelatedRealms.js @@ -6,8 +6,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ const { LoginRelatedRealmsParent } = ChromeUtils.import( "resource://gre/modules/LoginRelatedRealms.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const REMOTE_SETTINGS_COLLECTION = "websites-with-shared-credential-backends"; diff --git a/toolkit/components/passwordmgr/test/unit/test_remote_recipes.js b/toolkit/components/passwordmgr/test/unit/test_remote_recipes.js index 7d16e205e9ff..85a80aeab172 100644 --- a/toolkit/components/passwordmgr/test/unit/test_remote_recipes.js +++ b/toolkit/components/passwordmgr/test/unit/test_remote_recipes.js @@ -8,8 +8,8 @@ "use strict"; -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const REMOTE_SETTINGS_COLLECTION = "password-recipes"; diff --git a/toolkit/components/search/SearchEngineSelector.sys.mjs b/toolkit/components/search/SearchEngineSelector.sys.mjs index 68b87f8eabaa..b51f549f2c21 100644 --- a/toolkit/components/search/SearchEngineSelector.sys.mjs +++ b/toolkit/components/search/SearchEngineSelector.sys.mjs @@ -7,10 +7,13 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", +}); + const USER_LOCALE = "$USER_LOCALE"; const USER_REGION = "$USER_REGION"; diff --git a/toolkit/components/search/SearchService.sys.mjs b/toolkit/components/search/SearchService.sys.mjs index 51318d73a0fd..4b6e9b259d3e 100644 --- a/toolkit/components/search/SearchService.sys.mjs +++ b/toolkit/components/search/SearchService.sys.mjs @@ -18,7 +18,6 @@ ChromeUtils.defineESModuleGetters(lazy, { OpenSearchEngine: "resource://gre/modules/OpenSearchEngine.sys.mjs", PolicySearchEngine: "resource://gre/modules/PolicySearchEngine.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs", SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs", SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs", @@ -29,6 +28,7 @@ ChromeUtils.defineESModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", }); diff --git a/toolkit/components/search/tests/SearchTestUtils.sys.mjs b/toolkit/components/search/tests/SearchTestUtils.sys.mjs index 73d505ab116b..d0b54f826b9e 100644 --- a/toolkit/components/search/tests/SearchTestUtils.sys.mjs +++ b/toolkit/components/search/tests/SearchTestUtils.sys.mjs @@ -5,7 +5,6 @@ import { MockRegistrar } from "resource://testing-common/MockRegistrar.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", }); @@ -13,6 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.jsm", AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm", ExtensionTestUtils: "resource://testing-common/ExtensionXPCShellUtils.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/toolkit/components/search/tests/xpcshell/head_search.js b/toolkit/components/search/tests/xpcshell/head_search.js index c379da6086e4..89ad95394711 100644 --- a/toolkit/components/search/tests/xpcshell/head_search.js +++ b/toolkit/components/search/tests/xpcshell/head_search.js @@ -9,9 +9,6 @@ ChromeUtils.defineESModuleGetters(this, { FileUtils: "resource://gre/modules/FileUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs", SearchService: "resource://gre/modules/SearchService.sys.mjs", SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs", @@ -23,6 +20,8 @@ ChromeUtils.defineESModuleGetters(this, { }); XPCOMUtils.defineLazyModuleGetters(this, { + RemoteSettings: "resource://services-settings/remote-settings.js", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js index 3c622b4a4e22..2c01ed8191ab 100644 --- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js +++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js @@ -12,7 +12,6 @@ const { AppConstants } = ChromeUtils.importESModule( ChromeUtils.defineESModuleGetters(this, { Region: "resource://gre/modules/Region.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs", SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs", SearchTestUtils: "resource://testing-common/SearchTestUtils.sys.mjs", @@ -23,6 +22,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { AddonManager: "resource://gre/modules/AddonManager.jsm", AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/toolkit/components/search/tests/xpcshell/searchconfigs/test_selector_db_out_of_date.js b/toolkit/components/search/tests/xpcshell/searchconfigs/test_selector_db_out_of_date.js index 742cfaec8aa8..d97aec04026a 100644 --- a/toolkit/components/search/tests/xpcshell/searchconfigs/test_selector_db_out_of_date.js +++ b/toolkit/components/search/tests/xpcshell/searchconfigs/test_selector_db_out_of_date.js @@ -4,11 +4,13 @@ "use strict"; ChromeUtils.defineESModuleGetters(this, { - RemoteSettingsWorker: - "resource://services-settings/RemoteSettingsWorker.sys.mjs", SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs", }); +XPCOMUtils.defineLazyModuleGetters(this, { + RemoteSettingsWorker: "resource://services-settings/RemoteSettingsWorker.jsm", +}); + do_get_profile(); add_task(async function test_selector_db_out_of_date() { diff --git a/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs b/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs index 36540bedcca6..bb63dff5c0b8 100644 --- a/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs +++ b/toolkit/components/telemetry/app/TelemetryEnvironment.sys.mjs @@ -28,8 +28,8 @@ ChromeUtils.defineESModuleGetters(lazy, { import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => { - return ChromeUtils.importESModule( - "resource://gre/modules/FxAccounts.sys.mjs" + return ChromeUtils.import( + "resource://gre/modules/FxAccounts.jsm" ).getFxAccountsSingleton(); }); ChromeUtils.defineModuleGetter( diff --git a/toolkit/components/translations/actors/TranslationsParent.sys.mjs b/toolkit/components/translations/actors/TranslationsParent.sys.mjs index e1687ad5dd67..2a705c35ad29 100644 --- a/toolkit/components/translations/actors/TranslationsParent.sys.mjs +++ b/toolkit/components/translations/actors/TranslationsParent.sys.mjs @@ -23,8 +23,8 @@ const lazy = {}; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyGetter(lazy, "console", () => { diff --git a/toolkit/components/url-classifier/UrlClassifierRemoteSettingsService.jsm b/toolkit/components/url-classifier/UrlClassifierRemoteSettingsService.jsm index 31fac145b291..d20f2c41e02b 100644 --- a/toolkit/components/url-classifier/UrlClassifierRemoteSettingsService.jsm +++ b/toolkit/components/url-classifier/UrlClassifierRemoteSettingsService.jsm @@ -3,9 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); const COLLECTION_NAME = "tracking-protection-lists"; diff --git a/toolkit/components/url-classifier/tests/unit/test_exceptionListService.js b/toolkit/components/url-classifier/tests/unit/test_exceptionListService.js index 5b4266bb3753..1b40ece856ca 100644 --- a/toolkit/components/url-classifier/tests/unit/test_exceptionListService.js +++ b/toolkit/components/url-classifier/tests/unit/test_exceptionListService.js @@ -6,8 +6,8 @@ /* Unit tests for the nsIUrlClassifierExceptionListService implementation. */ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const COLLECTION_NAME = "url-classifier-skip-urls"; diff --git a/toolkit/components/url-classifier/tests/unit/test_rsListService.js b/toolkit/components/url-classifier/tests/unit/test_rsListService.js index 0e8c8348a116..1133241e5e6c 100644 --- a/toolkit/components/url-classifier/tests/unit/test_rsListService.js +++ b/toolkit/components/url-classifier/tests/unit/test_rsListService.js @@ -6,8 +6,8 @@ /* Unit tests for the nsIUrlClassifierRemoteSettingsService implementation. */ -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const { SBRS_UPDATE_MINIMUM_DELAY } = ChromeUtils.import( "resource://gre/modules/UrlClassifierRemoteSettingsService.jsm" diff --git a/toolkit/modules/IgnoreLists.sys.mjs b/toolkit/modules/IgnoreLists.sys.mjs index 208977fe945f..62fd0bd2fe53 100644 --- a/toolkit/modules/IgnoreLists.sys.mjs +++ b/toolkit/modules/IgnoreLists.sys.mjs @@ -2,12 +2,13 @@ * 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/. */ +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; + const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", +XPCOMUtils.defineLazyModuleGetters(lazy, { + RemoteSettings: "resource://services-settings/remote-settings.js", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", }); const SETTINGS_IGNORELIST_KEY = "hijack-blocklists"; diff --git a/toolkit/modules/Region.sys.mjs b/toolkit/modules/Region.sys.mjs index 8e5ac898d2f7..ff5a17940309 100644 --- a/toolkit/modules/Region.sys.mjs +++ b/toolkit/modules/Region.sys.mjs @@ -6,7 +6,9 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; -import { RemoteSettings } from "resource://services-settings/remote-settings.sys.mjs"; +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" +); const lazy = {}; diff --git a/toolkit/modules/tests/xpcshell/test_IgnoreList.js b/toolkit/modules/tests/xpcshell/test_IgnoreList.js index 5f1168ac1416..3083767fae52 100644 --- a/toolkit/modules/tests/xpcshell/test_IgnoreList.js +++ b/toolkit/modules/tests/xpcshell/test_IgnoreList.js @@ -10,12 +10,11 @@ const { XPCOMUtils } = ChromeUtils.importESModule( ChromeUtils.defineESModuleGetters(this, { IgnoreLists: "resource://gre/modules/IgnoreLists.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - RemoteSettingsClient: - "resource://services-settings/RemoteSettingsClient.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(this, { + RemoteSettings: "resource://services-settings/remote-settings.js", + RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", sinon: "resource://testing-common/Sinon.jsm", }); diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 144c73dc8e95..5ffd6b50e94f 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -88,20 +88,20 @@ const { PromiseUtils } = ChromeUtils.importESModule( const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - TelemetryTimestamps: "resource://gre/modules/TelemetryTimestamps.sys.mjs", isGatedPermissionType: "resource://gre/modules/addons/siteperms-addon-utils.sys.mjs", isKnownPublicSuffix: "resource://gre/modules/addons/siteperms-addon-utils.sys.mjs", isPrincipalInSitePermissionsBlocklist: "resource://gre/modules/addons/siteperms-addon-utils.sys.mjs", + TelemetryTimestamps: "resource://gre/modules/TelemetryTimestamps.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm", AbuseReporter: "resource://gre/modules/AbuseReporter.jsm", Extension: "resource://gre/modules/Extension.jsm", + RemoteSettings: "resource://services-settings/remote-settings.js", }); XPCOMUtils.defineLazyPreferenceGetter( diff --git a/toolkit/mozapps/extensions/Blocklist.jsm b/toolkit/mozapps/extensions/Blocklist.jsm index a2556dff7341..6696ad42bd8d 100644 --- a/toolkit/mozapps/extensions/Blocklist.jsm +++ b/toolkit/mozapps/extensions/Blocklist.jsm @@ -27,10 +27,16 @@ ChromeUtils.defineModuleGetter( "AddonManagerPrivate", "resource://gre/modules/AddonManager.jsm" ); -ChromeUtils.defineESModuleGetters(lazy, { - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - jexlFilterFunc: "resource://services-settings/remote-settings.sys.mjs", -}); +ChromeUtils.defineModuleGetter( + lazy, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); +ChromeUtils.defineModuleGetter( + lazy, + "jexlFilterFunc", + "resource://services-settings/remote-settings.js" +); const CascadeFilter = Components.Constructor( "@mozilla.org/cascade-filter;1", diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js index 4e6011ec1229..c8be9779ae98 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js +++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ -80,10 +80,14 @@ ChromeUtils.defineESModuleGetters(this, { MockRegistrar: "resource://testing-common/MockRegistrar.sys.mjs", MockRegistry: "resource://testing-common/MockRegistry.sys.mjs", PromiseTestUtils: "resource://testing-common/PromiseTestUtils.sys.mjs", - RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", - TestUtils: "resource://testing-common/TestUtils.sys.mjs", setTimeout: "resource://gre/modules/Timer.sys.mjs", + TestUtils: "resource://testing-common/TestUtils.sys.mjs", }); +ChromeUtils.defineModuleGetter( + this, + "RemoteSettings", + "resource://services-settings/remote-settings.js" +); XPCOMUtils.defineLazyServiceGetter( this, diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js index bc3dd0899b8e..197d91cf21f4 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js @@ -4,8 +4,8 @@ const { BlocklistPrivate } = ChromeUtils.import( const { Utils: RemoteSettingsUtils } = ChromeUtils.import( "resource://services-settings/Utils.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const IS_ANDROID = AppConstants.platform == "android"; diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_dump.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_dump.js index 956e3f6dc598..ac256e7a907b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_dump.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_dump.js @@ -92,7 +92,7 @@ add_task(async function verify_dump_first_run() { // If this fails: // - "dump_fallback" means that the MLBF attachment is out of sync with the // collection data. - // - undefined could mean that the implementation of Attachments.sys.mjs changed. + // - undefined could mean that the implementation of Attachments.jsm changed. Assert.equal( downloadResult._source, "dump_match", diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_fetch.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_fetch.js index b4f87e4901dd..1c70a3f0f70a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_fetch.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_fetch.js @@ -9,8 +9,8 @@ Services.prefs.setBoolPref("extensions.blocklist.useMLBF", true); -const { Downloader } = ChromeUtils.importESModule( - "resource://services-settings/Attachments.sys.mjs" +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" ); const ExtensionBlocklistMLBF = getExtensionBlocklistMLBF(); diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_telemetry.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_telemetry.js index ee0de78971e7..e2a66c7e07fa 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_telemetry.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_mlbf_telemetry.js @@ -7,8 +7,8 @@ Services.prefs.setBoolPref("extensions.blocklist.useMLBF", true); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); -const { Downloader } = ChromeUtils.importESModule( - "resource://services-settings/Attachments.sys.mjs" +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" ); const { TelemetryController } = ChromeUtils.importESModule( diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js index aa1093171f29..9e5ef19e6377 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_statechange_telemetry.js @@ -11,8 +11,8 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "42.0", "42.0"); // apply to add-ons with a privileged signature. AddonTestUtils.usePrivilegedSignatures = false; -const { Downloader } = ChromeUtils.importESModule( - "resource://services-settings/Attachments.sys.mjs" +const { Downloader } = ChromeUtils.import( + "resource://services-settings/Attachments.jsm" ); const { TelemetryController } = ChromeUtils.importESModule( diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_targetapp_filter.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_targetapp_filter.js index 8e45a34595f8..4a9bc73dafaf 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_targetapp_filter.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_targetapp_filter.js @@ -1,8 +1,8 @@ const { BlocklistPrivate } = ChromeUtils.import( "resource://gre/modules/Blocklist.jsm" ); -const { RemoteSettings } = ChromeUtils.importESModule( - "resource://services-settings/remote-settings.sys.mjs" +const { RemoteSettings } = ChromeUtils.import( + "resource://services-settings/remote-settings.js" ); const APP_ID = "xpcshell@tests.mozilla.org";