Bug 1469823 - Update Activity Stream TopSites after deleting a tile. r=Mardak draft
authorAndrei Oprea <andrei.br92@gmail.com>
Mon, 02 Jul 2018 15:15:35 +0200
changeset 813122 ea7ee513c471e596b5108bbb7062ae8c0488a36f
parent 813121 b3c421efe45f058fed30bb82aed344050eef37ec
push id114775
push userbmo:andrei.br92@gmail.com
push dateMon, 02 Jul 2018 13:16:20 +0000
reviewersMardak
bugs1469823
milestone62.0
Bug 1469823 - Update Activity Stream TopSites after deleting a tile. r=Mardak MozReview-Commit-ID: IExiS1hhODv
browser/extensions/activity-stream/install.rdf.in
browser/extensions/activity-stream/lib/TopSitesFeed.jsm
browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
--- a/browser/extensions/activity-stream/install.rdf.in
+++ b/browser/extensions/activity-stream/install.rdf.in
@@ -3,17 +3,17 @@
 #filter substitution
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>activity-stream@mozilla.org</em:id>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
     <em:unpack>false</em:unpack>
-    <em:version>2018.06.21.1244-eca5e987</em:version>
+    <em:version>2018.07.02.0793-afca06e1</em:version>
     <em:name>Activity Stream</em:name>
     <em:description>A rich visual history feed and a reimagined home page make it easier than ever to find exactly what you're looking for in Firefox.</em:description>
     <em:multiprocessCompatible>true</em:multiprocessCompatible>
 
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
         <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
--- a/browser/extensions/activity-stream/lib/TopSitesFeed.jsm
+++ b/browser/extensions/activity-stream/lib/TopSitesFeed.jsm
@@ -390,16 +390,17 @@ this.TopSitesFeed = class TopSitesFeed {
         this.init();
         break;
       case at.SYSTEM_TICK:
         this.refresh({broadcast: false});
         break;
       // All these actions mean we need new top sites
       case at.MIGRATION_COMPLETED:
       case at.PLACES_HISTORY_CLEARED:
+      case at.PLACES_LINK_DELETED:
         this.frecentCache.expire();
         this.refresh({broadcast: true});
         break;
       case at.PLACES_LINKS_CHANGED:
         this.frecentCache.expire();
         this.refresh({broadcast: false});
         break;
       case at.PLACES_LINK_BLOCKED:
--- a/browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
+++ b/browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
@@ -758,16 +758,24 @@ describe("Top Sites Feed", () => {
     it("should call refresh without a target if we clear history with PLACES_HISTORY_CLEARED", () => {
       sandbox.stub(feed, "refresh");
 
       feed.onAction({type: at.PLACES_HISTORY_CLEARED});
 
       assert.calledOnce(feed.refresh);
       assert.calledWithExactly(feed.refresh, {broadcast: true});
     });
+    it("should call refresh without a target if we remove a Topsite from history", () => {
+      sandbox.stub(feed, "refresh");
+
+      feed.onAction({type: at.PLACES_LINK_DELETED});
+
+      assert.calledOnce(feed.refresh);
+      assert.calledWithExactly(feed.refresh, {broadcast: true});
+    });
     it("should still dispatch an action even if there's no target provided", async () => {
       sandbox.stub(feed, "_fetchIcon");
       await feed.refresh({broadcast: true});
       assert.calledOnce(feed.store.dispatch);
       assert.propertyVal(feed.store.dispatch.firstCall.args[0], "type", at.TOP_SITES_UPDATED);
     });
     it("should call init on INIT action", async () => {
       sinon.stub(feed, "init");