From 01a2d278710f12ee75b54a8a967024aac13c8e95 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Thu, 27 Oct 2022 23:45:56 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1788919) for causing failures in browser_noLoginsView.js CLOSED TREE Backed out changeset 2f03490ec72e (bug 1788919) Backed out changeset 449aea6fc974 (bug 1788919) --- browser/base/content/browser.js | 2 +- ...nUtils.sys.mjs => 360seMigrationUtils.jsm} | 13 +++- ...pto.sys.mjs => ChromeMacOSLoginCrypto.jsm} | 10 ++- ...Utils.sys.mjs => ChromeMigrationUtils.jsm} | 19 ++--- ...ator.sys.mjs => ChromeProfileMigrator.jsm} | 74 +++++++++++++------ ...o.sys.mjs => ChromeWindowsLoginCrypto.jsm} | 13 +++- .../{ESEDBReader.sys.mjs => ESEDBReader.jsm} | 34 ++++++--- ...grator.sys.mjs => EdgeProfileMigrator.jsm} | 32 +++++--- ...tor.sys.mjs => FirefoxProfileMigrator.jsm} | 13 ++-- ...Migrator.sys.mjs => IEProfileMigrator.jsm} | 22 ++++-- ...tionUtils.sys.mjs => MSMigrationUtils.jsm} | 13 +++- ...rationUtils.sys.mjs => MigrationUtils.jsm} | 12 ++- ...leMigrator.sys.mjs => ProfileMigrator.jsm} | 10 ++- ...ator.sys.mjs => SafariProfileMigrator.jsm} | 16 ++-- browser/components/migration/components.conf | 28 +++---- .../components/migration/content/migration.js | 4 +- browser/components/migration/moz.build | 26 +++---- .../migration/tests/unit/head_migration.js | 4 +- .../tests/unit/test_360seMigrationUtils.js | 4 +- .../tests/unit/test_ChromeMigrationUtils.js | 4 +- .../unit/test_ChromeMigrationUtils_path.js | 4 +- .../tests/unit/test_Chrome_history.js | 4 +- .../tests/unit/test_Chrome_passwords.js | 8 +- .../tests/unit/test_Edge_db_migration.js | 2 +- .../components/places/PlacesUIUtils.sys.mjs | 2 +- browser/components/places/content/places.js | 7 +- .../scripts/getHSTSPreloadList.js | 2 +- .../lib/SpecialMessageActions.jsm | 5 +- .../passwordmgr/LoginManagerParent.jsm | 4 +- tools/lint/rejected-words.yml | 4 +- 30 files changed, 249 insertions(+), 146 deletions(-) rename browser/components/migration/{360seMigrationUtils.sys.mjs => 360seMigrationUtils.jsm} (94%) rename browser/components/migration/{ChromeMacOSLoginCrypto.sys.mjs => ChromeMacOSLoginCrypto.jsm} (96%) rename browser/components/migration/{ChromeMigrationUtils.sys.mjs => ChromeMigrationUtils.jsm} (97%) rename browser/components/migration/{ChromeProfileMigrator.sys.mjs => ChromeProfileMigrator.jsm} (93%) rename browser/components/migration/{ChromeWindowsLoginCrypto.sys.mjs => ChromeWindowsLoginCrypto.jsm} (94%) rename browser/components/migration/{ESEDBReader.sys.mjs => ESEDBReader.jsm} (97%) rename browser/components/migration/{EdgeProfileMigrator.sys.mjs => EdgeProfileMigrator.jsm} (96%) rename browser/components/migration/{FirefoxProfileMigrator.sys.mjs => FirefoxProfileMigrator.jsm} (98%) rename browser/components/migration/{IEProfileMigrator.sys.mjs => IEProfileMigrator.jsm} (97%) rename browser/components/migration/{MSMigrationUtils.sys.mjs => MSMigrationUtils.jsm} (99%) rename browser/components/migration/{MigrationUtils.sys.mjs => MigrationUtils.jsm} (99%) rename browser/components/migration/{ProfileMigrator.sys.mjs => ProfileMigrator.jsm} (74%) rename browser/components/migration/{SafariProfileMigrator.sys.mjs => SafariProfileMigrator.jsm} (98%) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index b68e0411ed10..7053c7871663 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -27,7 +27,6 @@ ChromeUtils.defineESModuleGetters(this, { LightweightThemeConsumer: "resource://gre/modules/LightweightThemeConsumer.sys.mjs", Log: "resource://gre/modules/Log.sys.mjs", - MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs", PictureInPicture: "resource://gre/modules/PictureInPicture.sys.mjs", PlacesTransactions: "resource://gre/modules/PlacesTransactions.sys.mjs", @@ -71,6 +70,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { HomePage: "resource:///modules/HomePage.jsm", LoginHelper: "resource://gre/modules/LoginHelper.jsm", LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm", + MigrationUtils: "resource:///modules/MigrationUtils.jsm", NetUtil: "resource://gre/modules/NetUtil.jsm", OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm", PageActions: "resource:///modules/PageActions.jsm", diff --git a/browser/components/migration/360seMigrationUtils.sys.mjs b/browser/components/migration/360seMigrationUtils.jsm similarity index 94% rename from browser/components/migration/360seMigrationUtils.sys.mjs rename to browser/components/migration/360seMigrationUtils.jsm index 969210b792b8..7cd894ee5c0b 100644 --- a/browser/components/migration/360seMigrationUtils.sys.mjs +++ b/browser/components/migration/360seMigrationUtils.jsm @@ -2,9 +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/. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +"use strict"; -import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs"; +var EXPORTED_SYMBOLS = ["Qihoo360seMigrationUtils"]; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { MigrationUtils } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); const lazy = {}; @@ -115,7 +122,7 @@ Bookmarks.prototype = { }, }; -export var Qihoo360seMigrationUtils = { +var Qihoo360seMigrationUtils = { async getAlternativeBookmarks({ bookmarksPath, localState }) { let lastModificationDate = new Date(0); let path = bookmarksPath; diff --git a/browser/components/migration/ChromeMacOSLoginCrypto.sys.mjs b/browser/components/migration/ChromeMacOSLoginCrypto.jsm similarity index 96% rename from browser/components/migration/ChromeMacOSLoginCrypto.sys.mjs rename to browser/components/migration/ChromeMacOSLoginCrypto.jsm index f5d916f9f7d8..cfdd178f1dc2 100644 --- a/browser/components/migration/ChromeMacOSLoginCrypto.sys.mjs +++ b/browser/components/migration/ChromeMacOSLoginCrypto.jsm @@ -2,12 +2,18 @@ * 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"; + /** * Class to handle encryption and decryption of logins stored in Chrome/Chromium * on macOS. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +var EXPORTED_SYMBOLS = ["ChromeMacOSLoginCrypto"]; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; @@ -65,7 +71,7 @@ const IV = new Uint8Array(kCCBlockSizeAES128).fill(32); * relies on OS encryption key storage in Keychain. The algorithms here are * specific to what is needed for Chrome login storage on macOS. */ -export class ChromeMacOSLoginCrypto { +class ChromeMacOSLoginCrypto { /** * @param {string} serviceName of the Keychain Item to use to derive a key. * @param {string} accountName of the Keychain Item to use to derive a key. diff --git a/browser/components/migration/ChromeMigrationUtils.sys.mjs b/browser/components/migration/ChromeMigrationUtils.jsm similarity index 97% rename from browser/components/migration/ChromeMigrationUtils.sys.mjs rename to browser/components/migration/ChromeMigrationUtils.jsm index 02c033d74477..0a101d28f356 100644 --- a/browser/components/migration/ChromeMigrationUtils.sys.mjs +++ b/browser/components/migration/ChromeMigrationUtils.jsm @@ -1,26 +1,27 @@ /* 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"; - -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +var EXPORTED_SYMBOLS = ["ChromeMigrationUtils"]; +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, { - MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", -}); - XPCOMUtils.defineLazyModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.jsm", + MigrationUtils: "resource:///modules/MigrationUtils.jsm", OS: "resource://gre/modules/osfile.jsm", }); const S100NS_FROM1601TO1970 = 0x19db1ded53e8000; const S100NS_PER_MS = 10; -export var ChromeMigrationUtils = { +var ChromeMigrationUtils = { // Supported browsers with importable logins. CONTEXTUAL_LOGIN_IMPORT_BROWSERS: ["chrome", "chromium-edge", "chromium"], diff --git a/browser/components/migration/ChromeProfileMigrator.sys.mjs b/browser/components/migration/ChromeProfileMigrator.jsm similarity index 93% rename from browser/components/migration/ChromeProfileMigrator.sys.mjs rename to browser/components/migration/ChromeProfileMigrator.jsm index 5c8579c1a977..d1aa85c19793 100644 --- a/browser/components/migration/ChromeProfileMigrator.sys.mjs +++ b/browser/components/migration/ChromeProfileMigrator.jsm @@ -4,33 +4,36 @@ * 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 AUTH_TYPE = { SCHEME_HTML: 0, SCHEME_BASIC: 1, SCHEME_DIGEST: 2, }; -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; - -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; - -import { - MigratorPrototype, - MigrationUtils, -} from "resource:///modules/MigrationUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); +const { MigratorPrototype, MigrationUtils } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - ChromeMigrationUtils: "resource:///modules/ChromeMigrationUtils.sys.mjs", PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", - Qihoo360seMigrationUtils: "resource:///modules/360seMigrationUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { + ChromeMigrationUtils: "resource:///modules/ChromeMigrationUtils.jsm", NetUtil: "resource://gre/modules/NetUtil.jsm", OS: "resource://gre/modules/osfile.jsm", + Qihoo360seMigrationUtils: "resource:///modules/360seMigrationUtils.jsm", }); /** @@ -74,7 +77,7 @@ function convertBookmarks(items, errorAccumulator) { return itemsToInsert; } -export function ChromeProfileMigrator() { +function ChromeProfileMigrator() { this._chromeUserDataPathSuffix = "Chrome"; } @@ -512,13 +515,13 @@ ChromeProfileMigrator.prototype._GetPasswordsResource = async function( let crypto; try { if (AppConstants.platform == "win") { - let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule( - "resource:///modules/ChromeWindowsLoginCrypto.sys.mjs" + let { ChromeWindowsLoginCrypto } = ChromeUtils.import( + "resource:///modules/ChromeWindowsLoginCrypto.jsm" ); crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix); } else if (AppConstants.platform == "macosx") { - let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule( - "resource:///modules/ChromeMacOSLoginCrypto.sys.mjs" + let { ChromeMacOSLoginCrypto } = ChromeUtils.import( + "resource:///modules/ChromeMacOSLoginCrypto.jsm" ); crypto = new ChromeMacOSLoginCrypto( _keychainServiceName, @@ -625,7 +628,7 @@ ChromeProfileMigrator.prototype.classID = Components.ID( /** * Chromium migration **/ -export function ChromiumProfileMigrator() { +function ChromiumProfileMigrator() { this._chromeUserDataPathSuffix = "Chromium"; this._keychainServiceName = "Chromium Safe Storage"; this._keychainAccountName = "Chromium"; @@ -642,11 +645,17 @@ ChromiumProfileMigrator.prototype.classID = Components.ID( "{8cece922-9720-42de-b7db-7cef88cb07ca}" ); +var EXPORTED_SYMBOLS = [ + "ChromeProfileMigrator", + "ChromiumProfileMigrator", + "BraveProfileMigrator", +]; + /** * Chrome Canary * Not available on Linux **/ -export function CanaryProfileMigrator() { +function CanaryProfileMigrator() { this._chromeUserDataPathSuffix = "Canary"; } CanaryProfileMigrator.prototype = Object.create( @@ -660,10 +669,14 @@ CanaryProfileMigrator.prototype.classID = Components.ID( "{4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}" ); +if (AppConstants.platform == "win" || AppConstants.platform == "macosx") { + EXPORTED_SYMBOLS.push("CanaryProfileMigrator"); +} + /** * Chrome Dev - Linux only (not available in Mac and Windows) */ -export function ChromeDevMigrator() { +function ChromeDevMigrator() { this._chromeUserDataPathSuffix = "Chrome Dev"; } ChromeDevMigrator.prototype = Object.create(ChromeProfileMigrator.prototype); @@ -674,6 +687,10 @@ ChromeDevMigrator.prototype.classID = Components.ID( "{7370a02a-4886-42c3-a4ec-d48c726ec30a}" ); +if (AppConstants.platform != "win" && AppConstants.platform != "macosx") { + EXPORTED_SYMBOLS.push("ChromeDevMigrator"); +} + function ChromeBetaMigrator() { this._chromeUserDataPathSuffix = "Chrome Beta"; } @@ -685,12 +702,15 @@ ChromeBetaMigrator.prototype.classID = Components.ID( "{47f75963-840b-4950-a1f0-d9c1864f8b8e}" ); -export function BraveProfileMigrator() { +if (AppConstants.platform != "macosx") { + EXPORTED_SYMBOLS.push("ChromeBetaMigrator"); +} + +function BraveProfileMigrator() { this._chromeUserDataPathSuffix = "Brave"; this._keychainServiceName = "Brave Browser Safe Storage"; this._keychainAccountName = "Brave Browser"; } - BraveProfileMigrator.prototype = Object.create(ChromeProfileMigrator.prototype); BraveProfileMigrator.prototype.classDescription = "Brave Browser Migrator"; BraveProfileMigrator.prototype.contractID = @@ -699,7 +719,7 @@ BraveProfileMigrator.prototype.classID = Components.ID( "{4071880a-69e4-4c83-88b4-6c589a62801d}" ); -export function ChromiumEdgeMigrator() { +function ChromiumEdgeMigrator() { this._chromeUserDataPathSuffix = "Edge"; this._keychainServiceName = "Microsoft Edge Safe Storage"; this._keychainAccountName = "Microsoft Edge"; @@ -713,7 +733,7 @@ ChromiumEdgeMigrator.prototype.classID = Components.ID( "{3c7f6b7c-baa9-4338-acfa-04bf79f1dcf1}" ); -export function ChromiumEdgeBetaMigrator() { +function ChromiumEdgeBetaMigrator() { this._chromeUserDataPathSuffix = "Edge Beta"; this._keychainServiceName = "Microsoft Edge Safe Storage"; this._keychainAccountName = "Microsoft Edge"; @@ -729,7 +749,11 @@ ChromiumEdgeBetaMigrator.prototype.classID = Components.ID( "{0fc3d48a-c1c3-4871-b58f-a8b47d1555fb}" ); -export function Chromium360seMigrator() { +if (AppConstants.platform == "macosx" || AppConstants.platform == "win") { + EXPORTED_SYMBOLS.push("ChromiumEdgeMigrator", "ChromiumEdgeBetaMigrator"); +} + +function Chromium360seMigrator() { this._chromeUserDataPathSuffix = "360 SE"; } Chromium360seMigrator.prototype = Object.create( @@ -742,3 +766,7 @@ Chromium360seMigrator.prototype.contractID = Chromium360seMigrator.prototype.classID = Components.ID( "{2e1a182e-ce4f-4dc9-a22c-d4125b931552}" ); + +if (AppConstants.platform == "win") { + EXPORTED_SYMBOLS.push("Chromium360seMigrator"); +} diff --git a/browser/components/migration/ChromeWindowsLoginCrypto.sys.mjs b/browser/components/migration/ChromeWindowsLoginCrypto.jsm similarity index 94% rename from browser/components/migration/ChromeWindowsLoginCrypto.sys.mjs rename to browser/components/migration/ChromeWindowsLoginCrypto.jsm index adcb0e95547b..cba56d033b4e 100644 --- a/browser/components/migration/ChromeWindowsLoginCrypto.sys.mjs +++ b/browser/components/migration/ChromeWindowsLoginCrypto.jsm @@ -2,15 +2,22 @@ * 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"; + /** * Class to handle encryption and decryption of logins stored in Chrome/Chromium * on Windows. */ -import { ChromeMigrationUtils } from "resource:///modules/ChromeMigrationUtils.sys.mjs"; +var EXPORTED_SYMBOLS = ["ChromeWindowsLoginCrypto"]; +const { ChromeMigrationUtils } = ChromeUtils.import( + "resource:///modules/ChromeMigrationUtils.jsm" +); const { OSCrypto } = ChromeUtils.import("resource://gre/modules/OSCrypto.jsm"); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); /** * These constants should match those from Chromium. @@ -30,7 +37,7 @@ const gTextEncoder = new TextEncoder(); * into code which uses that. The algorithms here are * specific to what is needed for Chrome login storage on Windows. */ -export class ChromeWindowsLoginCrypto { +class ChromeWindowsLoginCrypto { /** * @param {string} userDataPathSuffix */ diff --git a/browser/components/migration/ESEDBReader.sys.mjs b/browser/components/migration/ESEDBReader.jsm similarity index 97% rename from browser/components/migration/ESEDBReader.sys.mjs rename to browser/components/migration/ESEDBReader.jsm index 564952cbf79e..c41e6991abc1 100644 --- a/browser/components/migration/ESEDBReader.sys.mjs +++ b/browser/components/migration/ESEDBReader.jsm @@ -2,9 +2,23 @@ * 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 { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm"); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +"use strict"; +var EXPORTED_SYMBOLS = [ + "ESEDBReader", + // The items below are exported for test purposes. + "ESE", + "KERNEL", + "gLibs", + "COLUMN_TYPES", + "declareESEFunction", + "loadLibraries", +]; + +const { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm"); +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); const lazy = {}; XPCOMUtils.defineLazyGetter(lazy, "log", () => { let { ConsoleAPI } = ChromeUtils.importESModule( @@ -27,8 +41,7 @@ let gESEInstanceCounter = 0; const MAX_STR_LENGTH = 64 * 1024; // Kernel-related types: -export const KERNEL = {}; - +const KERNEL = {}; KERNEL.FILETIME = new ctypes.StructType("FILETIME", [ { dwLowDateTime: ctypes.uint32_t }, { dwHighDateTime: ctypes.uint32_t }, @@ -45,7 +58,7 @@ KERNEL.SYSTEMTIME = new ctypes.StructType("SYSTEMTIME", [ ]); // DB column types, cribbed from the ESE header -export var COLUMN_TYPES = { +var COLUMN_TYPES = { JET_coltypBit: 1 /* True, False, or NULL */, JET_coltypUnsignedByte: 2 /* 1-byte integer, unsigned */, JET_coltypShort: 3 /* 2-byte integer, signed */, @@ -73,8 +86,7 @@ function getColTypeName(numericValue) { } // All type constants and method wrappers go on this object: -export const ESE = {}; - +const ESE = {}; ESE.JET_ERR = ctypes.long; ESE.JET_PCWSTR = ctypes.char16_t.ptr; // The ESE header calls this JET_API_PTR, but because it isn't ever used as a @@ -107,7 +119,7 @@ ESE.JET_COLUMNDEF = new ctypes.StructType("JET_COLUMNDEF", [ let gOpenDBs = new Map(); // Track open libraries -export let gLibs = {}; +let gLibs = {}; function convertESEError(errorCode) { switch (errorCode) { @@ -167,7 +179,7 @@ function handleESEError( }; } -export function declareESEFunction(methodName, ...args) { +function declareESEFunction(methodName, ...args) { let declaration = ["Jet" + methodName, ctypes.winapi_abi, ESE.JET_ERR].concat( args ); @@ -305,7 +317,7 @@ function unloadLibraries() { delete gLibs.kernel; } -export function loadLibraries() { +function loadLibraries() { Services.obs.addObserver(unloadLibraries, "xpcom-shutdown"); gLibs.ese = ctypes.open("esent.dll"); gLibs.kernel = ctypes.open("kernel32.dll"); @@ -766,7 +778,7 @@ ESEDB.prototype = { }, }; -export let ESEDBReader = { +let ESEDBReader = { openDB(rootDir, dbFile, logDir) { let dbFilePath = dbFile.path; if (gOpenDBs.has(dbFilePath)) { diff --git a/browser/components/migration/EdgeProfileMigrator.sys.mjs b/browser/components/migration/EdgeProfileMigrator.jsm similarity index 96% rename from browser/components/migration/EdgeProfileMigrator.sys.mjs rename to browser/components/migration/EdgeProfileMigrator.jsm index 59549625b91e..ffef96ea4b73 100644 --- a/browser/components/migration/EdgeProfileMigrator.sys.mjs +++ b/browser/components/migration/EdgeProfileMigrator.jsm @@ -2,23 +2,31 @@ * 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 { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; - -import { - MigrationUtils, - MigratorPrototype, -} from "resource:///modules/MigrationUtils.sys.mjs"; -import { MSMigrationUtils } from "resource:///modules/MSMigrationUtils.sys.mjs"; - +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); +const { MigrationUtils, MigratorPrototype } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); +const { MSMigrationUtils } = ChromeUtils.import( + "resource:///modules/MSMigrationUtils.jsm" +); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - ESEDBReader: "resource:///modules/ESEDBReader.sys.mjs", PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", }); +ChromeUtils.defineModuleGetter( + lazy, + "ESEDBReader", + "resource:///modules/ESEDBReader.jsm" +); const kEdgeRegistryRoot = "SOFTWARE\\Classes\\Local Settings\\Software\\" + @@ -469,7 +477,7 @@ EdgeBookmarksMigrator.prototype = { }, }; -export function EdgeProfileMigrator() { +function EdgeProfileMigrator() { this.wrappedJSObject = this; } @@ -562,3 +570,5 @@ EdgeProfileMigrator.prototype.contractID = EdgeProfileMigrator.prototype.classID = Components.ID( "{62e8834b-2d17-49f5-96ff-56344903a2ae}" ); + +var EXPORTED_SYMBOLS = ["EdgeProfileMigrator"]; diff --git a/browser/components/migration/FirefoxProfileMigrator.sys.mjs b/browser/components/migration/FirefoxProfileMigrator.jsm similarity index 98% rename from browser/components/migration/FirefoxProfileMigrator.sys.mjs rename to browser/components/migration/FirefoxProfileMigrator.jsm index d387ba102a3c..2ce1a2826377 100644 --- a/browser/components/migration/FirefoxProfileMigrator.sys.mjs +++ b/browser/components/migration/FirefoxProfileMigrator.jsm @@ -4,6 +4,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"; + /* * Migrates from a Firefox profile in a lossy manner in order to clean up a * user's profile. Data is only migrated where the benefits outweigh the @@ -11,10 +13,9 @@ * from the source profile. */ -import { - MigrationUtils, - MigratorPrototype, -} from "resource:///modules/MigrationUtils.sys.mjs"; +const { MigrationUtils, MigratorPrototype } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); const lazy = {}; @@ -30,7 +31,7 @@ ChromeUtils.defineModuleGetter( ); ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm"); -export function FirefoxProfileMigrator() { +function FirefoxProfileMigrator() { this.wrappedJSObject = this; // for testing... } @@ -375,3 +376,5 @@ FirefoxProfileMigrator.prototype.contractID = FirefoxProfileMigrator.prototype.classID = Components.ID( "{91185366-ba97-4438-acba-48deaca63386}" ); + +var EXPORTED_SYMBOLS = ["FirefoxProfileMigrator"]; diff --git a/browser/components/migration/IEProfileMigrator.sys.mjs b/browser/components/migration/IEProfileMigrator.jsm similarity index 97% rename from browser/components/migration/IEProfileMigrator.sys.mjs rename to browser/components/migration/IEProfileMigrator.jsm index a55c7331bbb2..f025a2e3f762 100644 --- a/browser/components/migration/IEProfileMigrator.sys.mjs +++ b/browser/components/migration/IEProfileMigrator.jsm @@ -2,17 +2,21 @@ * 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 kLoginsKey = "Software\\Microsoft\\Internet Explorer\\IntelliForms\\Storage2"; -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; - +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); -import { - MigrationUtils, - MigratorPrototype, -} from "resource:///modules/MigrationUtils.sys.mjs"; -import { MSMigrationUtils } from "resource:///modules/MSMigrationUtils.sys.mjs"; +const { MigrationUtils, MigratorPrototype } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); +const { MSMigrationUtils } = ChromeUtils.import( + "resource:///modules/MSMigrationUtils.jsm" +); const lazy = {}; @@ -349,7 +353,7 @@ IE7FormPasswords.prototype = { }, }; -export function IEProfileMigrator() { +function IEProfileMigrator() { this.wrappedJSObject = this; // export this to be able to use it in the unittest. } @@ -404,3 +408,5 @@ IEProfileMigrator.prototype.contractID = IEProfileMigrator.prototype.classID = Components.ID( "{3d2532e3-4932-4774-b7ba-968f5899d3a4}" ); + +var EXPORTED_SYMBOLS = ["IEProfileMigrator"]; diff --git a/browser/components/migration/MSMigrationUtils.sys.mjs b/browser/components/migration/MSMigrationUtils.jsm similarity index 99% rename from browser/components/migration/MSMigrationUtils.sys.mjs rename to browser/components/migration/MSMigrationUtils.jsm index 45f09baefe08..13d0a21d8f42 100644 --- a/browser/components/migration/MSMigrationUtils.sys.mjs +++ b/browser/components/migration/MSMigrationUtils.jsm @@ -2,9 +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/. */ -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +"use strict"; -import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs"; +var EXPORTED_SYMBOLS = ["MSMigrationUtils"]; + +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); +const { MigrationUtils } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); const lazy = {}; @@ -968,7 +975,7 @@ WindowsVaultFormPasswords.prototype = { }, }; -export var MSMigrationUtils = { +var MSMigrationUtils = { MIGRATION_TYPE_IE: 1, MIGRATION_TYPE_EDGE: 2, CtypesKernelHelpers, diff --git a/browser/components/migration/MigrationUtils.sys.mjs b/browser/components/migration/MigrationUtils.jsm similarity index 99% rename from browser/components/migration/MigrationUtils.sys.mjs rename to browser/components/migration/MigrationUtils.jsm index db775af538a1..b68cffa7dd6f 100644 --- a/browser/components/migration/MigrationUtils.sys.mjs +++ b/browser/components/migration/MigrationUtils.jsm @@ -2,13 +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"; + +var EXPORTED_SYMBOLS = ["MigrationUtils", "MigratorPrototype"]; + const TOPIC_WILL_IMPORT_BOOKMARKS = "initial-migration-will-import-default-bookmarks"; const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmarks"; const TOPIC_PLACES_DEFAULTS_FINISHED = "places-browser-init-complete"; -import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +const { AppConstants } = ChromeUtils.importESModule( + "resource://gre/modules/AppConstants.sys.mjs" +); const lazy = {}; @@ -98,7 +104,7 @@ function getL10n() { * 5. Implement getResources(aProfile) (see below). * 6. For startup-only migrators, override |startupOnlyMigrator|. */ -export var MigratorPrototype = { +var MigratorPrototype = { QueryInterface: ChromeUtils.generateQI(["nsIBrowserProfileMigrator"]), /** @@ -510,7 +516,7 @@ export var MigratorPrototype = { }, }; -export var MigrationUtils = Object.seal({ +var MigrationUtils = Object.seal({ resourceTypes: { COOKIES: Ci.nsIBrowserProfileMigrator.COOKIES, HISTORY: Ci.nsIBrowserProfileMigrator.HISTORY, diff --git a/browser/components/migration/ProfileMigrator.sys.mjs b/browser/components/migration/ProfileMigrator.jsm similarity index 74% rename from browser/components/migration/ProfileMigrator.sys.mjs rename to browser/components/migration/ProfileMigrator.jsm index 5d3b8baba718..ab35a8f0218e 100644 --- a/browser/components/migration/ProfileMigrator.sys.mjs +++ b/browser/components/migration/ProfileMigrator.jsm @@ -2,9 +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 { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs"; +"use strict"; -export function ProfileMigrator() {} +const { MigrationUtils } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); + +function ProfileMigrator() {} ProfileMigrator.prototype = { migrate: MigrationUtils.startupMigration.bind(MigrationUtils), @@ -13,3 +17,5 @@ ProfileMigrator.prototype = { contractID: "@mozilla.org/toolkit/profile-migrator;1", classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE"), }; + +var EXPORTED_SYMBOLS = ["ProfileMigrator"]; diff --git a/browser/components/migration/SafariProfileMigrator.sys.mjs b/browser/components/migration/SafariProfileMigrator.jsm similarity index 98% rename from browser/components/migration/SafariProfileMigrator.sys.mjs rename to browser/components/migration/SafariProfileMigrator.jsm index 73840ea2db18..5e6e63b920fe 100644 --- a/browser/components/migration/SafariProfileMigrator.sys.mjs +++ b/browser/components/migration/SafariProfileMigrator.jsm @@ -2,13 +2,15 @@ * 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 { FileUtils } from "resource://gre/modules/FileUtils.sys.mjs"; +"use strict"; +const { FileUtils } = ChromeUtils.importESModule( + "resource://gre/modules/FileUtils.sys.mjs" +); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); -import { - MigrationUtils, - MigratorPrototype, -} from "resource:///modules/MigrationUtils.sys.mjs"; +const { MigrationUtils, MigratorPrototype } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" +); const lazy = {}; @@ -358,7 +360,7 @@ SearchStrings.prototype = { }, }; -export function SafariProfileMigrator() {} +function SafariProfileMigrator() {} SafariProfileMigrator.prototype = Object.create(MigratorPrototype); @@ -490,3 +492,5 @@ SafariProfileMigrator.prototype.contractID = SafariProfileMigrator.prototype.classID = Components.ID( "{4b609ecf-60b2-4655-9df4-dc149e474da1}" ); + +var EXPORTED_SYMBOLS = ["SafariProfileMigrator"]; diff --git a/browser/components/migration/components.conf b/browser/components/migration/components.conf index 26e73caaa71c..302057af8e25 100644 --- a/browser/components/migration/components.conf +++ b/browser/components/migration/components.conf @@ -11,31 +11,31 @@ Classes = [ { 'cid': '{6F8BB968-C14F-4D6F-9733-6C6737B35DCE}', 'contract_ids': ['@mozilla.org/toolkit/profile-migrator;1'], - 'esModule': 'resource:///modules/ProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ProfileMigrator.jsm', 'constructor': 'ProfileMigrator', }, { 'cid': '{4071880a-69e4-4c83-88b4-6c589a62801d}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=brave'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'BraveProfileMigrator', }, { 'cid': '{4cec1de4-1671-4fc3-a53e-6c539dc77a26}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromeProfileMigrator', }, { 'cid': '{8cece922-9720-42de-b7db-7cef88cb07ca}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromiumProfileMigrator', }, { 'cid': '{91185366-ba97-4438-acba-48deaca63386}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=firefox'], - 'esModule': 'resource:///modules/FirefoxProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/FirefoxProfileMigrator.jsm', 'constructor': 'FirefoxProfileMigrator', }, ] @@ -45,7 +45,7 @@ if not XP_MACOSX: { 'cid': '{47f75963-840b-4950-a1f0-d9c1864f8b8e}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromeBetaMigrator', }, ] @@ -55,19 +55,19 @@ if XP_WIN or XP_MACOSX: { 'cid': '{4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=canary'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'CanaryProfileMigrator', }, { 'cid': '{3c7f6b7c-baa9-4338-acfa-04bf79f1dcf1}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-edge'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromiumEdgeMigrator', }, { 'cid': '{0fc3d48a-c1c3-4871-b58f-a8b47d1555fb}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-edge-beta'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromiumEdgeBetaMigrator', }, ] @@ -76,7 +76,7 @@ else: { 'cid': '{7370a02a-4886-42c3-a4ec-d48c726ec30a}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'ChromeDevMigrator', }, ] @@ -86,19 +86,19 @@ if XP_WIN: { 'cid': '{3d2532e3-4932-4774-b7ba-968f5899d3a4}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=ie'], - 'esModule': 'resource:///modules/IEProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/IEProfileMigrator.jsm', 'constructor': 'IEProfileMigrator', }, { 'cid': '{62e8834b-2d17-49f5-96ff-56344903a2ae}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=edge'], - 'esModule': 'resource:///modules/EdgeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/EdgeProfileMigrator.jsm', 'constructor': 'EdgeProfileMigrator', }, { 'cid': '{2e1a182e-ce4f-4dc9-a22c-d4125b931552}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-360se'], - 'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', 'constructor': 'Chromium360seMigrator', }, ] @@ -108,7 +108,7 @@ if XP_MACOSX: { 'cid': '{4b609ecf-60b2-4655-9df4-dc149e474da1}', 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=safari'], - 'esModule': 'resource:///modules/SafariProfileMigrator.sys.mjs', + 'jsm': 'resource:///modules/SafariProfileMigrator.jsm', 'constructor': 'SafariProfileMigrator', }, { diff --git a/browser/components/migration/content/migration.js b/browser/components/migration/content/migration.js index 78d2cba08740..9a1e0ab0b0a5 100644 --- a/browser/components/migration/content/migration.js +++ b/browser/components/migration/content/migration.js @@ -10,8 +10,8 @@ const kIPStartup = Ci.nsIProfileStartup; const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); -const { MigrationUtils } = ChromeUtils.importESModule( - "resource:///modules/MigrationUtils.sys.mjs" +const { MigrationUtils } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" ); /** diff --git a/browser/components/migration/moz.build b/browser/components/migration/moz.build index e6c5fad32d5e..0dbf8f66c6a1 100644 --- a/browser/components/migration/moz.build +++ b/browser/components/migration/moz.build @@ -17,11 +17,11 @@ XPIDL_SOURCES += [ XPIDL_MODULE = "migration" EXTRA_JS_MODULES += [ - "ChromeMigrationUtils.sys.mjs", - "ChromeProfileMigrator.sys.mjs", - "FirefoxProfileMigrator.sys.mjs", - "MigrationUtils.sys.mjs", - "ProfileMigrator.sys.mjs", + "ChromeMigrationUtils.jsm", + "ChromeProfileMigrator.jsm", + "FirefoxProfileMigrator.jsm", + "MigrationUtils.jsm", + "ProfileMigrator.jsm", ] if CONFIG["OS_ARCH"] == "WINNT": @@ -33,12 +33,12 @@ if CONFIG["OS_ARCH"] == "WINNT": "nsIEHistoryEnumerator.cpp", ] EXTRA_JS_MODULES += [ - "360seMigrationUtils.sys.mjs", - "ChromeWindowsLoginCrypto.sys.mjs", - "EdgeProfileMigrator.sys.mjs", - "ESEDBReader.sys.mjs", - "IEProfileMigrator.sys.mjs", - "MSMigrationUtils.sys.mjs", + "360seMigrationUtils.jsm", + "ChromeWindowsLoginCrypto.jsm", + "EdgeProfileMigrator.jsm", + "ESEDBReader.jsm", + "IEProfileMigrator.jsm", + "MSMigrationUtils.jsm", ] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": @@ -46,8 +46,8 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": "nsKeychainMigrationUtils.h", ] EXTRA_JS_MODULES += [ - "ChromeMacOSLoginCrypto.sys.mjs", - "SafariProfileMigrator.sys.mjs", + "ChromeMacOSLoginCrypto.jsm", + "SafariProfileMigrator.jsm", ] SOURCES += [ "nsKeychainMigrationUtils.mm", diff --git a/browser/components/migration/tests/unit/head_migration.js b/browser/components/migration/tests/unit/head_migration.js index f15a291bf2fc..dcfd62f937a2 100644 --- a/browser/components/migration/tests/unit/head_migration.js +++ b/browser/components/migration/tests/unit/head_migration.js @@ -1,7 +1,7 @@ "use strict"; -var { MigrationUtils, MigratorPrototype } = ChromeUtils.importESModule( - "resource:///modules/MigrationUtils.sys.mjs" +var { MigrationUtils, MigratorPrototype } = ChromeUtils.import( + "resource:///modules/MigrationUtils.jsm" ); var { LoginHelper } = ChromeUtils.import( "resource://gre/modules/LoginHelper.jsm" diff --git a/browser/components/migration/tests/unit/test_360seMigrationUtils.js b/browser/components/migration/tests/unit/test_360seMigrationUtils.js index 9dd7704317d7..bba28ff89063 100644 --- a/browser/components/migration/tests/unit/test_360seMigrationUtils.js +++ b/browser/components/migration/tests/unit/test_360seMigrationUtils.js @@ -1,7 +1,7 @@ "use strict"; -const { Qihoo360seMigrationUtils } = ChromeUtils.importESModule( - "resource:///modules/360seMigrationUtils.sys.mjs" +const { Qihoo360seMigrationUtils } = ChromeUtils.import( + "resource:///modules/360seMigrationUtils.jsm" ); const parentPath = do_get_file("AppData/Roaming/360se6/User Data").path; diff --git a/browser/components/migration/tests/unit/test_ChromeMigrationUtils.js b/browser/components/migration/tests/unit/test_ChromeMigrationUtils.js index c82c95933398..937332628c84 100644 --- a/browser/components/migration/tests/unit/test_ChromeMigrationUtils.js +++ b/browser/components/migration/tests/unit/test_ChromeMigrationUtils.js @@ -1,7 +1,7 @@ "use strict"; -const { ChromeMigrationUtils } = ChromeUtils.importESModule( - "resource:///modules/ChromeMigrationUtils.sys.mjs" +const { ChromeMigrationUtils } = ChromeUtils.import( + "resource:///modules/ChromeMigrationUtils.jsm" ); // Setup chrome user data path for all platforms. diff --git a/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path.js b/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path.js index b1698b9fbb5b..95b24b4b9aaf 100644 --- a/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path.js +++ b/browser/components/migration/tests/unit/test_ChromeMigrationUtils_path.js @@ -3,8 +3,8 @@ const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); -const { ChromeMigrationUtils } = ChromeUtils.importESModule( - "resource:///modules/ChromeMigrationUtils.sys.mjs" +const { ChromeMigrationUtils } = ChromeUtils.import( + "resource:///modules/ChromeMigrationUtils.jsm" ); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); diff --git a/browser/components/migration/tests/unit/test_Chrome_history.js b/browser/components/migration/tests/unit/test_Chrome_history.js index c88a6380c220..9959a637d490 100644 --- a/browser/components/migration/tests/unit/test_Chrome_history.js +++ b/browser/components/migration/tests/unit/test_Chrome_history.js @@ -3,8 +3,8 @@ "use strict"; -const { ChromeMigrationUtils } = ChromeUtils.importESModule( - "resource:///modules/ChromeMigrationUtils.sys.mjs" +const { ChromeMigrationUtils } = ChromeUtils.import( + "resource:///modules/ChromeMigrationUtils.jsm" ); const SOURCE_PROFILE_DIR = "Library/Application Support/Google/Chrome/Default/"; diff --git a/browser/components/migration/tests/unit/test_Chrome_passwords.js b/browser/components/migration/tests/unit/test_Chrome_passwords.js index 678abc5062bf..8ab9478db11c 100644 --- a/browser/components/migration/tests/unit/test_Chrome_passwords.js +++ b/browser/components/migration/tests/unit/test_Chrome_passwords.js @@ -216,8 +216,8 @@ add_task(async function setup() { accountName: "TESTING Chrome", }; if (AppConstants.platform == "macosx") { - let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule( - "resource:///modules/ChromeMacOSLoginCrypto.sys.mjs" + let { ChromeMacOSLoginCrypto } = ChromeUtils.import( + "resource:///modules/ChromeMacOSLoginCrypto.jsm" ); loginCrypto = new ChromeMacOSLoginCrypto( mockMacOSKeychain.serviceName, @@ -234,8 +234,8 @@ add_task(async function setup() { "Login Data", ]; } else if (AppConstants.platform == "win") { - let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule( - "resource:///modules/ChromeWindowsLoginCrypto.sys.mjs" + let { ChromeWindowsLoginCrypto } = ChromeUtils.import( + "resource:///modules/ChromeWindowsLoginCrypto.jsm" ); loginCrypto = new ChromeWindowsLoginCrypto("Chrome"); dirSvcPath = "AppData/Local/"; diff --git a/browser/components/migration/tests/unit/test_Edge_db_migration.js b/browser/components/migration/tests/unit/test_Edge_db_migration.js index d111304da3a4..a3551806b45c 100644 --- a/browser/components/migration/tests/unit/test_Edge_db_migration.js +++ b/browser/components/migration/tests/unit/test_Edge_db_migration.js @@ -8,7 +8,7 @@ const { COLUMN_TYPES, declareESEFunction, loadLibraries, -} = ChromeUtils.importESModule("resource:///modules/ESEDBReader.sys.mjs"); +} = ChromeUtils.import("resource:///modules/ESEDBReader.jsm"); let gESEInstanceCounter = 1; diff --git a/browser/components/places/PlacesUIUtils.sys.mjs b/browser/components/places/PlacesUIUtils.sys.mjs index 1ff8b9c3a131..b6550732604b 100644 --- a/browser/components/places/PlacesUIUtils.sys.mjs +++ b/browser/components/places/PlacesUIUtils.sys.mjs @@ -11,7 +11,6 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", PlacesTransactions: "resource://gre/modules/PlacesTransactions.sys.mjs", PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", @@ -21,6 +20,7 @@ ChromeUtils.defineESModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, { BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm", CustomizableUI: "resource:///modules/CustomizableUI.jsm", + MigrationUtils: "resource:///modules/MigrationUtils.jsm", OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm", PluralForm: "resource://gre/modules/PluralForm.jsm", Weave: "resource://services-sync/main.js", diff --git a/browser/components/places/content/places.js b/browser/components/places/content/places.js index 9c081e9fbe4c..6953f666304c 100644 --- a/browser/components/places/content/places.js +++ b/browser/components/places/content/places.js @@ -13,7 +13,6 @@ var { XPCOMUtils } = ChromeUtils.importESModule( ); ChromeUtils.defineESModuleGetters(this, { BookmarkJSONUtils: "resource://gre/modules/BookmarkJSONUtils.sys.mjs", - MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", PlacesBackups: "resource://gre/modules/PlacesBackups.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); @@ -32,7 +31,11 @@ XPCOMUtils.defineLazyScriptGetter( var { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); - +ChromeUtils.defineModuleGetter( + this, + "MigrationUtils", + "resource:///modules/MigrationUtils.jsm" +); ChromeUtils.defineModuleGetter( this, "DownloadUtils", diff --git a/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js b/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js index 4d54002fd3c2..6d5ecbd3af00 100644 --- a/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js +++ b/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js @@ -268,7 +268,7 @@ function shouldRetry(response) { ); } -// Copied from browser/components/migration/MigrationUtils.sys.mjs +// Copied from browser/components/migration/MigrationUtils.jsm function spinResolve(promise) { if (!(promise instanceof Promise)) { return promise; diff --git a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm index 8827ed6ff404..0e140a690dba 100644 --- a/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm +++ b/toolkit/components/messaging-system/lib/SpecialMessageActions.jsm @@ -13,14 +13,11 @@ const NETWORK_TRR_MODE_PREF = "network.trr.mode"; const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { - 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", + MigrationUtils: "resource:///modules/MigrationUtils.jsm", Spotlight: "resource://activity-stream/lib/Spotlight.jsm", }); diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm index 9ac60022b925..e95a42b32557 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm @@ -31,14 +31,14 @@ XPCOMUtils.defineLazyGetter(lazy, "PasswordRulesManager", () => { }); ChromeUtils.defineESModuleGetters(lazy, { - ChromeMigrationUtils: "resource:///modules/ChromeMigrationUtils.sys.mjs", - MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { + ChromeMigrationUtils: "resource:///modules/ChromeMigrationUtils.jsm", NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", LoginHelper: "resource://gre/modules/LoginHelper.jsm", + MigrationUtils: "resource:///modules/MigrationUtils.jsm", PasswordGenerator: "resource://gre/modules/PasswordGenerator.jsm", }); diff --git a/tools/lint/rejected-words.yml b/tools/lint/rejected-words.yml index 060121abf57c..20f7d6e88fda 100644 --- a/tools/lint/rejected-words.yml +++ b/tools/lint/rejected-words.yml @@ -49,8 +49,8 @@ avoid-blacklist-and-whitelist: - browser/base/content/test/tabMediaIndicator/browser_mute_webAudio.js - browser/base/content/test/tabs/browser_new_file_whitelisted_http_tab.js - browser/components/downloads/content/contentAreaDownloadsView.xhtml - - browser/components/migration/ChromeMigrationUtils.sys.mjs - - browser/components/migration/ChromeProfileMigrator.sys.mjs + - browser/components/migration/ChromeMigrationUtils.jsm + - browser/components/migration/ChromeProfileMigrator.jsm - browser/components/newtab/data/content/activity-stream.bundle.js - browser/components/ion/content/ion.js - browser/components/preferences/privacy.inc.xhtml