diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index f7408590f45d..59024fb645a5 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -404,9 +404,6 @@ var PlacesCommandHook = { * * @param aBrowser * a element. - * @param [optional] aParent - * The folder in which to create a new bookmark if the page loaded in - * aBrowser isn't bookmarked yet, defaults to the unfiled root. * @param [optional] aShowEditUI * whether or not to show the edit-bookmark UI for the bookmark item * @param [optional] aUrl @@ -415,9 +412,9 @@ var PlacesCommandHook = { * Option to provide a title for a bookmark to use rather than the * getting the current page's title */ - async bookmarkPage(aBrowser, aParent, aShowEditUI, aUrl = null, aTitle = null) { + async bookmarkPage(aBrowser, aShowEditUI, aUrl = null, aTitle = null) { if (PlacesUIUtils.useAsyncTransactions) { - await this._bookmarkPagePT(aBrowser, aParent, aShowEditUI, aUrl, aTitle); + await this._bookmarkPagePT(aBrowser, aShowEditUI, aUrl, aTitle); return; } @@ -450,10 +447,9 @@ var PlacesCommandHook = { StarUI.beginBatch(); } - var parent = aParent !== undefined ? - aParent : PlacesUtils.unfiledBookmarksFolderId; var descAnno = { name: PlacesUIUtils.DESCRIPTION_ANNO, value: description }; - var txn = new PlacesCreateBookmarkTransaction(uri, parent, + var txn = new PlacesCreateBookmarkTransaction(uri, + PlacesUtils.unfiledBookmarksFolderId, PlacesUtils.bookmarks.DEFAULT_INDEX, title, null, [descAnno]); PlacesUtils.transactionManager.doTransaction(txn); @@ -485,16 +481,14 @@ var PlacesCommandHook = { // TODO: Replace bookmarkPage code with this function once legacy // transactions are removed. - async _bookmarkPagePT(aBrowser, aParentId, aShowEditUI, aUrl, aTitle) { + async _bookmarkPagePT(aBrowser, aShowEditUI, aUrl, aTitle) { // If aUrl is provided, we want to bookmark that url rather than the // the current page let url = aUrl ? new URL(aUrl) : new URL(aBrowser.currentURI.spec); let info = await PlacesUtils.bookmarks.fetch({ url }); let isNewBookmark = !info; if (!info) { - let parentGuid = aParentId !== undefined ? - await PlacesUtils.promiseItemGuid(aParentId) : - PlacesUtils.bookmarks.unfiledGuid; + let parentGuid = PlacesUtils.bookmarks.unfiledGuid; info = { url, parentGuid }; // Bug 1148838 - Make this code work for full page plugins. let description = null; @@ -570,14 +564,6 @@ var PlacesCommandHook = { }); }, - /** - * Adds a bookmark to the page loaded in the current tab. - */ - bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) { - this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI) - .catch(Components.utils.reportError); - }, - /** * Adds a bookmark to the page targeted by a link. * @param parentId @@ -1821,7 +1807,7 @@ var BookmarkingUI = { BrowserUtils.setToolbarButtonHeightProperty(this.star); this.star.setAttribute("animate", "true"); } - PlacesCommandHook.bookmarkCurrentPage(true); + PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, true); } }, diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc index b353313cd07b..fb5c78ea816f 100644 --- a/browser/base/content/browser-sets.inc +++ b/browser/base/content/browser-sets.inc @@ -58,7 +58,7 @@ #endif + oncommand="PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, true);"/> itemUrl.equals(gBrowser.selectedBrowser.currentURI)); - PlacesCommandHook.bookmarkCurrentPage(false); + PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser); await promiseBookmark; let bookmark = await PlacesUtils.bookmarks.fetch({url}); diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index bf0cffb16dd7..f329fe5744f5 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -1257,7 +1257,6 @@ var ActivityStreamLinks = { const {url, title} = aData; return aBrowser.ownerGlobal.PlacesCommandHook.bookmarkPage( aBrowser, - undefined, true, url, title);