Bug 1283267 - save start time of automigration when we save the finished time, to ensure both actually get written to prefs, r=dolske FUNNELCAKE86_BRANCH
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 29 Jun 2016 20:59:23 +0100
branchFUNNELCAKE86_BRANCH
changeset 326427 19013be2644d2ab0368cab1df38e6bee415e6f36
parent 326426 7e9d07aa236143ecbb4aae49917e20cf5d68fadb
child 326428 7c68bc7de10f9411929f0585f399a87bee35c2ac
push id1143
push usernthomas@mozilla.com
push dateTue, 05 Jul 2016 23:40:05 +0000
treeherdermozilla-release@0cc1138c8b72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1283267
milestone47.0.1
Bug 1283267 - save start time of automigration when we save the finished time, to ensure both actually get written to prefs, r=dolske MozReview-Commit-ID: J5dBIUh7nym
browser/components/migration/AutoMigrate.jsm
--- a/browser/components/migration/AutoMigrate.jsm
+++ b/browser/components/migration/AutoMigrate.jsm
@@ -51,23 +51,26 @@ const AutoMigrate = {
         sawErrors = true;
       } else if (topic == "Migration:Ended") {
         histogram.add(25);
         if (sawErrors) {
           histogram.add(26);
         }
         Services.obs.removeObserver(migrationObserver, "Migration:Ended");
         Services.obs.removeObserver(migrationObserver, "Migration:ItemError");
+        Services.prefs.setCharPref(kAutoMigrateStartedPref, startTime.toString());
         Services.prefs.setCharPref(kAutoMigrateFinishedPref, Date.now().toString());
       }
     };
 
     Services.obs.addObserver(migrationObserver, "Migration:Ended", false);
     Services.obs.addObserver(migrationObserver, "Migration:ItemError", false);
-    Services.prefs.setCharPref(kAutoMigrateStartedPref, Date.now().toString());
+    // We'll save this when the migration has finished, at which point the pref
+    // service will be available.
+    let startTime = Date.now();
     migrator.migrate(this.resourceTypesToUse, profileStartup, profileToMigrate);
     histogram.add(20);
   },
 
   /**
    * Pick and return a migrator to use for automatically migrating.
    *
    * @param {String} migratorKey   optional, a migrator key to prefer/pick.