Bug 1257087 - "Middle mouse click on history item would not open". r=mak, a=sylvestre
authorDão Gottwald <dao+bmo>
Fri, 27 May 2016 03:33:00 +0200
changeset 333154 de472f31c8a3f1711bdf65beecc8dfa983950b64
parent 333153 c560b2cb8b972cb607d9be8b164e4f4f30e14d1b
child 333155 bbabde19da559b30b75824b881165b6e38f66b35
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, sylvestre
bugs1257087
milestone48.0a2
Bug 1257087 - "Middle mouse click on history item would not open". r=mak, a=sylvestre
browser/components/customizableui/CustomizableWidgets.jsm
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -199,32 +199,38 @@ const CustomizableWidgets = [
       let staticButtons = items.parentNode.getElementsByTagNameNS(kNSXUL, "toolbarbutton");
       for (let i = 0, l = staticButtons.length; i < l; ++i)
         CustomizableUI.addShortcut(staticButtons[i]);
 
       PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
                          .asyncExecuteLegacyQueries([query], 1, options, {
         handleResult: function (aResultSet) {
           let onItemCommand = function (aEvent) {
+            // Only handle the click event for middle clicks, we're using the command
+            // event otherwise.
+            if (aEvent.type == "click" && aEvent.button != 1) {
+              return;
+            }
             let item = aEvent.target;
             win.openUILink(item.getAttribute("targetURI"), aEvent);
             CustomizableUI.hidePanelForNode(item);
           };
           let fragment = doc.createDocumentFragment();
           let row;
           while ((row = aResultSet.getNextRow())) {
             let uri = row.getResultByIndex(1);
             let title = row.getResultByIndex(2);
             let icon = row.getResultByIndex(6);
 
             let item = doc.createElementNS(kNSXUL, "toolbarbutton");
             item.setAttribute("label", title || uri);
             item.setAttribute("targetURI", uri);
             item.setAttribute("class", "subviewbutton");
             item.addEventListener("command", onItemCommand);
+            item.addEventListener("click", onItemCommand);
             if (icon) {
               let iconURL = "moz-anno:favicon:" + icon;
               item.setAttribute("image", iconURL);
             }
             fragment.appendChild(item);
           }
           items.appendChild(fragment);
         },