Bug 966723: exit Customize Mode on menu-button click, not mouse-down. r=mconley, feedback=dao.
authorMike de Boer <mdeboer@mozilla.com>
Thu, 24 Apr 2014 16:37:54 +0200
changeset 180668 df9f33c5a49d8f1c716f2b8c93f522deda4d7527
parent 180667 09863b96e7725bf384ec5ed53b9679e4a078e71e
child 180669 0bfe1f94e8748674542edc4333bd6810b71f802d
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmconley
bugs966723
milestone31.0a1
Bug 966723: exit Customize Mode on menu-button click, not mouse-down. r=mconley, feedback=dao.
browser/components/customizableui/src/CustomizeMode.jsm
--- a/browser/components/customizableui/src/CustomizeMode.jsm
+++ b/browser/components/customizableui/src/CustomizeMode.jsm
@@ -174,20 +174,20 @@ CustomizeMode.prototype = {
 
       CustomizableUI.dispatchToolboxEvent("beforecustomization", {}, window);
       CustomizableUI.notifyStartCustomizing(this.window);
 
       // Add a keypress listener to the document so that we can quickly exit
       // customization mode when pressing ESC.
       document.addEventListener("keypress", this);
 
-      // Same goes for the menu button - if we're customizing, a mousedown to the
+      // Same goes for the menu button - if we're customizing, a click on the
       // menu button means a quick exit from customization mode.
       window.PanelUI.hide();
-      window.PanelUI.menuButton.addEventListener("mousedown", this);
+      window.PanelUI.menuButton.addEventListener("command", this);
       window.PanelUI.menuButton.open = true;
       window.PanelUI.beginBatchUpdate();
 
       // The menu panel is lazy, and registers itself when the popup shows. We
       // need to force the menu panel to register itself, or else customization
       // is really not going to work. We pass "true" to ensureRegistered to
       // indicate that we're handling calling startBatchUpdate and
       // endBatchUpdate.
@@ -326,17 +326,17 @@ CustomizeMode.prototype = {
       this.panelUIContents.removeAttribute("showoutline");
     }
 
     this._removeExtraToolbarsIfEmpty();
 
     CustomizableUI.removeListener(this);
 
     this.document.removeEventListener("keypress", this);
-    this.window.PanelUI.menuButton.removeEventListener("mousedown", this);
+    this.window.PanelUI.menuButton.removeEventListener("command", this);
     this.window.PanelUI.menuButton.open = false;
 
     this.window.PanelUI.beginBatchUpdate();
 
     this._removePanelCustomizationPlaceholders();
 
     let window = this.window;
     let document = this.document;
@@ -1176,23 +1176,23 @@ CustomizeMode.prototype = {
         this._onDragDrop(aEvent);
         break;
       case "dragexit":
         this._onDragExit(aEvent);
         break;
       case "dragend":
         this._onDragEnd(aEvent);
         break;
-      case "mousedown":
-        if (aEvent.button == 0 &&
-            (aEvent.originalTarget == this.window.PanelUI.menuButton)) {
+      case "command":
+        if (aEvent.originalTarget == this.window.PanelUI.menuButton) {
           this.exit();
           aEvent.preventDefault();
-          return;
         }
+        break;
+      case "mousedown":
         this._onMouseDown(aEvent);
         break;
       case "mouseup":
         this._onMouseUp(aEvent);
         break;
       case "keypress":
         if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
           this.exit();