Bug 1377967 - make middle clicking history, bookmarks and closed tabs items work correctly, r=mikedeboer a=reland stuff lost during last merge
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 10 Aug 2017 23:05:33 +0100
changeset 374095 64f5e3f40f0e7accb12cd90080e58eff0be46383
parent 374094 94efd7ef04b2ecc73185d026b8e949e18a4e8221
child 374096 65826179c86e2a3538bcffd969556937e15688cd
push id32313
push userarchaeopteryx@coole-files.de
push dateFri, 11 Aug 2017 09:58:10 +0000
treeherdermozilla-central@64f5e3f40f0e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, reland
bugs1377967
milestone57.0a1
first release with
nightly linux32
64f5e3f40f0e / 57.0a1 / 20170811100330 / files
nightly linux64
64f5e3f40f0e / 57.0a1 / 20170811100330 / files
nightly mac
64f5e3f40f0e / 57.0a1 / 20170811100330 / files
nightly win32
64f5e3f40f0e / 57.0a1 / 20170811100330 / files
nightly win64
64f5e3f40f0e / 57.0a1 / 20170811100330 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377967 - make middle clicking history, bookmarks and closed tabs items work correctly, r=mikedeboer a=reland stuff lost during last merge MozReview-Commit-ID: VQUuQHyCXi
browser/components/places/content/browserPlacesViews.js
browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -2015,29 +2015,34 @@ this.PlacesPanelview = class extends Pla
     this._onPopupShowing({ originalTarget: this._rootElt });
     this._addEventListeners(window, ["unload"]);
     this._rootElt.setAttribute("context", "placesContext");
   }
 
   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() {
     return this.panelMultiView.parentNode;
   }
 
   get panelMultiView() {
     return this._viewElt.panelMultiView;
   }
 
   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;
       case "dragend":
         this._onDragEnd(event);
         break;
       case "dragstart":
         this._onDragStart(event);
@@ -2055,16 +2060,17 @@ this.PlacesPanelview = class extends Pla
   }
 
   _onCommand(event) {
     let button = event.originalTarget;
     if (!button._placesNode)
       return;
 
     PlacesUIUtils.openNodeWithEvent(button._placesNode, event);
+    this.panelMultiView.closest("panel").hidePopup();
   }
 
   _onDragEnd() {
     this._draggedElt = null;
   }
 
   _onDragStart(event) {
     let draggedElt = event.originalTarget;
--- a/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm
+++ b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm
@@ -105,16 +105,20 @@ this.RecentlyClosedTabsAndWindowsMenuUti
     *        The event when the user clicks the menu item
     */
   _undoCloseMiddleClick(aEvent) {
     if (aEvent.button != 1)
       return;
 
     aEvent.view.undoCloseTab(aEvent.originalTarget.getAttribute("value"));
     aEvent.view.gBrowser.moveTabToEnd();
+    let ancestorPanel = aEvent.target.closest("panel");
+    if (ancestorPanel) {
+      ancestorPanel.hidePopup();
+    }
   },
 };
 
 function setImage(aItem, aElement) {
   let iconURL = aItem.image;
   // don't initiate a connection just to fetch a favicon (see bug 467828)
   if (/^https?:/.test(iconURL))
     iconURL = "moz-anno:favicon:" + iconURL;