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 353564 5be69f2ff0164ed5e53ac7fd70f88b220a1d6ade
parent 353563 21a5859e934a4aef578bb8ad0595cac0416164a6
child 353565 1e322cd9c7410917d4c5f1fa5b2cd78eb4a79ec6
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, lizzard
bugs1330384
milestone52.0a2
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});