Bug 1472275 - Remove PlacesCommandHook.bookmarkPage's aShowEditUI argument. r=standard8

MozReview-Commit-ID: CGYSF1OvoVg

--HG--
extra : rebase_source : 3470cd6522ae3c3e2802dfa2e032643c7fbdcb55
This commit is contained in:
Dão Gottwald 2018-06-29 19:45:35 +02:00
Родитель 742a191f7e
Коммит 03203945f5
5 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -391,22 +391,20 @@ var PlacesCommandHook = {
*
* @param aBrowser
* a <browser> element.
* @param [optional] aShowEditUI
* whether or not to show the edit-bookmark UI for the bookmark item
* @param [optional] aUrl
* Option to provide a URL to bookmark rather than the current page
* @param [optional] aTitle
* Option to provide a title for a bookmark to use rather than the
* getting the current page's title
*/
async bookmarkPage(aBrowser, aShowEditUI, aUrl = null, aTitle = null) {
async bookmarkPage(aBrowser, aUrl = null, aTitle = null) {
// If aUrl is provided, we want to bookmark that url rather than the
// the current page
let isCurrentBrowser = !aUrl;
let url = aUrl ? new URL(aUrl) : new URL(aBrowser.currentURI.spec);
let info = await PlacesUtils.bookmarks.fetch({ url });
let isNewBookmark = !info;
let showEditUI = aShowEditUI && (!isNewBookmark || StarUI.showForNewBookmarks);
let showEditUI = !isNewBookmark || StarUI.showForNewBookmarks;
if (isNewBookmark) {
let parentGuid = PlacesUtils.bookmarks.unfiledGuid;
info = { url, parentGuid };
@ -1603,7 +1601,7 @@ var BookmarkingUI = {
}, { once: true });
this.star.setAttribute("animate", "true");
}
PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, true);
PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser);
}
},

Просмотреть файл

@ -57,7 +57,7 @@
#endif
<!-- work-around bug 392512 -->
<command id="Browser:AddBookmarkAs"
oncommand="PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, true);"/>
oncommand="PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser);"/>
<!-- The command disabled state must be manually updated through
PlacesCommandHook.updateBookmarkAllTabsCommand() -->
<command id="Browser:BookmarkAllTabs"

Просмотреть файл

@ -1420,7 +1420,7 @@ nsContextMenu.prototype = {
bookmarkThisPage: function CM_bookmarkThisPage() {
window.top.PlacesCommandHook
.bookmarkPage(this.browser, true)
.bookmarkPage(this.browser)
.catch(Cu.reportError);
},

Просмотреть файл

@ -19,6 +19,8 @@ var tests = [
"https://untrusted.example.com/somepage.html"]
];
SpecialPowers.pushPrefEnv({"set": [["browser.bookmarks.editDialog.showForNewBookmarks", false]]});
add_task(async function check_default_bookmark_title() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
let browser = tab.linkedBrowser;
@ -96,7 +98,7 @@ async function checkBookmarkedPageTitle(url, default_title, overridden_title) {
// Here we test that if we provide a url and a title to bookmark, it will use the
// title provided rather than the one provided by the current page
PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, false, url, overridden_title);
PlacesCommandHook.bookmarkPage(gBrowser.selectedBrowser, url, overridden_title);
await promiseBookmark;
let bookmark = await PlacesUtils.bookmarks.fetch({url});

Просмотреть файл

@ -1298,7 +1298,6 @@ var ActivityStreamLinks = {
const {url, title} = aData;
return aBrowser.ownerGlobal.PlacesCommandHook.bookmarkPage(
aBrowser,
true,
url,
title);
},