Bug 1523179 - Fix Linux Chrome Beta and Chrome Dev migrator support and telemetry. r=Gijs
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 10 Jan 2020 21:13:50 +0000
changeset 509867 b329e8beb91fb010c0e088625cd6b6ef381af06d
parent 509866 408f6c0f98146da1f540d5b6759e4d9a787db8ab
child 509868 e6cf7f793500595f05a7929d8fa0040c72b00692
push id37006
push usercbrindusan@mozilla.com
push dateSun, 12 Jan 2020 09:33:02 +0000
treeherdermozilla-central@119cd111d7d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1523179, 1608269
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523179 - Fix Linux Chrome Beta and Chrome Dev migrator support and telemetry. r=Gijs Symbols exported from a JSM cannot be nested inside an `if` otherwise `undefined` will be exported. I don't think it's worth filing a bug for that considering bug 1608269 is coming. Differential Revision: https://phabricator.services.mozilla.com/D58202
browser/components/migration/ChromeProfileMigrator.jsm
browser/components/migration/MigrationUtils.jsm
browser/components/migration/components.conf
toolkit/components/telemetry/Histograms.json
--- a/browser/components/migration/ChromeProfileMigrator.jsm
+++ b/browser/components/migration/ChromeProfileMigrator.jsm
@@ -613,34 +613,33 @@ CanaryProfileMigrator.prototype.classID 
 
 if (AppConstants.platform == "win" || AppConstants.platform == "macosx") {
   EXPORTED_SYMBOLS.push("CanaryProfileMigrator");
 }
 
 /**
  * Chrome Dev / Unstable and Beta. Only separate from `regular` chrome on Linux
  */
-if (AppConstants.platform != "win" && AppConstants.platform != "macosx") {
-  function ChromeDevMigrator() {
-    this._chromeUserDataPathSuffix = "Chrome Dev";
-  }
-  ChromeDevMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
-  ChromeDevMigrator.prototype.classDescription = "Chrome Dev Profile Migrator";
-  ChromeDevMigrator.prototype.contractID =
-    "@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev";
-  ChromeDevMigrator.prototype.classID = Components.ID(
-    "{7370a02a-4886-42c3-a4ec-d48c726ec30a}"
-  );
+function ChromeDevMigrator() {
+  this._chromeUserDataPathSuffix = "Chrome Dev";
+}
+ChromeDevMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
+ChromeDevMigrator.prototype.classDescription = "Chrome Dev Profile Migrator";
+ChromeDevMigrator.prototype.contractID =
+  "@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev";
+ChromeDevMigrator.prototype.classID = Components.ID(
+  "{7370a02a-4886-42c3-a4ec-d48c726ec30a}"
+);
 
-  function ChromeBetaMigrator() {
-    this._chromeUserDataPathSuffix = "Chrome Beta";
-  }
-  ChromeBetaMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
-  ChromeBetaMigrator.prototype.classDescription =
-    "Chrome Beta Profile Migrator";
-  ChromeBetaMigrator.prototype.contractID =
-    "@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta";
-  ChromeBetaMigrator.prototype.classID = Components.ID(
-    "{47f75963-840b-4950-a1f0-d9c1864f8b8e}"
-  );
+function ChromeBetaMigrator() {
+  this._chromeUserDataPathSuffix = "Chrome Beta";
+}
+ChromeBetaMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
+ChromeBetaMigrator.prototype.classDescription = "Chrome Beta Profile Migrator";
+ChromeBetaMigrator.prototype.contractID =
+  "@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta";
+ChromeBetaMigrator.prototype.classID = Components.ID(
+  "{47f75963-840b-4950-a1f0-d9c1864f8b8e}"
+);
 
+if (AppConstants.platform != "win" && AppConstants.platform != "macosx") {
   EXPORTED_SYMBOLS.push("ChromeDevMigrator", "ChromeBetaMigrator");
 }
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -767,24 +767,17 @@ var MigrationUtils = Object.freeze({
     }
   },
 
   /*
    * Returns the migrator for the given source, if any data is available
    * for this source, or null otherwise.
    *
    * @param aKey internal name of the migration source.
-   *             Supported values: ie (windows),
-   *                               edge (windows),
-   *                               safari (mac),
-   *                               canary (mac/windows),
-   *                               chrome (mac/windows/linux),
-   *                               chromium (mac/windows/linux),
-   *                               360se (windows),
-   *                               firefox.
+   *             See `gAvailableMigratorKeys` for supported values by OS.
    *
    * If null is returned,  either no data can be imported
    * for the given migrator, or aMigratorKey is invalid  (e.g. ie on mac,
    * or mosaic everywhere).  This method should be used rather than direct
    * getService for future compatibility (see bug 718280).
    *
    * @return profile migrator implementing nsIBrowserProfileMigrator, if it can
    *         import any data, null otherwise.
@@ -1292,16 +1285,18 @@ var MigrationUtils = Object.freeze({
   MIGRATION_ENTRYPOINT_FILE_MENU: 6,
 
   _sourceNameToIdMapping: {
     nothing: 1,
     firefox: 2,
     edge: 3,
     ie: 4,
     chrome: 5,
+    "chrome-beta": 5,
+    "chrome-dev": 5,
     chromium: 6,
     canary: 7,
     safari: 8,
     "360se": 9,
   },
   getSourceIdForTelemetry(sourceName) {
     return this._sourceNameToIdMapping[sourceName] || 0;
   },
--- a/browser/components/migration/components.conf
+++ b/browser/components/migration/components.conf
@@ -44,23 +44,23 @@ if XP_WIN or XP_MACOSX:
         },
     ]
 else:
     Classes += [
         {
             'cid': '{47f75963-840b-4950-a1f0-d9c1864f8b8e}',
             'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta'],
             'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
-            'constructor': '  ChromeBetaMigrator',
+            'constructor': 'ChromeBetaMigrator',
         },
         {
             'cid': '{7370a02a-4886-42c3-a4ec-d48c726ec30a}',
             'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev'],
             'jsm': 'resource:///modules/ChromeProfileMigrator.jsm',
-            'constructor': '  ChromeDevMigrator',
+            'constructor': 'ChromeDevMigrator',
         },
     ]
 
 if XP_WIN:
     Classes += [
         {
             'cid': '{3d2532e3-4932-4774-b7ba-968f5899d3a4}',
             'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=ie'],
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7048,19 +7048,19 @@
     "kind": "enumerated",
     "n_values": 10,
     "releaseChannelCollection": "opt-out",
     "description": "Where the migration wizard was entered from. 0=Other/catch-all, 1=first-run, 2=refresh-firefox, 3=Places window, 4=Password manager, 5=New tab, 6=File menu"
   },
   "FX_MIGRATION_SOURCE_BROWSER": {
     "record_in_processes": ["main"],
     "products": ["firefox"],
-    "bug_numbers": [731025],
-    "alert_emails": ["gijs@mozilla.com"],
-    "expires_in_version": "65",
+    "bug_numbers": [731025, 1523179],
+    "alert_emails": ["gijs@mozilla.com", "MattN+telemetry@mozilla.com"],
+    "expires_in_version": "80",
     "kind": "enumerated",
     "n_values": 15,
     "releaseChannelCollection": "opt-out",
     "description": "The browser that data is pulled from. The values correspond to the internal browser ID (see MigrationUtils.jsm)"
   },
   "FX_MIGRATION_ERRORS": {
     "record_in_processes": ["main"],
     "products": ["firefox"],