Bug 1330384 - force a refresh of the new tab page after automigration undo, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 12 Jan 2017 16:00:27 +0000
changeset 459733 3afd5bf9784e8e47093529af379d62fe01b99bc5
parent 459677 1289b60bd5ed221f6713497fcdc8167ae3896916
child 541996 0a17ce98d026ba6e8d5ffec07714c90d7ce2fd8e
push id41330
push userbmo:gijskruitbosch+bugs@gmail.com
push dateThu, 12 Jan 2017 17:40:43 +0000
reviewersjaws
bugs1330384
milestone53.0a1
Bug 1330384 - force a refresh of the new tab page after automigration undo, r?jaws 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});