Bug 1354159 - Part 1 - Remove the unneeded third 'view' argument from PlacesUIUtils.openNodeWithEvent(). r?mak
MozReview-Commit-ID: Jema2qMYEdX
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -380,17 +380,17 @@
ondragover="PlacesMenuDNDHandler.onDragOver(event);"
ondrop="PlacesMenuDNDHandler.onDrop(event);">
<menupopup id="bookmarksMenuPopup"
#ifndef XP_MACOSX
placespopup="true"
#endif
context="placesContext"
openInTabs="children"
- oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
+ oncommand="BookmarksEventHandler.onCommand(event);"
onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
onpopupshowing="BookmarkingUI.onMainMenuPopupShowing(event);
if (!this.parentNode._placesView)
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
tooltip="bhTooltip" popupsinherittooltip="true">
<menuitem id="bookmarksShowAll"
label="&showAllBookmarks2.label;"
command="Browser:ShowAllBookmarks"
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -878,33 +878,31 @@ var BookmarksEventHandler = {
if (target._placesNode && PlacesUtils.nodeIsContainer(target._placesNode)) {
// 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._placesNode, aEvent, aView);
} else if (aEvent.button == 1) {
// left-clicks with modifier are already served by onCommand
- this.onCommand(aEvent, aView);
+ this.onCommand(aEvent);
}
},
/**
* Handler for command event for an item in the bookmarks toolbar.
* Menus and submenus from the folder buttons bubble up to this handler.
* Opens the item.
* @param aEvent
* DOMEvent for the command
- * @param aView
- * The places view which aEvent should be associated with.
*/
- onCommand: function BEH_onCommand(aEvent, aView) {
+ onCommand: function BEH_onCommand(aEvent) {
var target = aEvent.originalTarget;
if (target._placesNode)
- PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
+ PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent);
},
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) {
var node;
var cropped = false;
var targetURI;
if (aDocument.tooltipNode.localName == "treechildren") {
@@ -1921,24 +1919,24 @@ var BookmarkingUI = {
},
onPanelMenuViewHiding: function BUI_onViewHiding(aEvent) {
this._panelMenuView.uninit();
delete this._panelMenuView;
aEvent.target.removeEventListener("ViewHiding", this);
},
- onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent, aView) {
+ onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent) {
let target = aEvent.originalTarget;
if (!target._placesNode)
return;
if (PlacesUtils.nodeIsContainer(target._placesNode))
PlacesCommandHook.showPlacesOrganizer([ "BookmarksMenu", target._placesNode.itemId ]);
else
- PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
+ PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent);
PanelUI.hide();
},
// nsINavBookmarkObserver
onItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle, aDateAdded, aGuid) {
if (aURI && aURI.equals(this._uri)) {
// If a new bookmark has been added to the tracked uri, register it.
if (!this._itemGuids.has(aGuid)) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -974,17 +974,17 @@
oncommand="BookmarkingUI.onCommand(event);">
<observes element="bookmarkThisPageBroadcaster" attribute="starred"/>
<observes element="bookmarkThisPageBroadcaster" attribute="buttontooltiptext"/>
<menupopup id="BMB_bookmarksPopup"
class="cui-widget-panel cui-widget-panelview cui-widget-panelWithFooter PanelUI-subView"
placespopup="true"
context="placesContext"
openInTabs="children"
- oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
+ oncommand="BookmarksEventHandler.onCommand(event);"
onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
onpopupshowing="BookmarkingUI.onPopupShowing(event);
BookmarkingUI.attachPlacesView(event, this);"
tooltip="bhTooltip" popupsinherittooltip="true">
<menuitem id="BMB_viewBookmarksSidebar"
class="subviewbutton"
label="&viewBookmarksSidebar2.label;"
type="checkbox"
@@ -1138,17 +1138,17 @@
class="toolbarbutton-1"
mousethrough="never"
label="&bookmarksToolbarItem.label;"
oncommand="PlacesToolbarHelper.onPlaceholderCommand();"/>
<hbox flex="1"
id="PlacesToolbar"
context="placesContext"
onclick="BookmarksEventHandler.onClick(event, this._placesView);"
- oncommand="BookmarksEventHandler.onCommand(event, this._placesView);"
+ oncommand="BookmarksEventHandler.onCommand(event);"
tooltip="bhTooltip"
popupsinherittooltip="true">
<hbox flex="1">
<hbox id="PlacesToolbarDropIndicatorHolder" align="center" collapsed="true">
<image id="PlacesToolbarDropIndicator"
mousethrough="always"
collapsed="true"/>
</hbox>
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -1005,22 +1005,20 @@ this.PlacesUIUtils = {
* Loads the node's URL in the appropriate tab or window or as a web
* panel given the user's preference specified by modifier keys tracked by a
* DOM mouse/key event.
* @param aNode
* An uri result node.
* @param aEvent
* The DOM mouse/key event with modifier keys set that track the
* user's preferred destination window or tab.
- * @param aView
- * The controller associated with aNode.
*/
openNodeWithEvent:
- function PUIU_openNodeWithEvent(aNode, aEvent, aView) {
- let window = aView.ownerWindow;
+ function PUIU_openNodeWithEvent(aNode, aEvent) {
+ let window = aEvent.target.ownerGlobal;
this._openNodeIn(aNode, window.whereToOpenLink(aEvent, false, true), window);
},
/**
* Loads the node's URL in the appropriate tab or window or as a
* web panel.
* see also openUILinkIn
*/
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -1360,17 +1360,17 @@ var ContentTree = {
return Object.seal({
showDetailsPane: true,
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
});
},
openSelectedNode: function CT_openSelectedNode(aEvent) {
let view = this.view;
- PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);
+ PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent);
},
onClick: function CT_onClick(aEvent) {
let node = this.view.selectedNode;
if (node) {
let doubleClick = aEvent.button == 0 && aEvent.detail == 2;
let middleClick = aEvent.button == 1 && aEvent.detail == 1;
if (PlacesUtils.nodeIsURI(node) && (doubleClick || middleClick)) {
--- a/browser/components/places/content/sidebarUtils.js
+++ b/browser/components/places/content/sidebarUtils.js
@@ -47,27 +47,25 @@ var SidebarUtils = {
tbo.view.selection.select(cell.row);
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, aTree);
} else if (!mouseInGutter && !isContainer &&
aEvent.originalTarget.localName == "treechildren") {
// Clear all other selection since we're loading a link now. We must
// do this *before* attempting to load the link since openURL uses
// selection as an indication of which link to load.
tbo.view.selection.select(cell.row);
- PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent, aTree);
+ PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent);
}
},
handleTreeKeyPress: function SU_handleTreeKeyPress(aEvent) {
- // XXX Bug 627901: Post Fx4, this method should take a tree parameter.
- let tree = aEvent.target;
- let node = tree.selectedNode;
+ let node = aEvent.target.selectedNode;
if (node) {
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
- PlacesUIUtils.openNodeWithEvent(node, aEvent, tree);
+ PlacesUIUtils.openNodeWithEvent(node, aEvent);
}
},
/**
* The following function displays the URL of a node that is being
* hovered over.
*/
handleTreeMouseMove: function SU_handleTreeMouseMove(aEvent) {