Bug 966741 - middle-clicking recently closed items in Australis menu panel should close the panel, r=jaws, a=sylvestre
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 25 Feb 2014 13:20:28 +0000
changeset 183092 3215a031b9ca6a646a56f665f3333ba9d00ef510
parent 183091 475bc4af0a4b1883a815c14a30e85cdd777478b0
child 183093 f732b452f351d44ddc772ceb1352586afe19f2b4
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, sylvestre
bugs966741
milestone29.0a2
Bug 966741 - middle-clicking recently closed items in Australis menu panel should close the panel, r=jaws, a=sylvestre
browser/components/customizableui/src/CustomizableWidgets.jsm
--- a/browser/components/customizableui/src/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/src/CustomizableWidgets.jsm
@@ -186,16 +186,29 @@ const CustomizableWidgets = [{
       separator = doc.getElementById("PanelUI-recentlyClosedWindows-separator");
       elementCount = windowsFragment.childElementCount;
       separator.hidden = !elementCount;
       while (--elementCount >= 0) {
         windowsFragment.children[elementCount].classList.add("subviewbutton");
       }
       recentlyClosedWindows.appendChild(windowsFragment);
     },
+    onCreated: function(aNode) {
+      // Middle clicking recently closed items won't close the panel - cope:
+      let onRecentlyClosedClick = function(aEvent) {
+        if (aEvent.button == 1) {
+          CustomizableUI.hidePanelForNode(this);
+        }
+      };
+      let doc = aNode.ownerDocument;
+      let recentlyClosedTabs = doc.getElementById("PanelUI-recentlyClosedTabs");
+      let recentlyClosedWindows = doc.getElementById("PanelUI-recentlyClosedWindows");
+      recentlyClosedTabs.addEventListener("click", onRecentlyClosedClick);
+      recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
+    },
     onViewHiding: function(aEvent) {
       LOG("History view is being hidden!");
     }
   }, {
     id: "privatebrowsing-button",
     shortcutId: "key_privatebrowsing",
     defaultArea: CustomizableUI.AREA_PANEL,
     onCommand: function(e) {