Bug 1472472 - Use PlacesCommandHook.bookmarkLink instead of PlacesCommandHook.bookmarkPage in activity stream. r=Mardak
authorDão Gottwald <dao@mozilla.com>
Fri, 06 Jul 2018 13:02:59 +0200
changeset 815180 31115ed412b5b919f993464ae6090cc751382560
parent 815179 bb94d7f91e67a64ceb45641343d455781162a650
child 815181 9515834d02bbe2531fdcbfa7781a3d09897d226a
push id115462
push userbmo:mreschenberg@berkeley.edu
push dateFri, 06 Jul 2018 22:06:52 +0000
reviewersMardak
bugs1472472
milestone63.0a1
Bug 1472472 - Use PlacesCommandHook.bookmarkLink instead of PlacesCommandHook.bookmarkPage in activity stream. r=Mardak MozReview-Commit-ID: EszRhVlaNky
browser/extensions/activity-stream/lib/PlacesFeed.jsm
toolkit/modules/NewTabUtils.jsm
--- a/browser/extensions/activity-stream/lib/PlacesFeed.jsm
+++ b/browser/extensions/activity-stream/lib/PlacesFeed.jsm
@@ -288,17 +288,17 @@ class PlacesFeed {
         this.removeObservers();
         break;
       case at.BLOCK_URL: {
         const {url, pocket_id} = action.data;
         NewTabUtils.activityStreamLinks.blockURL({url, pocket_id});
         break;
       }
       case at.BOOKMARK_URL:
-        NewTabUtils.activityStreamLinks.addBookmark(action.data, action._target.browser);
+        NewTabUtils.activityStreamLinks.addBookmark(action.data, action._target.browser.ownerGlobal);
         break;
       case at.DELETE_BOOKMARK_BY_ID:
         NewTabUtils.activityStreamLinks.deleteBookmark(action.data);
         break;
       case at.DELETE_HISTORY_URL: {
         const {url, forceBlock, pocket_id} = action.data;
         NewTabUtils.activityStreamLinks.deleteHistoryEntry(url);
         if (forceBlock) {
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -1284,24 +1284,25 @@ var ActivityStreamLinks = {
 
   /**
    * Adds a bookmark and opens up the Bookmark Dialog to show feedback that
    * the bookmarking action has been successful
    *
    * @param {Object} aData
    *          aData.url The url to bookmark
    *          aData.title The title of the page to bookmark
-   * @param {Browser} aBrowser
-   *          a <browser> element
+   * @param {Window} aBrowserWindow
+   *          The current browser chrome window
    *
    * @returns {Promise} Returns a promise set to an object representing the bookmark
    */
-  addBookmark(aData, aBrowser) {
+  addBookmark(aData, aBrowserWindow) {
       const {url, title} = aData;
-      return aBrowser.ownerGlobal.PlacesCommandHook.bookmarkPage(
+      return aBrowserWindow.PlacesCommandHook.bookmarkLink(
+              PlacesUtils.bookmarksMenuFolderId,
               url,
               title);
   },
 
   /**
    * Removes a bookmark
    *
    * @param {String} aBookmarkGuid