diff --git a/xpfe/browser/resources/content/navigator.xul b/xpfe/browser/resources/content/navigator.xul index 3b5ba710b3b3..1c9fa6a49e7c 100644 --- a/xpfe/browser/resources/content/navigator.xul +++ b/xpfe/browser/resources/content/navigator.xul @@ -292,6 +292,7 @@ datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot" container="true" flags="dont-test-empty" oncommand="BookmarksMenu.loadBookmark(event, this.database)" + onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" template="bookmarksMenuTemplate" ondraggesture="if (event.target.id=='bookmarks-button') event.preventBubble()"> @@ -310,7 +311,7 @@ datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:PersonalToolbarFolder" flags="dont-test-empty" oncommand="BookmarksUtils.loadBookmarkBrowser(event, this.database)" - onclick="if (event.button == 1) BookmarksUtils.loadBookmarkBrowser(event, this.database)" + onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" rdf:type="http://home.netscape.com/NC-rdf#Folder"> @@ -320,7 +321,8 @@ datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" template="bookmarksMenuTemplate" ref="NC:PersonalToolbarFolder" flags="dont-test-empty" - oncommand="BookmarksUtils.loadBookmarkBrowser(event, this.database)"> + oncommand="BookmarksUtils.loadBookmarkBrowser(event, this.database)" + onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"> diff --git a/xpfe/browser/resources/content/navigatorOverlay.xul b/xpfe/browser/resources/content/navigatorOverlay.xul index 6caefc0e0e28..5cb1afa2b9c1 100644 --- a/xpfe/browser/resources/content/navigatorOverlay.xul +++ b/xpfe/browser/resources/content/navigatorOverlay.xul @@ -458,6 +458,7 @@ datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot" flags="dont-test-empty" template="bookmarksMenuTemplate" oncommand="BookmarksMenu.loadBookmark(event, this.database)" + onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)" ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.preventBubble()" ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.preventBubble()" diff --git a/xpfe/components/bookmarks/resources/bookmarksMenu.js b/xpfe/components/bookmarks/resources/bookmarksMenu.js index 0627e15fbd0d..774b5a8293a1 100644 --- a/xpfe/components/bookmarks/resources/bookmarksMenu.js +++ b/xpfe/components/bookmarks/resources/bookmarksMenu.js @@ -275,6 +275,19 @@ var BookmarksMenu = { { if (this.isBTBookmark(aEvent.target.id)) BookmarksUtils.loadBookmarkBrowser(aEvent, aDS); + }, + + loadBookmarkMiddleClick: function (aEvent, aDS) + { + if (aEvent.type != "click" || aEvent.button != 1) + return; + // unlike for command events, we have to close the menus manually + for (var node = aEvent.target; node != aEvent.currentTarget; + node = node.parentNode) { + if (node.nodeType == node.ELEMENT_NODE && node.tagName == "menupopup") + node.hidePopup(); + } + this.loadBookmark(aEvent, aDS); } }