From e105c93b9872890865c2e3495fffa6a796d719fc Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Wed, 9 Aug 2017 21:04:27 +0100 Subject: [PATCH] Bug 1377967 - make middle clicking history, bookmarks and closed tabs items work correctly, r=mikedeboer MozReview-Commit-ID: VQUuQHyCXi --HG-- extra : rebase_source : 75e148a49ed86e1c979991daa43d31cfbf9511e0 --- browser/components/places/content/browserPlacesViews.js | 8 +++++++- .../RecentlyClosedTabsAndWindowsMenuUtils.jsm | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js index 1525fcaa40d1..f8dc66151c3a 100644 --- a/browser/components/places/content/browserPlacesViews.js +++ b/browser/components/places/content/browserPlacesViews.js @@ -2020,7 +2020,7 @@ this.PlacesPanelview = class extends PlacesViewBase { get events() { if (this._events) return this._events; - return this._events = ["command", "dragend", "dragstart", "ViewHiding", "ViewShown"]; + return this._events = ["click", "command", "dragend", "dragstart", "ViewHiding", "ViewShown"]; } get panel() { @@ -2033,6 +2033,11 @@ this.PlacesPanelview = class extends PlacesViewBase { handleEvent(event) { switch (event.type) { + case "click": + // For left and middle clicks, fall through to the command handler. + if (event.button >= 2) { + break; + } case "command": this._onCommand(event); break; @@ -2060,6 +2065,7 @@ this.PlacesPanelview = class extends PlacesViewBase { return; PlacesUIUtils.openNodeWithEvent(button._placesNode, event); + this.panelMultiView.closest("panel").hidePopup(); } _onDragEnd() { diff --git a/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm index cb8da2def3b1..1d9c272035d9 100644 --- a/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm +++ b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm @@ -110,6 +110,10 @@ this.RecentlyClosedTabsAndWindowsMenuUtils = { aEvent.view.undoCloseTab(aEvent.originalTarget.getAttribute("value")); aEvent.view.gBrowser.moveTabToEnd(); + let ancestorPanel = aEvent.target.closest("panel"); + if (ancestorPanel) { + ancestorPanel.hidePopup(); + } }, };