diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index f682db05a19..01c53867210 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -167,13 +167,8 @@ var PlacesCommandHook = { * 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] aAnchorElement - * required if aShowEditUI is set, see popup's openPopup. - * @param [optional] aPosition - * required if aShowEditUI is set, see popup's openPopup. */ - bookmarkPage: function PCH_bookmarkPage(aBrowser, aParent, aShowEditUI, - aAnchorElement, aPosition) { + bookmarkPage: function PCH_bookmarkPage(aBrowser, aParent, aShowEditUI) { var uri = aBrowser.currentURI; var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); if (itemId == -1) { @@ -202,25 +197,25 @@ var PlacesCommandHook = { itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); } - if (aShowEditUI) - this.showEditBookmarkPopup(itemId, aAnchorElement, aPosition); + if (aShowEditUI) { + // dock the panel to the star icon when possible, otherwise dock + // it to the content area + if (aBrowser.contentWindow == window.content) { + var starIcon = aBrowser.ownerDocument.getElementById("star-button"); + if (starIcon && isElementVisible(starIcon)) { + this.showEditBookmarkPopup(itemId, starIcon, "after_start"); + return; + } + } + this.showEditBookmarkPopup(itemId, aBrowser, "overlap"); + } }, /** * Adds a bookmark to the page loaded in the current tab. */ bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) { - // dock the panel to the star icon if it is visible, otherwise dock - // it to the content area - var starIcon = document.getElementById("star-button"); - if (starIcon && isElementVisible(starIcon)) { - this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI, - starIcon, "after_start"); - } - else { - this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI, - getBrowser(), "overlap"); - } + this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI); }, /** @@ -242,7 +237,7 @@ var PlacesCommandHook = { itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI); } - PlacesCommandHook.showEditBookmarkPopup(itemId, getBrowser(), "overlap"); + this.showEditBookmarkPopup(itemId, getBrowser(), "overlap"); }, /** diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index a35cdaf84e1..d20cb464f7f 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -264,8 +264,7 @@ function BookmarkThisTab() tab = getBrowser().mCurrentTab; PlacesCommandHook.bookmarkPage(tab.linkedBrowser, - PlacesUtils.bookmarksRootId, - true, getBrowser(), "overlap"); + PlacesUtils.bookmarksRootId, true); } /** diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index a987343b413..f88a7438659 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -1140,13 +1140,12 @@ nsContextMenu.prototype = { }, bookmarkThisPage: function CM_bookmarkThisPage() { - PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksRootId, - true, this.browser, "overlap"); + window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksRootId, true); }, bookmarkLink: function CM_bookmarkLink() { - PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksRootId, this.linkURL, - this.linkText()); + window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksRootId, this.linkURL, + this.linkText()); }, addBookmarkForFrame: function CM_addBookmarkForFrame() { @@ -1165,7 +1164,7 @@ nsContextMenu.prototype = { itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); } - PlacesCommandHook.showEditBookmarkPopup(itemId, this.browser, "overlap"); + window.top.PlacesCommandHook.showEditBookmarkPopup(itemId, this.browser, "overlap"); }, savePageAs: function CM_savePageAs() {