Bug 1199077 - Activity Stream changes for new bookmark change sources. r=ursula draft
authorKit Cambridge <kit@yakshaving.ninja>
Wed, 21 Feb 2018 19:19:34 -0800
changeset 765148 7050621de8e36160457633b9eff2d4ccc3582c29
parent 765147 f6691e30218f4492c6ec4dfcc2586b2256e692de
child 765149 ac0d8657b68ce37e4f4829d1d2bee68d8760ea9d
push id101984
push userbmo:kit@mozilla.com
push dateFri, 09 Mar 2018 06:22:41 +0000
reviewersursula
bugs1199077
milestone60.0a1
Bug 1199077 - Activity Stream changes for new bookmark change sources. r=ursula MozReview-Commit-ID: 4nrBB3UwVWi
browser/extensions/activity-stream/lib/PlacesFeed.jsm
browser/extensions/activity-stream/test/unit/lib/PlacesFeed.test.js
--- a/browser/extensions/activity-stream/lib/PlacesFeed.jsm
+++ b/browser/extensions/activity-stream/lib/PlacesFeed.jsm
@@ -108,17 +108,17 @@ class BookmarksObserver extends Observer
    * @param  {str} parent guid
    * @param  {int} source    Used to distinguish bookmarks made by different
    *                         actions: sync, bookmarks import, other.
    */
   onItemAdded(id, folderId, index, type, uri, bookmarkTitle, dateAdded, bookmarkGuid, parentGuid, source) { // eslint-disable-line max-params
     // Skips items that are not bookmarks (like folders), about:* pages or
     // default bookmarks, added when the profile is created.
     if (type !== PlacesUtils.bookmarks.TYPE_BOOKMARK ||
-        source === PlacesUtils.bookmarks.SOURCES.IMPORT_REPLACE ||
+        source === PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP ||
         (uri.scheme !== "http" && uri.scheme !== "https")) {
       return;
     }
     this.dispatch({
       type: at.PLACES_BOOKMARK_ADDED,
       data: {
         bookmarkGuid,
         bookmarkTitle,
--- a/browser/extensions/activity-stream/test/unit/lib/PlacesFeed.test.js
+++ b/browser/extensions/activity-stream/test/unit/lib/PlacesFeed.test.js
@@ -2,17 +2,17 @@ import {actionTypes as at} from "common/
 import {GlobalOverrider} from "test/unit/utils";
 import {PlacesFeed} from "lib/PlacesFeed.jsm";
 const {HistoryObserver, BookmarksObserver} = PlacesFeed;
 
 const FAKE_BOOKMARK = {bookmarkGuid: "xi31", bookmarkTitle: "Foo", dateAdded: 123214232, url: "foo.com"};
 const TYPE_BOOKMARK = 0; // This is fake, for testing
 const SOURCES = {
   DEFAULT: 0,
-  IMPORT_REPLACE: 3
+  RESTORE_ON_STARTUP: 6
 };
 
 const BLOCKED_EVENT = "newtab-linkBlocked"; // The event dispatched in NewTabUtils when a link is blocked;
 
 describe("PlacesFeed", () => {
   let globals;
   let sandbox;
   let feed;
@@ -349,21 +349,21 @@ describe("PlacesFeed", () => {
         // Yes, onItemAdded has at least 8 arguments. See function definition for docs.
         const args = [null, null, null, TYPE_BOOKMARK,
           {spec: FAKE_BOOKMARK.url, scheme: "places"}, FAKE_BOOKMARK.bookmarkTitle,
           FAKE_BOOKMARK.dateAdded, FAKE_BOOKMARK.bookmarkGuid, "", SOURCES.DEFAULT];
         await observer.onItemAdded(...args);
 
         assert.notCalled(dispatch);
       });
-      it("should not dispatch a PLACES_BOOKMARK_ADDED action - has IMPORT_REPLACE source", async () => {
+      it("should not dispatch a PLACES_BOOKMARK_ADDED action - has IMPORT_RESTORE_ON_STARTUP source", async () => {
         // Yes, onItemAdded has at least 8 arguments. See function definition for docs.
         const args = [null, null, null, TYPE_BOOKMARK,
           {spec: FAKE_BOOKMARK.url, scheme: "http"}, FAKE_BOOKMARK.bookmarkTitle,
-          FAKE_BOOKMARK.dateAdded, FAKE_BOOKMARK.bookmarkGuid, "", SOURCES.IMPORT_REPLACE];
+          FAKE_BOOKMARK.dateAdded, FAKE_BOOKMARK.bookmarkGuid, "", SOURCES.RESTORE_ON_STARTUP];
         await observer.onItemAdded(...args);
 
         assert.notCalled(dispatch);
       });
       it("should ignore events that are not of TYPE_BOOKMARK", async () => {
         const args = [null, null, null, "nottypebookmark"];
         await observer.onItemAdded(...args);
         assert.notCalled(dispatch);