diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 55fe30940fbb..1a860c5a91f8 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -105,14 +105,24 @@ var PlacesCommandHook = { PlacesUtils.showAddBookmarkUI(linkURI, title); }, + /** + * Adds a bookmark to the page loaded in the given browser + * @param aBrowser + * a element + */ + bookmarkPage: function PCH_bookmarkCurrentPage(aBrowser) { + var selectedBrowser = getBrowser().selectedBrowser; + PlacesUtils.showAddBookmarkUI(aBrowser.currentURI); + }, + /** * Adds a bookmark to the page loaded in the current tab. */ bookmarkCurrentPage: function PCH_bookmarkCurrentPage() { - var selectedBrowser = getBrowser().selectedBrowser; - PlacesUtils.showAddBookmarkUI(selectedBrowser.currentURI); + PlacesUtils.showAddBookmarkUI(getBrowser().selectedBrowser); }, + /** * This function returns a list of nsIURI objects characterizing the * tabs currently open in the browser. The URIs will appear in the diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index a7069800dbc3..309bffed8e17 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -278,7 +278,6 @@ function SetClickAndHoldHandlers() } #endif -#ifndef MOZ_PLACES_BOOKMARKS function addBookmarkMenuitems() { var tabbrowser = getBrowser(); @@ -304,9 +303,12 @@ function BookmarkThisTab() if (tab.localName != "tab") tab = getBrowser().mCurrentTab; +#ifdef MOZ_PLACES_BOOKMARKS + PlacesCommandHook.bookmarkPage(tab.linkedBrowser); +#else addBookmarkAs(tab.linkedBrowser, false); -} #endif +} const gSessionHistoryObserver = { observe: function(subject, topic, data) @@ -989,9 +991,10 @@ function delayedStartup() sidebar.setAttribute("src", sidebarBox.getAttribute("src")); } -#ifndef MOZ_PLACES_BOOKMARKS // add bookmark options to context menu for tabs addBookmarkMenuitems(); + +#ifndef MOZ_PLACES_BOOKMARKS initServices(); initBMService(); // now load bookmarks