diff --git a/browser/components/migration/MigrationUtils.sys.mjs b/browser/components/migration/MigrationUtils.sys.mjs index 6542e0b579d8..ab65612fe2f9 100644 --- a/browser/components/migration/MigrationUtils.sys.mjs +++ b/browser/components/migration/MigrationUtils.sys.mjs @@ -618,6 +618,15 @@ class MigrationUtils { }; if (aOptions.isStartupMigration) { + // Record that the uninstaller requested a profile refresh + if (Services.env.get("MOZ_UNINSTALLER_PROFILE_REFRESH")) { + Services.env.set("MOZ_UNINSTALLER_PROFILE_REFRESH", ""); + Services.telemetry.scalarSet( + "migration.uninstaller_profile_refresh", + true + ); + } + openStandaloneWindow(true /* blocking */); return Promise.resolve(); } diff --git a/browser/components/migration/MigrationWizardParent.sys.mjs b/browser/components/migration/MigrationWizardParent.sys.mjs index c8ac3d54cb7f..9f43c6e1f915 100644 --- a/browser/components/migration/MigrationWizardParent.sys.mjs +++ b/browser/components/migration/MigrationWizardParent.sys.mjs @@ -98,13 +98,6 @@ export class MigrationWizardParent extends JSWindowActorParent { return b.lastModifiedDate - a.lastModifiedDate; }); - for (let result of filteredResults) { - Services.telemetry.keyedScalarAdd( - "migration.discovered_migrators", - result.key, - 1 - ); - } return filteredResults; } @@ -117,6 +110,7 @@ export class MigrationWizardParent extends JSWindowActorParent { message.data.key, message.data.resourceTypes, message.data.profile, + message.data.autoMigration, message.data.safariPasswordFilePath ); } else if ( @@ -310,6 +304,9 @@ export class MigrationWizardParent extends JSWindowActorParent { * A unique ID for the user profile. * @param {string} profileObj.name * The display name for the user profile. + * @param {boolean} autoMigration + * True if the migration is occurring automatically, without the user + * having selected any items explicitly from the wizard. * @param {string} [safariPasswordFilePath=null] * An optional string argument that points to the path of a passwords * export file from Safari. This file will have password imported from if @@ -322,12 +319,19 @@ export class MigrationWizardParent extends JSWindowActorParent { migratorKey, resourceTypeNames, profileObj, + autoMigration, safariPasswordFilePath = null ) { + Services.telemetry + .getHistogramById("FX_MIGRATION_SOURCE_BROWSER") + .add(MigrationUtils.getSourceIdForTelemetry(migratorKey)); + let migrator = await MigrationUtils.getMigrator(migratorKey); let availableResourceTypes = await migrator.getMigrateData(profileObj); let resourceTypesToMigrate = 0; let progress = {}; + let migrationUsageHist = + Services.telemetry.getKeyedHistogramById("FX_MIGRATION_USAGE"); for (let resourceTypeName of resourceTypeNames) { let resourceType = MigrationUtils.resourceTypes[resourceTypeName]; @@ -337,6 +341,10 @@ export class MigrationWizardParent extends JSWindowActorParent { inProgress: true, message: "", }; + + if (!autoMigration) { + migrationUsageHist.add(migratorKey, Math.log2(resourceType)); + } } } @@ -387,7 +395,7 @@ export class MigrationWizardParent extends JSWindowActorParent { resourceTypesToMigrate, false, profileObj, - async resourceTypeNum => { + async (resourceTypeNum, success) => { // Unfortunately, MigratorBase hands us the the numeric value of the // MigrationUtils.resourceType for this callback. For now, we'll just // do a look-up to map it to the right constant. @@ -407,6 +415,11 @@ export class MigrationWizardParent extends JSWindowActorParent { resourceTypeNum ); } else { + if (!success) { + Services.telemetry + .getKeyedHistogramById("FX_MIGRATION_ERRORS") + .add(migratorKey, Math.log2(resourceTypeNum)); + } // For now, we ignore errors in migration, and simply display // the success state. progress[foundResourceTypeName] = { @@ -475,6 +488,12 @@ export class MigrationWizardParent extends JSWindowActorParent { return null; } + Services.telemetry.keyedScalarAdd( + "migration.discovered_migrators", + key, + sourceProfiles.length + ); + let result = []; for (let profile of sourceProfiles) { result.push( @@ -483,6 +502,12 @@ export class MigrationWizardParent extends JSWindowActorParent { } return result; } + + Services.telemetry.keyedScalarAdd( + "migration.discovered_migrators", + key, + 1 + ); return this.#serializeMigratorAndProfile(migrator, sourceProfiles); } catch (e) { console.error(`Could not get migrator with key ${key}`, e); diff --git a/browser/components/migration/MigratorBase.sys.mjs b/browser/components/migration/MigratorBase.sys.mjs index b7ae6de78d2e..2a4894786b99 100644 --- a/browser/components/migration/MigratorBase.sys.mjs +++ b/browser/components/migration/MigratorBase.sys.mjs @@ -266,7 +266,8 @@ export class MigratorBase { * @param {Function|null} aProgressCallback * An optional callback that will be fired once a resourceType has finished * migrating. The callback will be passed the numeric representation of the - * resource type. + * resource type followed by a boolean indicating whether or not the resource + * was migrated successfully. */ async migrate(aItems, aStartup, aProfile, aProgressCallback = () => {}) { let resources = await this.#getMaybeCachedResources(aProfile); @@ -438,7 +439,7 @@ export class MigratorBase { ); collectMigrationTelemetry(migrationType); - aProgressCallback(migrationType); + aProgressCallback(migrationType, itemSuccess); resourcesGroupedByItems.delete(migrationType); diff --git a/browser/components/migration/content/migration-wizard.mjs b/browser/components/migration/content/migration-wizard.mjs index 860c1f88a727..5082956e1040 100644 --- a/browser/components/migration/content/migration-wizard.mjs +++ b/browser/components/migration/content/migration-wizard.mjs @@ -872,7 +872,9 @@ export class MigrationWizard extends HTMLElement { /** * Pulls information from the DOM state of the MigrationWizard and constructs * and returns an object that can be used to begin migration via and event - * sent to the MigrationWizardChild. + * sent to the MigrationWizardChild. This method should only be called when + * the user has made selections within the wizard, but not if an + * automatic migration is occurring. * * @param {object} [autoMigrationDetails=null] * Provided iff an automatic migration is being invoked. In that case, the @@ -898,6 +900,7 @@ export class MigrationWizard extends HTMLElement { resourceTypes, hasPermissions: true, expandedDetails: this.#expandedDetails, + autoMigration: true, }; } @@ -924,6 +927,7 @@ export class MigrationWizard extends HTMLElement { resourceTypes, hasPermissions, expandedDetails: this.#expandedDetails, + autoMigration: false, }; }