Bug 423124 - CMD/CTRL+clicking a bookmark creates two new tabs. Patch by Marco Bonardo [mak77] <mak77@supereva.it>, r=me.

This commit is contained in:
mozilla.mano@sent.com 2008-03-17 04:33:16 -07:00
parent 8e2eeba5aa
commit 0888b44113
3 changed files with 21 additions and 15 deletions

View File

@ -434,8 +434,6 @@
<menupopup id="bookmarksToolbarFolderPopup"
type="places"
context="placesContext"
oncommand="BookmarksEventHandler.onCommand(event);"
onclick="BookmarksEventHandler.onClick(event);"
onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"/>
</menu>
<menuseparator builder="start"/>

View File

@ -599,17 +599,8 @@ var BookmarksEventHandler = {
return;
var target = aEvent.originalTarget;
if (target.node && PlacesUtils.nodeIsContainer(target.node)) {
// Don't open the root folder in tabs when the empty area on the toolbar
// is middle-clicked or when a non-bookmark item except for Open in Tabs)
// in a bookmarks menupopup is middle-clicked.
if (target.localName == "menu" || target.localName == "toolbarbutton")
PlacesUIUtils.openContainerNodeInTabs(target.node, aEvent);
}
else
this.onCommand(aEvent);
// If this event bubbled up from a menu or menuitem, close the menus.
// Do this before opening tabs, to avoid hiding the open tabs confirm.
if (target.localName == "menu" || target.localName == "menuitem") {
for (node = target.parentNode; node; node = node.parentNode) {
if (node.localName == "menupopup")
@ -618,6 +609,18 @@ var BookmarksEventHandler = {
break;
}
}
if (target.node && PlacesUtils.nodeIsContainer(target.node)) {
// Don't open the root folder in tabs when the empty area on the toolbar
// is middle-clicked or when a non-bookmark item except for Open in Tabs)
// in a bookmarks menupopup is middle-clicked.
if (target.localName == "menu" || target.localName == "toolbarbutton")
PlacesUIUtils.openContainerNodeInTabs(target.node, aEvent);
}
else if (aEvent.button == 1) {
// left-clicks with modifier are already served by onCommand
this.onCommand(aEvent);
}
},
/**

View File

@ -949,13 +949,18 @@
<handlers>
<handler event="popupshowing" phase="capturing"><![CDATA[
this._ensureInitialized();
if (event.target._resultNode)
this.onPopupShowing(event);
var popup = event.target;
// We should avoid to handle events of inner views
if (!popup._resultNode || PlacesUIUtils.getViewForNode(popup) != this)
return;
this.onPopupShowing(event);
]]></handler>
<handler event="popuphidden"><![CDATA[
var popup = event.target;
if (!popup._resultNode)
// We should avoid to handle events of inner views
if (!popup._resultNode || PlacesUIUtils.getViewForNode(popup) != this)
return;
// UI performance: folder queries are cheap, keep the resultnode open