Bug 1788919 - Convert browser/components/migration JSM modules to ESMs. r=mconley,credential-management-reviewers,sgalich

Differential Revision: https://phabricator.services.mozilla.com/D158655
This commit is contained in:
steven100695 2022-10-27 18:15:55 +00:00
Родитель 968bd89420
Коммит 14e60b6839
30 изменённых файлов: 146 добавлений и 249 удалений

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

@ -27,6 +27,7 @@ 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",
@ -70,7 +71,6 @@ 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",

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

@ -2,16 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["Qihoo360seMigrationUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { MigrationUtils } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
const lazy = {};
@ -122,7 +115,7 @@ Bookmarks.prototype = {
},
};
var Qihoo360seMigrationUtils = {
export var Qihoo360seMigrationUtils = {
async getAlternativeBookmarks({ bookmarksPath, localState }) {
let lastModificationDate = new Date(0);
let path = bookmarksPath;

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

@ -2,18 +2,12 @@
* 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.
*/
var EXPORTED_SYMBOLS = ["ChromeMacOSLoginCrypto"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -71,7 +65,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.
*/
class ChromeMacOSLoginCrypto {
export 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.

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

@ -1,27 +1,26 @@
/* 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 = ["ChromeMigrationUtils"];
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
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;
var ChromeMigrationUtils = {
export var ChromeMigrationUtils = {
// Supported browsers with importable logins.
CONTEXTUAL_LOGIN_IMPORT_BROWSERS: ["chrome", "chromium-edge", "chromium"],

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

@ -4,36 +4,33 @@
* 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,
};
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"
);
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 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",
});
/**
@ -77,7 +74,7 @@ function convertBookmarks(items, errorAccumulator) {
return itemsToInsert;
}
function ChromeProfileMigrator() {
export function ChromeProfileMigrator() {
this._chromeUserDataPathSuffix = "Chrome";
}
@ -515,13 +512,13 @@ ChromeProfileMigrator.prototype._GetPasswordsResource = async function(
let crypto;
try {
if (AppConstants.platform == "win") {
let { ChromeWindowsLoginCrypto } = ChromeUtils.import(
"resource:///modules/ChromeWindowsLoginCrypto.jsm"
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
);
crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix);
} else if (AppConstants.platform == "macosx") {
let { ChromeMacOSLoginCrypto } = ChromeUtils.import(
"resource:///modules/ChromeMacOSLoginCrypto.jsm"
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
);
crypto = new ChromeMacOSLoginCrypto(
_keychainServiceName,
@ -628,7 +625,7 @@ ChromeProfileMigrator.prototype.classID = Components.ID(
/**
* Chromium migration
**/
function ChromiumProfileMigrator() {
export function ChromiumProfileMigrator() {
this._chromeUserDataPathSuffix = "Chromium";
this._keychainServiceName = "Chromium Safe Storage";
this._keychainAccountName = "Chromium";
@ -645,17 +642,11 @@ ChromiumProfileMigrator.prototype.classID = Components.ID(
"{8cece922-9720-42de-b7db-7cef88cb07ca}"
);
var EXPORTED_SYMBOLS = [
"ChromeProfileMigrator",
"ChromiumProfileMigrator",
"BraveProfileMigrator",
];
/**
* Chrome Canary
* Not available on Linux
**/
function CanaryProfileMigrator() {
export function CanaryProfileMigrator() {
this._chromeUserDataPathSuffix = "Canary";
}
CanaryProfileMigrator.prototype = Object.create(
@ -669,14 +660,10 @@ 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)
*/
function ChromeDevMigrator() {
export function ChromeDevMigrator() {
this._chromeUserDataPathSuffix = "Chrome Dev";
}
ChromeDevMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
@ -687,10 +674,6 @@ 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";
}
@ -702,15 +685,12 @@ ChromeBetaMigrator.prototype.classID = Components.ID(
"{47f75963-840b-4950-a1f0-d9c1864f8b8e}"
);
if (AppConstants.platform != "macosx") {
EXPORTED_SYMBOLS.push("ChromeBetaMigrator");
}
function BraveProfileMigrator() {
export 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 =
@ -719,7 +699,7 @@ BraveProfileMigrator.prototype.classID = Components.ID(
"{4071880a-69e4-4c83-88b4-6c589a62801d}"
);
function ChromiumEdgeMigrator() {
export function ChromiumEdgeMigrator() {
this._chromeUserDataPathSuffix = "Edge";
this._keychainServiceName = "Microsoft Edge Safe Storage";
this._keychainAccountName = "Microsoft Edge";
@ -733,7 +713,7 @@ ChromiumEdgeMigrator.prototype.classID = Components.ID(
"{3c7f6b7c-baa9-4338-acfa-04bf79f1dcf1}"
);
function ChromiumEdgeBetaMigrator() {
export function ChromiumEdgeBetaMigrator() {
this._chromeUserDataPathSuffix = "Edge Beta";
this._keychainServiceName = "Microsoft Edge Safe Storage";
this._keychainAccountName = "Microsoft Edge";
@ -749,11 +729,7 @@ ChromiumEdgeBetaMigrator.prototype.classID = Components.ID(
"{0fc3d48a-c1c3-4871-b58f-a8b47d1555fb}"
);
if (AppConstants.platform == "macosx" || AppConstants.platform == "win") {
EXPORTED_SYMBOLS.push("ChromiumEdgeMigrator", "ChromiumEdgeBetaMigrator");
}
function Chromium360seMigrator() {
export function Chromium360seMigrator() {
this._chromeUserDataPathSuffix = "360 SE";
}
Chromium360seMigrator.prototype = Object.create(
@ -766,7 +742,3 @@ Chromium360seMigrator.prototype.contractID =
Chromium360seMigrator.prototype.classID = Components.ID(
"{2e1a182e-ce4f-4dc9-a22c-d4125b931552}"
);
if (AppConstants.platform == "win") {
EXPORTED_SYMBOLS.push("Chromium360seMigrator");
}

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

@ -2,22 +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/. */
"use strict";
/**
* Class to handle encryption and decryption of logins stored in Chrome/Chromium
* on Windows.
*/
var EXPORTED_SYMBOLS = ["ChromeWindowsLoginCrypto"];
import { ChromeMigrationUtils } from "resource:///modules/ChromeMigrationUtils.sys.mjs";
const { ChromeMigrationUtils } = ChromeUtils.import(
"resource:///modules/ChromeMigrationUtils.jsm"
);
const { OSCrypto } = ChromeUtils.import("resource://gre/modules/OSCrypto.jsm");
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
/**
* These constants should match those from Chromium.
@ -37,7 +30,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.
*/
class ChromeWindowsLoginCrypto {
export class ChromeWindowsLoginCrypto {
/**
* @param {string} userDataPathSuffix
*/

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

@ -2,23 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
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"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
@ -41,7 +27,8 @@ let gESEInstanceCounter = 0;
const MAX_STR_LENGTH = 64 * 1024;
// Kernel-related types:
const KERNEL = {};
export const KERNEL = {};
KERNEL.FILETIME = new ctypes.StructType("FILETIME", [
{ dwLowDateTime: ctypes.uint32_t },
{ dwHighDateTime: ctypes.uint32_t },
@ -58,7 +45,7 @@ KERNEL.SYSTEMTIME = new ctypes.StructType("SYSTEMTIME", [
]);
// DB column types, cribbed from the ESE header
var COLUMN_TYPES = {
export var COLUMN_TYPES = {
JET_coltypBit: 1 /* True, False, or NULL */,
JET_coltypUnsignedByte: 2 /* 1-byte integer, unsigned */,
JET_coltypShort: 3 /* 2-byte integer, signed */,
@ -86,7 +73,8 @@ function getColTypeName(numericValue) {
}
// All type constants and method wrappers go on this object:
const ESE = {};
export 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
@ -119,7 +107,7 @@ ESE.JET_COLUMNDEF = new ctypes.StructType("JET_COLUMNDEF", [
let gOpenDBs = new Map();
// Track open libraries
let gLibs = {};
export let gLibs = {};
function convertESEError(errorCode) {
switch (errorCode) {
@ -179,7 +167,7 @@ function handleESEError(
};
}
function declareESEFunction(methodName, ...args) {
export function declareESEFunction(methodName, ...args) {
let declaration = ["Jet" + methodName, ctypes.winapi_abi, ESE.JET_ERR].concat(
args
);
@ -317,7 +305,7 @@ function unloadLibraries() {
delete gLibs.kernel;
}
function loadLibraries() {
export function loadLibraries() {
Services.obs.addObserver(unloadLibraries, "xpcom-shutdown");
gLibs.ese = ctypes.open("esent.dll");
gLibs.kernel = ctypes.open("kernel32.dll");
@ -778,7 +766,7 @@ ESEDB.prototype = {
},
};
let ESEDBReader = {
export let ESEDBReader = {
openDB(rootDir, dbFile, logDir) {
let dbFilePath = dbFile.path;
if (gOpenDBs.has(dbFilePath)) {

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

@ -2,31 +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/. */
"use strict";
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");
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"
);
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 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\\" +
@ -477,7 +469,7 @@ EdgeBookmarksMigrator.prototype = {
},
};
function EdgeProfileMigrator() {
export function EdgeProfileMigrator() {
this.wrappedJSObject = this;
}
@ -570,5 +562,3 @@ EdgeProfileMigrator.prototype.contractID =
EdgeProfileMigrator.prototype.classID = Components.ID(
"{62e8834b-2d17-49f5-96ff-56344903a2ae}"
);
var EXPORTED_SYMBOLS = ["EdgeProfileMigrator"];

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

@ -4,8 +4,6 @@
* 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
@ -13,9 +11,10 @@
* from the source profile.
*/
const { MigrationUtils, MigratorPrototype } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
import {
MigrationUtils,
MigratorPrototype,
} from "resource:///modules/MigrationUtils.sys.mjs";
const lazy = {};
@ -31,7 +30,7 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm");
function FirefoxProfileMigrator() {
export function FirefoxProfileMigrator() {
this.wrappedJSObject = this; // for testing...
}
@ -376,5 +375,3 @@ FirefoxProfileMigrator.prototype.contractID =
FirefoxProfileMigrator.prototype.classID = Components.ID(
"{91185366-ba97-4438-acba-48deaca63386}"
);
var EXPORTED_SYMBOLS = ["FirefoxProfileMigrator"];

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

@ -2,21 +2,17 @@
* 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";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { MigrationUtils, MigratorPrototype } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
const { MSMigrationUtils } = ChromeUtils.import(
"resource:///modules/MSMigrationUtils.jsm"
);
import {
MigrationUtils,
MigratorPrototype,
} from "resource:///modules/MigrationUtils.sys.mjs";
import { MSMigrationUtils } from "resource:///modules/MSMigrationUtils.sys.mjs";
const lazy = {};
@ -353,7 +349,7 @@ IE7FormPasswords.prototype = {
},
};
function IEProfileMigrator() {
export function IEProfileMigrator() {
this.wrappedJSObject = this; // export this to be able to use it in the unittest.
}
@ -408,5 +404,3 @@ IEProfileMigrator.prototype.contractID =
IEProfileMigrator.prototype.classID = Components.ID(
"{3d2532e3-4932-4774-b7ba-968f5899d3a4}"
);
var EXPORTED_SYMBOLS = ["IEProfileMigrator"];

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

@ -2,16 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
var EXPORTED_SYMBOLS = ["MSMigrationUtils"];
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { MigrationUtils } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
const lazy = {};
@ -975,7 +968,7 @@ WindowsVaultFormPasswords.prototype = {
},
};
var MSMigrationUtils = {
export var MSMigrationUtils = {
MIGRATION_TYPE_IE: 1,
MIGRATION_TYPE_EDGE: 2,
CtypesKernelHelpers,

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

@ -2,19 +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/. */
"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";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
import AppConstants from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -104,7 +98,7 @@ function getL10n() {
* 5. Implement getResources(aProfile) (see below).
* 6. For startup-only migrators, override |startupOnlyMigrator|.
*/
var MigratorPrototype = {
export var MigratorPrototype = {
QueryInterface: ChromeUtils.generateQI(["nsIBrowserProfileMigrator"]),
/**
@ -516,7 +510,7 @@ var MigratorPrototype = {
},
};
var MigrationUtils = Object.seal({
export var MigrationUtils = Object.seal({
resourceTypes: {
COOKIES: Ci.nsIBrowserProfileMigrator.COOKIES,
HISTORY: Ci.nsIBrowserProfileMigrator.HISTORY,

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

@ -2,13 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
const { MigrationUtils } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
function ProfileMigrator() {}
export function ProfileMigrator() {}
ProfileMigrator.prototype = {
migrate: MigrationUtils.startupMigration.bind(MigrationUtils),
@ -17,5 +13,3 @@ ProfileMigrator.prototype = {
contractID: "@mozilla.org/toolkit/profile-migrator;1",
classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE"),
};
var EXPORTED_SYMBOLS = ["ProfileMigrator"];

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

@ -2,15 +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/. */
"use strict";
import { FileUtils } from "resource://gre/modules/FileUtils.sys.mjs";
const { FileUtils } = ChromeUtils.importESModule(
"resource://gre/modules/FileUtils.sys.mjs"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { MigrationUtils, MigratorPrototype } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
);
import {
MigrationUtils,
MigratorPrototype,
} from "resource:///modules/MigrationUtils.sys.mjs";
const lazy = {};
@ -360,7 +358,7 @@ SearchStrings.prototype = {
},
};
function SafariProfileMigrator() {}
export function SafariProfileMigrator() {}
SafariProfileMigrator.prototype = Object.create(MigratorPrototype);
@ -492,5 +490,3 @@ SafariProfileMigrator.prototype.contractID =
SafariProfileMigrator.prototype.classID = Components.ID(
"{4b609ecf-60b2-4655-9df4-dc149e474da1}"
);
var EXPORTED_SYMBOLS = ["SafariProfileMigrator"];

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

@ -11,31 +11,31 @@ Classes = [
{
'cid': '{6F8BB968-C14F-4D6F-9733-6C6737B35DCE}',
'contract_ids': ['@mozilla.org/toolkit/profile-migrator;1'],
'jsm': 'resource:///modules/ProfileMigrator.jsm',
'esModule': 'resource:///modules/ProfileMigrator.sys.mjs',
'constructor': 'ProfileMigrator',
},
{
'cid': '{4071880a-69e4-4c83-88b4-6c589a62801d}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=brave'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'constructor': 'BraveProfileMigrator',
},
{
'cid': '{4cec1de4-1671-4fc3-a53e-6c539dc77a26}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'constructor': 'ChromeProfileMigrator',
},
{
'cid': '{8cece922-9720-42de-b7db-7cef88cb07ca}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'constructor': 'ChromiumProfileMigrator',
},
{
'cid': '{91185366-ba97-4438-acba-48deaca63386}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=firefox'],
'jsm': 'resource:///modules/FirefoxProfileMigrator.jsm',
'esModule': 'resource:///modules/FirefoxProfileMigrator.sys.mjs',
'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'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'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'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'constructor': 'CanaryProfileMigrator',
},
{
'cid': '{3c7f6b7c-baa9-4338-acfa-04bf79f1dcf1}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-edge'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'constructor': 'ChromiumEdgeMigrator',
},
{
'cid': '{0fc3d48a-c1c3-4871-b58f-a8b47d1555fb}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-edge-beta'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'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'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'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'],
'jsm': 'resource:///modules/IEProfileMigrator.jsm',
'esModule': 'resource:///modules/IEProfileMigrator.sys.mjs',
'constructor': 'IEProfileMigrator',
},
{
'cid': '{62e8834b-2d17-49f5-96ff-56344903a2ae}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=edge'],
'jsm': 'resource:///modules/EdgeProfileMigrator.jsm',
'esModule': 'resource:///modules/EdgeProfileMigrator.sys.mjs',
'constructor': 'EdgeProfileMigrator',
},
{
'cid': '{2e1a182e-ce4f-4dc9-a22c-d4125b931552}',
'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium-360se'],
'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
'esModule': 'resource:///modules/ChromeProfileMigrator.sys.mjs',
'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'],
'jsm': 'resource:///modules/SafariProfileMigrator.jsm',
'esModule': 'resource:///modules/SafariProfileMigrator.sys.mjs',
'constructor': 'SafariProfileMigrator',
},
{

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

@ -10,8 +10,8 @@ const kIPStartup = Ci.nsIProfileStartup;
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { MigrationUtils } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
const { MigrationUtils } = ChromeUtils.importESModule(
"resource:///modules/MigrationUtils.sys.mjs"
);
/**

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

@ -17,11 +17,11 @@ XPIDL_SOURCES += [
XPIDL_MODULE = "migration"
EXTRA_JS_MODULES += [
"ChromeMigrationUtils.jsm",
"ChromeProfileMigrator.jsm",
"FirefoxProfileMigrator.jsm",
"MigrationUtils.jsm",
"ProfileMigrator.jsm",
"ChromeMigrationUtils.sys.mjs",
"ChromeProfileMigrator.sys.mjs",
"FirefoxProfileMigrator.sys.mjs",
"MigrationUtils.sys.mjs",
"ProfileMigrator.sys.mjs",
]
if CONFIG["OS_ARCH"] == "WINNT":
@ -33,12 +33,12 @@ if CONFIG["OS_ARCH"] == "WINNT":
"nsIEHistoryEnumerator.cpp",
]
EXTRA_JS_MODULES += [
"360seMigrationUtils.jsm",
"ChromeWindowsLoginCrypto.jsm",
"EdgeProfileMigrator.jsm",
"ESEDBReader.jsm",
"IEProfileMigrator.jsm",
"MSMigrationUtils.jsm",
"360seMigrationUtils.sys.mjs",
"ChromeWindowsLoginCrypto.sys.mjs",
"EdgeProfileMigrator.sys.mjs",
"ESEDBReader.sys.mjs",
"IEProfileMigrator.sys.mjs",
"MSMigrationUtils.sys.mjs",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
@ -46,8 +46,8 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
"nsKeychainMigrationUtils.h",
]
EXTRA_JS_MODULES += [
"ChromeMacOSLoginCrypto.jsm",
"SafariProfileMigrator.jsm",
"ChromeMacOSLoginCrypto.sys.mjs",
"SafariProfileMigrator.sys.mjs",
]
SOURCES += [
"nsKeychainMigrationUtils.mm",

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

@ -1,7 +1,7 @@
"use strict";
var { MigrationUtils, MigratorPrototype } = ChromeUtils.import(
"resource:///modules/MigrationUtils.jsm"
var { MigrationUtils, MigratorPrototype } = ChromeUtils.importESModule(
"resource:///modules/MigrationUtils.sys.mjs"
);
var { LoginHelper } = ChromeUtils.import(
"resource://gre/modules/LoginHelper.jsm"

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

@ -1,7 +1,7 @@
"use strict";
const { Qihoo360seMigrationUtils } = ChromeUtils.import(
"resource:///modules/360seMigrationUtils.jsm"
const { Qihoo360seMigrationUtils } = ChromeUtils.importESModule(
"resource:///modules/360seMigrationUtils.sys.mjs"
);
const parentPath = do_get_file("AppData/Roaming/360se6/User Data").path;

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

@ -1,7 +1,7 @@
"use strict";
const { ChromeMigrationUtils } = ChromeUtils.import(
"resource:///modules/ChromeMigrationUtils.jsm"
const { ChromeMigrationUtils } = ChromeUtils.importESModule(
"resource:///modules/ChromeMigrationUtils.sys.mjs"
);
// Setup chrome user data path for all platforms.

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

@ -3,8 +3,8 @@
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { ChromeMigrationUtils } = ChromeUtils.import(
"resource:///modules/ChromeMigrationUtils.jsm"
const { ChromeMigrationUtils } = ChromeUtils.importESModule(
"resource:///modules/ChromeMigrationUtils.sys.mjs"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");

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

@ -3,8 +3,8 @@
"use strict";
const { ChromeMigrationUtils } = ChromeUtils.import(
"resource:///modules/ChromeMigrationUtils.jsm"
const { ChromeMigrationUtils } = ChromeUtils.importESModule(
"resource:///modules/ChromeMigrationUtils.sys.mjs"
);
const SOURCE_PROFILE_DIR = "Library/Application Support/Google/Chrome/Default/";

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

@ -216,8 +216,8 @@ add_task(async function setup() {
accountName: "TESTING Chrome",
};
if (AppConstants.platform == "macosx") {
let { ChromeMacOSLoginCrypto } = ChromeUtils.import(
"resource:///modules/ChromeMacOSLoginCrypto.jsm"
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeMacOSLoginCrypto(
mockMacOSKeychain.serviceName,
@ -234,8 +234,8 @@ add_task(async function setup() {
"Login Data",
];
} else if (AppConstants.platform == "win") {
let { ChromeWindowsLoginCrypto } = ChromeUtils.import(
"resource:///modules/ChromeWindowsLoginCrypto.jsm"
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
);
loginCrypto = new ChromeWindowsLoginCrypto("Chrome");
dirSvcPath = "AppData/Local/";

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

@ -8,7 +8,7 @@ const {
COLUMN_TYPES,
declareESEFunction,
loadLibraries,
} = ChromeUtils.import("resource:///modules/ESEDBReader.jsm");
} = ChromeUtils.importESModule("resource:///modules/ESEDBReader.sys.mjs");
let gESEInstanceCounter = 1;

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

@ -11,6 +11,7 @@ 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",
@ -20,7 +21,6 @@ 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",

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

@ -13,6 +13,7 @@ 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",
});
@ -31,11 +32,7 @@ XPCOMUtils.defineLazyScriptGetter(
var { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
ChromeUtils.defineModuleGetter(
this,
"MigrationUtils",
"resource:///modules/MigrationUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"DownloadUtils",

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

@ -268,7 +268,7 @@ function shouldRetry(response) {
);
}
// Copied from browser/components/migration/MigrationUtils.jsm
// Copied from browser/components/migration/MigrationUtils.sys.mjs
function spinResolve(promise) {
if (!(promise instanceof Promise)) {
return promise;

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

@ -13,11 +13,14 @@ 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",
});

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

@ -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",
});

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

@ -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.jsm
- browser/components/migration/ChromeProfileMigrator.jsm
- browser/components/migration/ChromeMigrationUtils.sys.mjs
- browser/components/migration/ChromeProfileMigrator.sys.mjs
- browser/components/newtab/data/content/activity-stream.bundle.js
- browser/components/ion/content/ion.js
- browser/components/preferences/privacy.inc.xhtml