Bug 1330384 - Force a refresh of the new tab page after automigration undo. r=jaws, a=lizzard
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 12 Jan 2017 16:00:27 +0000
changeset 357187 1fd589b5962b86e4df07fcffa98d44b75e4561a7
parent 357186 f4fd63a8302cc1045462a06827ac4cbe224f9079
child 357188 09142d07fd735e375fc1ae46886a52d6aef43b60
push id6776
push userryanvm@gmail.com
push dateThu, 12 Jan 2017 22:43:57 +0000
treeherdermozilla-beta@1fd589b5962b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, lizzard
bugs1330384
milestone51.0
Bug 1330384 - Force a refresh of the new tab page after automigration undo. r=jaws, a=lizzard MozReview-Commit-ID: KoqbAgPkcLC
browser/components/migration/AutoMigrate.jsm
--- a/browser/components/migration/AutoMigrate.jsm
+++ b/browser/components/migration/AutoMigrate.jsm
@@ -26,16 +26,18 @@ Cu.import("resource://gre/modules/XPCOMU
 XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
                                   "resource://gre/modules/AsyncShutdown.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
                                   "resource://gre/modules/LoginHelper.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "OS",
                                   "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
                                   "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
+                                  "resource://gre/modules/NewTabUtils.jsm");
 
 Cu.importGlobalProperties(["URL"]);
 
 /* globals kUndoStateFullPath */
 XPCOMUtils.defineLazyGetter(this, "kUndoStateFullPath", function() {
   return OS.Path.join(OS.Constants.Path.profileDir, "initialMigrationMetadata.jsonlz4");
 });
 
@@ -206,16 +208,21 @@ const AutoMigrate = {
     histogram.add(15);
 
     yield this._removeSomeVisits(stateData.get("visits"));
     histogram.add(20);
 
     yield this._removeUnchangedLogins(stateData.get("logins"));
     histogram.add(25);
 
+    // This is async, but no need to wait for it.
+    NewTabUtils.links.populateCache(() => {
+      NewTabUtils.allPages.update();
+    }, true);
+
     this.removeUndoOption(this.UNDO_REMOVED_REASON_UNDO_USED);
     histogram.add(30);
   }),
 
   removeUndoOption(reason) {
     // We don't wait for the off-main-thread removal to complete. OS.File will
     // ensure it happens before shutdown.
     OS.File.remove(kUndoStateFullPath, {ignoreAbsent: true});