diff --git a/browser/actors/AboutProtectionsParent.sys.mjs b/browser/actors/AboutProtectionsParent.sys.mjs index 593c072c37e1..147d1ec247cf 100644 --- a/browser/actors/AboutProtectionsParent.sys.mjs +++ b/browser/actors/AboutProtectionsParent.sys.mjs @@ -9,17 +9,14 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AddonManager: "resource://gre/modules/AddonManager.sys.mjs", BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs", + FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.sys.mjs", + FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.sys.mjs", LoginBreaches: "resource:///modules/LoginBreaches.sys.mjs", LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs", }); -XPCOMUtils.defineLazyModuleGetters(lazy, { - FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.js", - FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.js", -}); - ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => { return ChromeUtils.importESModule( "resource://gre/modules/FxAccounts.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 903dd317ac25..c232f26f2647 100644 --- a/browser/base/content/test/sync/browser_fxa_web_channel.js +++ b/browser/base/content/test/sync/browser_fxa_web_channel.js @@ -2,12 +2,10 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () { - return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -}); - ChromeUtils.defineESModuleGetters(this, { WebChannel: "resource://gre/modules/WebChannel.sys.mjs", + ON_PROFILE_CHANGE_NOTIFICATION: + "resource://gre/modules/FxAccountsCommon.sys.mjs", }); var { FxAccountsWebChannel } = ChromeUtils.importESModule( @@ -31,7 +29,7 @@ var gTests = [ }); let promiseObserver = new Promise((resolve, reject) => { makeObserver( - FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION, + ON_PROFILE_CHANGE_NOTIFICATION, function (subject, topic, data) { Assert.equal(data, "abc123"); client.tearDown(); diff --git a/browser/components/preferences/sync.js b/browser/components/preferences/sync.js index d4f56da71e62..de9ce35c48a9 100644 --- a/browser/components/preferences/sync.js +++ b/browser/components/preferences/sync.js @@ -4,10 +4,6 @@ /* import-globals-from preferences.js */ -XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () { - return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -}); - const FXA_PAGE_LOGGED_OUT = 0; const FXA_PAGE_LOGGED_IN = 1; diff --git a/browser/components/syncedtabs/test/xpcshell/head.js b/browser/components/syncedtabs/test/xpcshell/head.js index c390b71011cc..3b79a09e8f9d 100644 --- a/browser/components/syncedtabs/test/xpcshell/head.js +++ b/browser/components/syncedtabs/test/xpcshell/head.js @@ -5,8 +5,4 @@ var { sinon } = ChromeUtils.importESModule( "resource://testing-common/Sinon.sys.mjs" ); -XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () { - return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -}); - do_get_profile(); // fxa needs a profile directory for storage. diff --git a/services/fxaccounts/FxAccounts.sys.mjs b/services/fxaccounts/FxAccounts.sys.mjs index 5e93d0ded6ea..07b2b331737f 100644 --- a/services/fxaccounts/FxAccounts.sys.mjs +++ b/services/fxaccounts/FxAccounts.sys.mjs @@ -10,7 +10,7 @@ import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs"; import { FxAccountsStorageManager } from "resource://gre/modules/FxAccountsStorage.sys.mjs"; -const { +import { ERRNO_INVALID_AUTH_TOKEN, ERROR_AUTH_ERROR, ERROR_INVALID_PARAMETER, @@ -35,7 +35,7 @@ const { log, logPII, logManager, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; const lazy = {}; diff --git a/services/fxaccounts/FxAccountsClient.sys.mjs b/services/fxaccounts/FxAccountsClient.sys.mjs index 1b50c59f4bdf..58bf9c0caf5c 100644 --- a/services/fxaccounts/FxAccountsClient.sys.mjs +++ b/services/fxaccounts/FxAccountsClient.sys.mjs @@ -8,7 +8,7 @@ import { HawkClient } from "resource://services-common/hawkclient.sys.mjs"; import { deriveHawkCredentials } from "resource://services-common/hawkrequest.sys.mjs"; import { CryptoUtils } from "resource://services-crypto/utils.sys.mjs"; -const { +import { ERRNO_ACCOUNT_DOES_NOT_EXIST, ERRNO_INCORRECT_EMAIL_CASE, ERRNO_INCORRECT_PASSWORD, @@ -16,7 +16,8 @@ const { ERRNO_INVALID_AUTH_TIMESTAMP, ERRNO_INVALID_AUTH_TOKEN, log, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; + import { Credentials } from "resource://gre/modules/Credentials.sys.mjs"; const HOST_PREF = "identity.fxaccounts.auth.uri"; diff --git a/services/fxaccounts/FxAccountsCommands.sys.mjs b/services/fxaccounts/FxAccountsCommands.sys.mjs index 70e93a9fa959..a193b49e7f1e 100644 --- a/services/fxaccounts/FxAccountsCommands.sys.mjs +++ b/services/fxaccounts/FxAccountsCommands.sys.mjs @@ -2,8 +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/. */ -const { COMMAND_SENDTAB, COMMAND_SENDTAB_TAIL, SCOPE_OLD_SYNC, log } = - ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +import { + COMMAND_SENDTAB, + COMMAND_SENDTAB_TAIL, + SCOPE_OLD_SYNC, + log, +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; + const lazy = {}; ChromeUtils.defineModuleGetter( lazy, diff --git a/services/fxaccounts/FxAccountsConfig.sys.mjs b/services/fxaccounts/FxAccountsConfig.sys.mjs index e2a9bd474ce6..2aa66073c691 100644 --- a/services/fxaccounts/FxAccountsConfig.sys.mjs +++ b/services/fxaccounts/FxAccountsConfig.sys.mjs @@ -4,9 +4,7 @@ import { RESTRequest } from "resource://services-common/rest.sys.mjs"; -const { log } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { log } from "resource://gre/modules/FxAccountsCommon.sys.mjs"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; diff --git a/services/fxaccounts/FxAccountsDevice.sys.mjs b/services/fxaccounts/FxAccountsDevice.sys.mjs index cf0d62f2e672..6b2089739c61 100644 --- a/services/fxaccounts/FxAccountsDevice.sys.mjs +++ b/services/fxaccounts/FxAccountsDevice.sys.mjs @@ -4,7 +4,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -const { +import { log, ERRNO_DEVICE_SESSION_CONFLICT, ERRNO_UNKNOWN_DEVICE, @@ -14,7 +14,7 @@ const { ON_DEVICE_DISCONNECTED_NOTIFICATION, ONVERIFIED_NOTIFICATION, PREF_ACCOUNT_ROOT, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; import { DEVICE_TYPE_DESKTOP } from "resource://services-sync/constants.sys.mjs"; diff --git a/services/fxaccounts/FxAccountsKeys.sys.mjs b/services/fxaccounts/FxAccountsKeys.sys.mjs index c2244dde9159..ccaa1b49f7e4 100644 --- a/services/fxaccounts/FxAccountsKeys.sys.mjs +++ b/services/fxaccounts/FxAccountsKeys.sys.mjs @@ -8,13 +8,13 @@ import { CommonUtils } from "resource://services-common/utils.sys.mjs"; import { CryptoUtils } from "resource://services-crypto/utils.sys.mjs"; -const { +import { SCOPE_OLD_SYNC, DEPRECATED_SCOPE_ECOSYSTEM_TELEMETRY, FX_OAUTH_CLIENT_ID, log, logPII, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; // The following top-level fields have since been deprecated and exist here purely // to be removed from the account state when seen. After a reasonable period of time diff --git a/services/fxaccounts/FxAccountsPairing.sys.mjs b/services/fxaccounts/FxAccountsPairing.sys.mjs index 7a0aec221751..e68554f7abd0 100644 --- a/services/fxaccounts/FxAccountsPairing.sys.mjs +++ b/services/fxaccounts/FxAccountsPairing.sys.mjs @@ -2,7 +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/. -const { +import { log, PREF_REMOTE_PAIRING_URI, COMMAND_PAIR_SUPP_METADATA, @@ -10,7 +10,8 @@ const { COMMAND_PAIR_DECLINE, COMMAND_PAIR_HEARTBEAT, COMMAND_PAIR_COMPLETE, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; + import { getFxAccountsSingleton, FxAccounts, diff --git a/services/fxaccounts/FxAccountsProfile.sys.mjs b/services/fxaccounts/FxAccountsProfile.sys.mjs index 7127376ad36d..de8bdb2f0ecf 100644 --- a/services/fxaccounts/FxAccountsProfile.sys.mjs +++ b/services/fxaccounts/FxAccountsProfile.sys.mjs @@ -10,9 +10,11 @@ * the user's profile in open browser tabs, and cacheing/invalidating profile data. */ -const { ON_PROFILE_CHANGE_NOTIFICATION, log } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { + ON_PROFILE_CHANGE_NOTIFICATION, + log, +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; + import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; const fxAccounts = getFxAccountsSingleton(); diff --git a/services/fxaccounts/FxAccountsProfileClient.sys.mjs b/services/fxaccounts/FxAccountsProfileClient.sys.mjs index c460ab08faa5..7ae1bd95db13 100644 --- a/services/fxaccounts/FxAccountsProfileClient.sys.mjs +++ b/services/fxaccounts/FxAccountsProfileClient.sys.mjs @@ -7,7 +7,7 @@ */ "use strict;"; -const { +import { ERRNO_NETWORK, ERRNO_PARSE, ERRNO_UNKNOWN_ERROR, @@ -19,7 +19,8 @@ const { log, SCOPE_PROFILE, SCOPE_PROFILE_WRITE, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; + import { getFxAccountsSingleton } from "resource://gre/modules/FxAccounts.sys.mjs"; const fxAccounts = getFxAccountsSingleton(); diff --git a/services/fxaccounts/FxAccountsPush.sys.mjs b/services/fxaccounts/FxAccountsPush.sys.mjs index 80806db84a16..e3e5f32de506 100644 --- a/services/fxaccounts/FxAccountsPush.sys.mjs +++ b/services/fxaccounts/FxAccountsPush.sys.mjs @@ -4,7 +4,7 @@ import { Async } from "resource://services-common/async.sys.mjs"; -const { +import { FXA_PUSH_SCOPE_ACCOUNT_UPDATE, ONLOGOUT_NOTIFICATION, ON_ACCOUNT_DESTROYED_NOTIFICATION, @@ -18,7 +18,7 @@ const { ON_PROFILE_UPDATED_NOTIFICATION, ON_VERIFY_LOGIN_NOTIFICATION, log, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; /** * FxAccountsPushService manages Push notifications for Firefox Accounts in the browser diff --git a/services/fxaccounts/FxAccountsStorage.sys.mjs b/services/fxaccounts/FxAccountsStorage.sys.mjs index 254a6074109a..b3b66c56ac2d 100644 --- a/services/fxaccounts/FxAccountsStorage.sys.mjs +++ b/services/fxaccounts/FxAccountsStorage.sys.mjs @@ -2,7 +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/. */ -const { +import { DATA_FORMAT_VERSION, DEFAULT_STORAGE_FILENAME, FXA_PWDMGR_HOST, @@ -10,7 +10,7 @@ const { FXA_PWDMGR_REALM, FXA_PWDMGR_SECURE_FIELDS, log, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; // 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. diff --git a/services/fxaccounts/FxAccountsTelemetry.sys.mjs b/services/fxaccounts/FxAccountsTelemetry.sys.mjs index 196d9447ae92..1d7b3d495443 100644 --- a/services/fxaccounts/FxAccountsTelemetry.sys.mjs +++ b/services/fxaccounts/FxAccountsTelemetry.sys.mjs @@ -19,9 +19,10 @@ ChromeUtils.defineESModuleGetters(lazy, { Observers: "resource://services-common/observers.sys.mjs", }); -const { PREF_ACCOUNT_ROOT, log } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { + PREF_ACCOUNT_ROOT, + log, +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; const PREF_SANITIZED_UID = PREF_ACCOUNT_ROOT + "telemetry.sanitized_uid"; XPCOMUtils.defineLazyPreferenceGetter( diff --git a/services/fxaccounts/FxAccountsWebChannel.sys.mjs b/services/fxaccounts/FxAccountsWebChannel.sys.mjs index 0801027ebd58..8d12c5136b27 100644 --- a/services/fxaccounts/FxAccountsWebChannel.sys.mjs +++ b/services/fxaccounts/FxAccountsWebChannel.sys.mjs @@ -11,7 +11,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -const { +import { COMMAND_PROFILE_CHANGE, COMMAND_LOGIN, COMMAND_LOGOUT, @@ -33,7 +33,7 @@ const { WEBCHANNEL_ID, log, logPII, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} from "resource://gre/modules/FxAccountsCommon.sys.mjs"; const lazy = {}; diff --git a/services/fxaccounts/tests/xpcshell/head.js b/services/fxaccounts/tests/xpcshell/head.js index e31cdf4e6c94..921888e2e32d 100644 --- a/services/fxaccounts/tests/xpcshell/head.js +++ b/services/fxaccounts/tests/xpcshell/head.js @@ -12,8 +12,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule( const { sinon } = ChromeUtils.importESModule( "resource://testing-common/Sinon.sys.mjs" ); -const { SCOPE_OLD_SYNC } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { SCOPE_OLD_SYNC } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); // Some mock key data, in both scoped-key and legacy field formats. diff --git a/services/fxaccounts/tests/xpcshell/test_accounts.js b/services/fxaccounts/tests/xpcshell/test_accounts.js index 644d43954877..c0970405d331 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts.js @@ -21,7 +21,9 @@ const { ONVERIFIED_NOTIFICATION, DEPRECATED_SCOPE_ECOSYSTEM_TELEMETRY, PREF_LAST_FXA_USER, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" +); const { PromiseUtils } = ChromeUtils.importESModule( "resource://gre/modules/PromiseUtils.sys.mjs" ); diff --git a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js index ee2204f79397..ef45cbeea419 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js @@ -19,7 +19,9 @@ const { ON_DEVICE_CONNECTED_NOTIFICATION, ON_DEVICE_DISCONNECTED_NOTIFICATION, ON_DEVICELIST_UPDATED, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" +); var { AccountState } = ChromeUtils.importESModule( "resource://gre/modules/FxAccounts.sys.mjs" ); diff --git a/services/fxaccounts/tests/xpcshell/test_commands.js b/services/fxaccounts/tests/xpcshell/test_commands.js index c1e67ff1052a..3fa42da43942 100644 --- a/services/fxaccounts/tests/xpcshell/test_commands.js +++ b/services/fxaccounts/tests/xpcshell/test_commands.js @@ -11,8 +11,8 @@ const { FxAccountsClient } = ChromeUtils.importESModule( "resource://gre/modules/FxAccountsClient.sys.mjs" ); -const { COMMAND_SENDTAB, COMMAND_SENDTAB_TAIL } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { COMMAND_SENDTAB, COMMAND_SENDTAB_TAIL } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); class TelemetryMock { diff --git a/services/fxaccounts/tests/xpcshell/test_device.js b/services/fxaccounts/tests/xpcshell/test_device.js index a7793fd85690..037db2b10164 100644 --- a/services/fxaccounts/tests/xpcshell/test_device.js +++ b/services/fxaccounts/tests/xpcshell/test_device.js @@ -8,8 +8,8 @@ const { getFxAccountsSingleton } = ChromeUtils.importESModule( ); const fxAccounts = getFxAccountsSingleton(); -const { ON_NEW_DEVICE_ID, PREF_ACCOUNT_ROOT } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { ON_NEW_DEVICE_ID, PREF_ACCOUNT_ROOT } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); function promiseObserved(topic) { diff --git a/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js b/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js index e01e2bc2182d..50a236918e95 100644 --- a/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js +++ b/services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js @@ -11,8 +11,8 @@ Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace"); const { FxAccounts } = ChromeUtils.importESModule( "resource://gre/modules/FxAccounts.sys.mjs" ); -const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); // Use a backstage pass to get at our LoginManagerStorage object, so we can diff --git a/services/fxaccounts/tests/xpcshell/test_profile.js b/services/fxaccounts/tests/xpcshell/test_profile.js index 7dca5c7512a4..8efe5411fc4c 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile.js +++ b/services/fxaccounts/tests/xpcshell/test_profile.js @@ -3,8 +3,8 @@ "use strict"; -const { ON_PROFILE_CHANGE_NOTIFICATION, log } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { ON_PROFILE_CHANGE_NOTIFICATION, log } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); const { FxAccountsProfileClient } = ChromeUtils.importESModule( "resource://gre/modules/FxAccountsProfileClient.sys.mjs" diff --git a/services/fxaccounts/tests/xpcshell/test_profile_client.js b/services/fxaccounts/tests/xpcshell/test_profile_client.js index e8bc47b63c8e..22fcc293f86a 100644 --- a/services/fxaccounts/tests/xpcshell/test_profile_client.js +++ b/services/fxaccounts/tests/xpcshell/test_profile_client.js @@ -12,7 +12,9 @@ const { ERROR_NETWORK, ERROR_PARSE, ERROR_UNKNOWN, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" +); const { FxAccountsProfileClient, FxAccountsProfileClientError } = ChromeUtils.importESModule( "resource://gre/modules/FxAccountsProfileClient.sys.mjs" diff --git a/services/fxaccounts/tests/xpcshell/test_push_service.js b/services/fxaccounts/tests/xpcshell/test_push_service.js index cc01d256fe30..044188884784 100644 --- a/services/fxaccounts/tests/xpcshell/test_push_service.js +++ b/services/fxaccounts/tests/xpcshell/test_push_service.js @@ -19,7 +19,9 @@ const { ON_PROFILE_UPDATED_NOTIFICATION, ON_VERIFY_LOGIN_NOTIFICATION, log, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" +); const { FxAccountsPushService } = ChromeUtils.importESModule( "resource://gre/modules/FxAccountsPush.sys.mjs" diff --git a/services/fxaccounts/tests/xpcshell/test_storage_manager.js b/services/fxaccounts/tests/xpcshell/test_storage_manager.js index 4d43f3ce2ee1..05c565d2f44b 100644 --- a/services/fxaccounts/tests/xpcshell/test_storage_manager.js +++ b/services/fxaccounts/tests/xpcshell/test_storage_manager.js @@ -8,8 +8,8 @@ const { FxAccountsStorageManager } = ChromeUtils.importESModule( "resource://gre/modules/FxAccountsStorage.sys.mjs" ); -const { DATA_FORMAT_VERSION, log } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { DATA_FORMAT_VERSION, log } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); initTestLogging("Trace"); diff --git a/services/fxaccounts/tests/xpcshell/test_web_channel.js b/services/fxaccounts/tests/xpcshell/test_web_channel.js index 1e68b1c86b00..58ded0cf7159 100644 --- a/services/fxaccounts/tests/xpcshell/test_web_channel.js +++ b/services/fxaccounts/tests/xpcshell/test_web_channel.js @@ -4,7 +4,7 @@ "use strict"; const { ON_PROFILE_CHANGE_NOTIFICATION, WEBCHANNEL_ID, log } = - ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); + ChromeUtils.importESModule("resource://gre/modules/FxAccountsCommon.sys.mjs"); const { CryptoUtils } = ChromeUtils.importESModule( "resource://services-crypto/utils.sys.mjs" ); diff --git a/services/sync/modules-testing/utils.sys.mjs b/services/sync/modules-testing/utils.sys.mjs index 891e885a5cf8..a06acda90aa0 100644 --- a/services/sync/modules-testing/utils.sys.mjs +++ b/services/sync/modules-testing/utils.sys.mjs @@ -20,9 +20,7 @@ import { } from "resource://gre/modules/FxAccounts.sys.mjs"; import { FxAccountsClient } from "resource://gre/modules/FxAccountsClient.sys.mjs"; -const { SCOPE_OLD_SYNC } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { SCOPE_OLD_SYNC } from "resource://gre/modules/FxAccountsCommon.sys.mjs"; // 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 98fb048ec7f7..50f362a55f8f 100644 --- a/services/sync/modules/SyncDisconnect.sys.mjs +++ b/services/sync/modules/SyncDisconnect.sys.mjs @@ -9,6 +9,7 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs", + FxAccountsCommon: "resource://gre/modules/FxAccountsCommon.sys.mjs", Log: "resource://gre/modules/Log.sys.mjs", Sanitizer: "resource:///modules/Sanitizer.sys.mjs", Utils: "resource://services-sync/util.sys.mjs", @@ -21,10 +22,6 @@ ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => { ).getFxAccountsSingleton(); }); -ChromeUtils.defineLazyGetter(lazy, "FxAccountsCommon", function () { - return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); -}); - export const SyncDisconnectInternal = { lockRetryInterval: 1000, // wait 1 seconds before trying for the lock again. lockRetryCount: 120, // Try 120 times (==2 mins) before giving up in disgust. diff --git a/services/sync/modules/engines/clients.sys.mjs b/services/sync/modules/engines/clients.sys.mjs index 63596e700aac..eda92bd75baa 100644 --- a/services/sync/modules/engines/clients.sys.mjs +++ b/services/sync/modules/engines/clients.sys.mjs @@ -46,9 +46,7 @@ ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => { ).getFxAccountsSingleton(); }); -const { PREF_ACCOUNT_ROOT } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { PREF_ACCOUNT_ROOT } from "resource://gre/modules/FxAccountsCommon.sys.mjs"; const CLIENTS_TTL = 15552000; // 180 days const CLIENTS_TTL_REFRESH = 604800; // 7 days diff --git a/services/sync/modules/policies.sys.mjs b/services/sync/modules/policies.sys.mjs index f89ce1cd4aa8..290e793b8e23 100644 --- a/services/sync/modules/policies.sys.mjs +++ b/services/sync/modules/policies.sys.mjs @@ -37,9 +37,7 @@ import { import { Svc, Utils } from "resource://services-sync/util.sys.mjs"; -const { logManager } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import { logManager } from "resource://gre/modules/FxAccountsCommon.sys.mjs"; import { Async } from "resource://services-common/async.sys.mjs"; import { CommonUtils } from "resource://services-common/utils.sys.mjs"; diff --git a/services/sync/modules/sync_auth.sys.mjs b/services/sync/modules/sync_auth.sys.mjs index 03494e334076..f264459df26c 100644 --- a/services/sync/modules/sync_auth.sys.mjs +++ b/services/sync/modules/sync_auth.sys.mjs @@ -46,9 +46,7 @@ XPCOMUtils.defineLazyPreferenceGetter( ); // FxAccountsCommon.js doesn't use a "namespace", so create one here. -var fxAccountsCommon = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import * as fxAccountsCommon from "resource://gre/modules/FxAccountsCommon.sys.mjs"; const SCOPE_OLD_SYNC = fxAccountsCommon.SCOPE_OLD_SYNC; diff --git a/services/sync/modules/util.sys.mjs b/services/sync/modules/util.sys.mjs index 0d86fef0f918..e68ae0e19f3c 100644 --- a/services/sync/modules/util.sys.mjs +++ b/services/sync/modules/util.sys.mjs @@ -19,9 +19,7 @@ import { import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; -const FxAccountsCommon = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" -); +import * as FxAccountsCommon from "resource://gre/modules/FxAccountsCommon.sys.mjs"; XPCOMUtils.defineLazyServiceGetter( lazy, diff --git a/services/sync/tests/unit/test_errorhandler_filelog.js b/services/sync/tests/unit/test_errorhandler_filelog.js index b2d0516893c9..3fa004ff2b12 100644 --- a/services/sync/tests/unit/test_errorhandler_filelog.js +++ b/services/sync/tests/unit/test_errorhandler_filelog.js @@ -6,8 +6,8 @@ const { Service } = ChromeUtils.importESModule( "resource://services-sync/service.sys.mjs" ); -const { logManager } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { logManager } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); const { FileUtils } = ChromeUtils.importESModule( "resource://gre/modules/FileUtils.sys.mjs" diff --git a/services/sync/tests/unit/test_password_engine.js b/services/sync/tests/unit/test_password_engine.js index 34104583451f..e3c2576bc023 100644 --- a/services/sync/tests/unit/test_password_engine.js +++ b/services/sync/tests/unit/test_password_engine.js @@ -1,5 +1,5 @@ -const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.import( - "resource://gre/modules/FxAccountsCommon.js" +const { FXA_PWDMGR_HOST, FXA_PWDMGR_REALM } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" ); const { LoginRec } = ChromeUtils.importESModule( "resource://services-sync/engines/passwords.sys.mjs" diff --git a/services/sync/tests/unit/test_sync_auth_manager.js b/services/sync/tests/unit/test_sync_auth_manager.js index 9229a138309d..9af40d26c612 100644 --- a/services/sync/tests/unit/test_sync_auth_manager.js +++ b/services/sync/tests/unit/test_sync_auth_manager.js @@ -24,7 +24,9 @@ const { ERRNO_INVALID_AUTH_TOKEN, ONLOGIN_NOTIFICATION, ONVERIFIED_NOTIFICATION, -} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +} = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsCommon.sys.mjs" +); const { Service } = ChromeUtils.importESModule( "resource://services-sync/service.sys.mjs" ); diff --git a/toolkit/components/passwordmgr/LoginStore.sys.mjs b/toolkit/components/passwordmgr/LoginStore.sys.mjs index acb5a6365cbc..ad7a7e3d3009 100644 --- a/toolkit/components/passwordmgr/LoginStore.sys.mjs +++ b/toolkit/components/passwordmgr/LoginStore.sys.mjs @@ -41,13 +41,12 @@ // Globals import { JSONFile } from "resource://gre/modules/JSONFile.sys.mjs"; -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.js", - FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.js", +ChromeUtils.defineESModuleGetters(lazy, { + FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.sys.mjs", + FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.sys.mjs", }); /** diff --git a/toolkit/components/passwordmgr/storage-json.sys.mjs b/toolkit/components/passwordmgr/storage-json.sys.mjs index ff19cd4f2a8c..6c249b1423be 100644 --- a/toolkit/components/passwordmgr/storage-json.sys.mjs +++ b/toolkit/components/passwordmgr/storage-json.sys.mjs @@ -6,11 +6,11 @@ * LoginManagerStorage implementation for the JSON back-end. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.sys.mjs", + FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.sys.mjs", LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", LoginStore: "resource://gre/modules/LoginStore.sys.mjs", }); @@ -46,11 +46,6 @@ function isFXAHost(login) { return login.hostname == lazy.FXA_PWDMGR_HOST; } -XPCOMUtils.defineLazyModuleGetters(lazy, { - FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.js", - FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.js", -}); - export class LoginManagerStorage_json { constructor() { this.__crypto = null; // nsILoginManagerCrypto service diff --git a/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js b/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js index 608329f4827d..a122f52845df 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js +++ b/toolkit/components/passwordmgr/test/browser/browser_deleteLoginsBackup.js @@ -2,9 +2,9 @@ * Test that logins backup is deleted as expected when logins are deleted. */ -XPCOMUtils.defineLazyModuleGetters(this, { - FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.js", - FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.js", +ChromeUtils.defineESModuleGetters(this, { + FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.sys.mjs", + FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.sys.mjs", }); const nsLoginInfo = new Components.Constructor(