Backed out 2 changesets (bug 1818237) for causing mochitest/xpc failures on browser/components/migration/<...>.js CLOSED TREE

Backed out changeset a8584f57dc7c (bug 1818237)
Backed out changeset 477292e081b3 (bug 1818237)
This commit is contained in:
Sandor Molnar
2023-10-11 09:32:23 +03:00
parent db7c1a262a
commit 3a1563107d
22 changed files with 95 additions and 1202 deletions

View File

@@ -167,11 +167,6 @@ export class MigrationWizardParent extends JSWindowActorParent {
this.#openAboutAddons(browser);
break;
}
case "GetPermissions": {
let migrator = await MigrationUtils.getMigrator(message.data.key);
return migrator.getPermissions(this.browsingContext.topChromeWindow);
}
}
return null;
@@ -584,21 +579,6 @@ export class MigrationWizardParent extends JSWindowActorParent {
return null;
}
if (!(await migrator.hasPermissions())) {
// If we're unable to get permissions for this migrator, then we
// just don't bother showing it.
let permissionsPath = await migrator.canGetPermissions();
if (!permissionsPath) {
return null;
}
return this.#serializeMigratorAndProfile(
migrator,
null,
false /* hasPermissions */,
permissionsPath
);
}
let sourceProfiles = await migrator.getSourceProfiles();
if (Array.isArray(sourceProfiles)) {
if (!sourceProfiles.length) {
@@ -644,23 +624,9 @@ export class MigrationWizardParent extends JSWindowActorParent {
* The user profile object representing the profile to get information
* about. This object is usually gotten by calling getSourceProfiles on
* the migrator.
* @param {boolean} [hasPermissions=true]
* Whether or not the migrator has permission to read the data for the
* other browser. It is expected that the caller will have already
* computed this by calling hasPermissions() on the migrator, and
* passing the result into this method. This is true by default.
* @param {string} [permissionsPath=undefined]
* The path that the selected migrator needs read access to in order to
* do a migration, in the event that hasPermissions is false. This is
* undefined if hasPermissions is true.
* @returns {Promise<MigratorProfileInstance>}
*/
async #serializeMigratorAndProfile(
migrator,
profileObj,
hasPermissions = true,
permissionsPath
) {
async #serializeMigratorAndProfile(migrator, profileObj) {
let [profileMigrationData, lastModifiedDate] = await Promise.all([
migrator.getMigrateData(profileObj),
migrator.getLastUsedDate(),
@@ -668,27 +634,25 @@ export class MigrationWizardParent extends JSWindowActorParent {
let availableResourceTypes = [];
if (hasPermissions) {
for (let resourceType in MigrationUtils.resourceTypes) {
// Normally, we check each possible resourceType to see if we have one or
// more corresponding resourceTypes in profileMigrationData. The exception
// is for Safari, where the migrator does not expose a PASSWORDS resource
// type, but we allow the user to express that they'd like to import
// passwords from it anyways. This is because the Safari migration flow is
// special, and allows the user to import passwords from a file exported
// from Safari.
if (
profileMigrationData & MigrationUtils.resourceTypes[resourceType] ||
(migrator.constructor.key == lazy.SafariProfileMigrator?.key &&
MigrationUtils.resourceTypes[resourceType] ==
MigrationUtils.resourceTypes.PASSWORDS &&
Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled",
false
))
) {
availableResourceTypes.push(resourceType);
}
for (let resourceType in MigrationUtils.resourceTypes) {
// Normally, we check each possible resourceType to see if we have one or
// more corresponding resourceTypes in profileMigrationData. The exception
// is for Safari, where the migrator does not expose a PASSWORDS resource
// type, but we allow the user to express that they'd like to import
// passwords from it anyways. This is because the Safari migration flow is
// special, and allows the user to import passwords from a file exported
// from Safari.
if (
profileMigrationData & MigrationUtils.resourceTypes[resourceType] ||
(migrator.constructor.key == lazy.SafariProfileMigrator?.key &&
MigrationUtils.resourceTypes[resourceType] ==
MigrationUtils.resourceTypes.PASSWORDS &&
Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled",
false
))
) {
availableResourceTypes.push(resourceType);
}
}
@@ -713,8 +677,6 @@ export class MigrationWizardParent extends JSWindowActorParent {
resourceTypes: availableResourceTypes,
profile: profileObj,
lastModifiedDate,
hasPermissions,
permissionsPath,
};
}