Bug 1434167 - remove home page code from the migration wizard, r?MattN draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 07 Feb 2018 10:37:20 +0000
changeset 751982 0fd9a21e6313813be53033c9699969882c41ac1b
parent 751980 dff816a6ed8b53de2b88b39275c7996d657295f5
push id98120
push usergijskruitbosch@gmail.com
push dateWed, 07 Feb 2018 10:48:06 +0000
reviewersMattN
bugs1434167
milestone60.0a1
Bug 1434167 - remove home page code from the migration wizard, r?MattN This removes all the homepage-related code. All the cases where we advance the wizard straight to the homepage wizardpage now go straight to the 'start migrating' page (the 'point' was skipping earlier pages that allowed users to select items). The brand bundle was only used by the homepage code so is also being removed. MozReview-Commit-ID: I9nSU2IMkQz
browser/branding/official/locales/en-US/brand.properties
browser/components/migration/content/migration.js
browser/components/migration/content/migration.xul
toolkit/components/telemetry/Histograms.json
--- a/browser/branding/official/locales/en-US/brand.properties
+++ b/browser/branding/official/locales/en-US/brand.properties
@@ -2,15 +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/.
 
 brandShorterName=Firefox
 brandShortName=Firefox
 brandFullName=Mozilla Firefox
 vendorShortName=Mozilla
 
-homePageSingleStartMain=Firefox Start, a fast home page with built-in search
-homePageImport=Import your home page from %S
-
-homePageMigrationPageTitle=Home Page Selection
-homePageMigrationDescription=Please select the home page you wish to use:
-
 syncBrandShortName=Sync
--- a/browser/components/migration/content/migration.js
+++ b/browser/components/migration/content/migration.js
@@ -171,22 +171,22 @@ var MigrationWizard = { /* exported Migr
       this._itemsFlags = kIMig.ALL;
       this._selectedProfile = null;
     }
     this._source = newSource;
 
     // check for more than one source profile
     var sourceProfiles = this.spinResolve(this._migrator.getSourceProfiles());
     if (this._skipImportSourcePage) {
-      this._wiz.currentPage.next = "homePageImport";
+      this._wiz.currentPage.next = "migrating";
     } else if (sourceProfiles && sourceProfiles.length > 1) {
       this._wiz.currentPage.next = "selectProfile";
     } else {
       if (this._autoMigrate)
-        this._wiz.currentPage.next = "homePageImport";
+        this._wiz.currentPage.next = "migrating";
       else
         this._wiz.currentPage.next = "importItems";
 
       if (sourceProfiles && sourceProfiles.length == 1)
         this._selectedProfile = sourceProfiles[0];
       else
         this._selectedProfile = null;
     }
@@ -232,17 +232,17 @@ var MigrationWizard = { /* exported Migr
     var profiles = document.getElementById("profiles");
     let sourceProfiles = this.spinResolve(this._migrator.getSourceProfiles());
     this._selectedProfile = sourceProfiles.find(
       profile => profile.id == profiles.selectedItem.id
     ) || null;
 
     // If we're automigrating or just doing bookmarks don't show the item selection page
     if (this._autoMigrate)
-      this._wiz.currentPage.next = "homePageImport";
+      this._wiz.currentPage.next = "migrating";
   },
 
   // 3 - ImportItems
   onImportItemsPageShow() {
     var dataSources = document.getElementById("dataSources");
     while (dataSources.hasChildNodes())
       dataSources.firstChild.remove();
 
@@ -287,76 +287,17 @@ var MigrationWizard = { /* exported Migr
         oneChecked = true;
         break;
       }
     }
 
     this._wiz.canAdvance = oneChecked;
   },
 
-  // 4 - Home Page Selection
-  onHomePageMigrationPageShow() {
-    // only want this on the first run
-    if (!this._autoMigrate) {
-      this._wiz.advance();
-      return;
-    }
-
-    var brandBundle = document.getElementById("brandBundle");
-    var pageTitle, pageDesc, mainStr;
-    // These strings don't exist when not using official branding. If that's
-    // the case, just skip this page.
-    try {
-      pageTitle = brandBundle.getString("homePageMigrationPageTitle");
-      pageDesc = brandBundle.getString("homePageMigrationDescription");
-      mainStr = brandBundle.getString("homePageSingleStartMain");
-    } catch (e) {
-      this._wiz.advance();
-      return;
-    }
-
-    document.getElementById("homePageImport").setAttribute("label", pageTitle);
-    document.getElementById("homePageImportDesc").setAttribute("value", pageDesc);
-
-    this._wiz._adjustWizardHeader();
-
-    var singleStart = document.getElementById("homePageSingleStart");
-    singleStart.setAttribute("label", mainStr);
-    singleStart.setAttribute("value", "DEFAULT");
-
-    var appName = MigrationUtils.getBrowserName(this._source);
-
-    // semi-wallpaper for crash when multiple profiles exist, since we haven't initialized mSourceProfile in places
-    this.spinResolve(this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate));
-
-    var oldHomePageURL = null;
-
-    if (oldHomePageURL && appName) {
-      var oldHomePageLabel =
-        brandBundle.getFormattedString("homePageImport", [appName]);
-      var oldHomePage = document.getElementById("oldHomePage");
-      oldHomePage.setAttribute("label", oldHomePageLabel);
-      oldHomePage.setAttribute("value", oldHomePageURL);
-      oldHomePage.removeAttribute("hidden");
-    } else {
-      // if we don't have at least two options, just advance
-      this._wiz.advance();
-    }
-  },
-
-  onHomePageMigrationPageAdvanced() {
-    // we might not have a selectedItem if we're in fallback mode
-    try {
-      var radioGroup = document.getElementById("homePageRadiogroup");
-
-      this._newHomePage = radioGroup.selectedItem.value;
-    } catch (ex) {}
-  },
-
-  // 5 - Migrating
+  // 4 - Migrating
   onMigratingPageShow() {
     this._wiz.getButton("cancel").disabled = true;
     this._wiz.canRewind = false;
     this._wiz.canAdvance = false;
 
     // When automigrating, show all of the data that can be received from this source.
     if (this._autoMigrate) {
       this._itemsFlags =
@@ -431,37 +372,16 @@ var MigrationWizard = { /* exported Migr
           // Ensure errors in reporting data recency do not affect the rest of the migration.
           try {
             this.reportDataRecencyTelemetry();
           } catch (ex) {
             Cu.reportError(ex);
           }
         }
         if (this._autoMigrate) {
-          let hasImportedHomepage = !!(this._newHomePage && this._newHomePage != "DEFAULT");
-          Services.telemetry.getKeyedHistogramById("FX_MIGRATION_IMPORTED_HOMEPAGE")
-                            .add(this._source, hasImportedHomepage);
-          if (this._newHomePage) {
-            try {
-              // set homepage properly
-              if (this._newHomePage == "DEFAULT") {
-                Services.prefs.clearUserPref("browser.startup.homepage");
-              } else {
-                Services.prefs.setStringPref("browser.startup.homepage",
-                                             this._newHomePage);
-              }
-
-              var prefFile = Services.dirsvc.get("ProfDS", Components.interfaces.nsIFile);
-              prefFile.append("prefs.js");
-              Services.prefs.savePrefFile(prefFile);
-            } catch (ex) {
-              dump(ex);
-            }
-          }
-
           // We're done now.
           this._wiz.canAdvance = true;
           this._wiz.advance();
 
           setTimeout(close, 5000);
         } else {
           this._wiz.canAdvance = true;
           var nextButton = this._wiz.getButton("next");
--- a/browser/components/migration/content/migration.xul
+++ b/browser/components/migration/content/migration.xul
@@ -14,18 +14,16 @@
         onload="MigrationWizard.init()"
         onunload="MigrationWizard.uninit()"
         style="width: 40em;"
         buttons="accept,cancel"
         branded="true">
 
   <script type="application/javascript" src="chrome://browser/content/migration/migration.js"/>
 
-  <stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
-
   <wizardpage id="importSource" pageid="importSource" next="selectProfile"
               label="&importSource.title;"
               onpageadvanced="return MigrationWizard.onImportSourcePageAdvanced();">
 #ifdef XP_WIN
     <description id="importAll" control="importSourceGroup">&importFrom.label;</description>
 #else
     <description id="importAll" control="importSourceGroup">&importFromUnix.label;</description>
 #endif
@@ -63,38 +61,26 @@
               onpagerewound="return MigrationWizard.onSelectProfilePageRewound();"
               onpageadvanced="return MigrationWizard.onSelectProfilePageAdvanced();">
     <description control="profiles">&selectProfile.label;</description>
 
     <radiogroup id="profiles" align="left"/>
   </wizardpage>
 
   <wizardpage id="importItems" pageid="importItems" label="&importItems.title;"
-              next="homePageImport"
+              next="migrating"
               onpageshow="return MigrationWizard.onImportItemsPageShow();"
               onpagerewound="return MigrationWizard.onImportItemsPageRewound();"
               onpageadvanced="return MigrationWizard.onImportItemsPageAdvanced();"
               oncommand="MigrationWizard.onImportItemCommand();">
     <description control="dataSources">&importItems.label;</description>
 
     <vbox id="dataSources" style="overflow: auto; -moz-appearance: listbox" align="left" flex="1" role="group"/>
   </wizardpage>
 
-  <wizardpage id="homePageImport" pageid="homePageImport"
-              next="migrating"
-              onpageshow="return MigrationWizard.onHomePageMigrationPageShow();"
-              onpageadvanced="return MigrationWizard.onHomePageMigrationPageAdvanced();">
-
-    <description id="homePageImportDesc" control="homePageRadioGroup"/>
-    <radiogroup id="homePageRadiogroup">
-      <radio id="homePageSingleStart" selected="true" />
-      <radio id="oldHomePage" hidden="true" />
-    </radiogroup>
-  </wizardpage>
-
   <wizardpage id="migrating" pageid="migrating" label="&migrating.title;"
               next="done"
               onpageshow="MigrationWizard.onMigratingPageShow();">
     <description control="migratingItems">&migrating.label;</description>
 
     <vbox id="migratingItems" style="overflow: auto;" align="left" role="group"/>
   </wizardpage>
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -6255,26 +6255,16 @@
     "alert_emails": ["gijs@mozilla.com"],
     "expires_in_version": "65",
     "kind": "enumerated",
     "keyed": true,
     "n_values": 12,
     "releaseChannelCollection": "opt-out",
     "description": "Usage of migration for each datatype when migration is run through the post-firstrun flow which allows individual datatypes, keyed by the string description of the browser."
   },
-  "FX_MIGRATION_IMPORTED_HOMEPAGE": {
-    "record_in_processes": ["main", "content"],
-    "bug_numbers": [731025, 1298208],
-    "alert_emails": ["gijs@mozilla.com"],
-    "expires_in_version": "65",
-    "kind": "boolean",
-    "keyed": true,
-    "releaseChannelCollection": "opt-out",
-    "description": "Whether the homepage was imported during browser migration. Only available on release builds during firstrun."
-  },
   "FX_MIGRATION_BOOKMARKS_IMPORT_MS": {
     "record_in_processes": ["main", "content"],
     "bug_numbers": [1289436],
     "alert_emails": ["gijs@mozilla.com"],
     "expires_in_version": "65",
     "kind": "exponential",
     "n_buckets": 70,
     "high": 100000,