Bug 1395871 - Open toolbar menus on mousedown, rather than oncommand.
authorZibi Braniecki <zbraniecki@mozilla.com>
Fri, 01 Sep 2017 01:54:34 -0700
changeset 428896 e4fe078dc0134815c9e19e671ab3d3ea69979955
parent 428895 75b91420fff7c1ded50cc8dd9396590bc0172588
child 428897 354981c2ee1ff9102350393ac2c262691cf72c3d
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1395871
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395871 - Open toolbar menus on mousedown, rather than oncommand. MozReview-Commit-ID: A3P4QBBgcB8
browser/base/content/browser.xul
browser/components/customizableui/CustomizableUI.jsm
browser/components/downloads/test/browser/browser_overflow_anchor.js
browser/components/search/content/search.xml
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -904,17 +904,17 @@
                        onclick="FullZoom.reset();"
                        tooltip="dynamic-shortcut-tooltip"
                        hidden="true"/>
                 <box id="pageActionSeparator" class="urlbar-page-action"/>
                 <image id="pageActionButton"
                        class="urlbar-icon urlbar-page-action"
                        role="button"
                        tooltiptext="&pageActionButton.tooltip;"
-                       onclick="BrowserPageActions.mainButtonClicked(event);"/>
+                       onmousedown="BrowserPageActions.mainButtonClicked(event);"/>
                 <hbox id="star-button-box"
                       hidden="true"
                       class="urlbar-icon-wrapper urlbar-page-action"
                       role="button"
                       context="pageActionPanelContextMenu"
                       oncontextmenu="BrowserPageActions.onContextMenu(event);"
                       onclick="BrowserPageActions.bookmark.onUrlbarNodeClicked(event);">
                   <image id="star-button"
@@ -939,28 +939,28 @@
         </toolbaritem>
 
         <!-- This is a placeholder for the Downloads Indicator.  It is visible
              during the customization of the toolbar, in the palette, and before
              the Downloads Indicator overlay is loaded. -->
         <toolbarbutton id="downloads-button"
                        class="toolbarbutton-1 chromeclass-toolbar-additional badged-button"
                        key="key_openDownloads"
-                       oncommand="DownloadsIndicatorView.onCommand(event);"
+                       onmousedown="DownloadsIndicatorView.onCommand(event);"
                        ondrop="DownloadsIndicatorView.onDrop(event);"
                        ondragover="DownloadsIndicatorView.onDragOver(event);"
                        ondragenter="DownloadsIndicatorView.onDragOver(event);"
                        label="&downloads.label;"
                        removable="true"
                        cui-areatype="toolbar"
                        tooltip="dynamic-shortcut-tooltip"/>
 
         <toolbarbutton id="library-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                        removable="true"
-                       oncommand="PanelUI.showSubView('appMenu-libraryView', this, null, event);"
+                       onmousedown="PanelUI.showSubView('appMenu-libraryView', this, null, event);"
                        closemenu="none"
                        cui-areatype="toolbar"
                        tooltiptext="&libraryButton.tooltip;"
                        label="&places.library.title;"/>
 
       </hbox>
 
       <toolbarbutton id="nav-bar-overflow-button"
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -4151,17 +4151,17 @@ OverflowableToolbar.prototype = {
     let doc = this._toolbar.ownerDocument;
     let window = doc.defaultView;
     window.addEventListener("resize", this);
     window.gNavToolbox.addEventListener("customizationstarting", this);
     window.gNavToolbox.addEventListener("aftercustomization", this);
 
     let chevronId = this._toolbar.getAttribute("overflowbutton");
     this._chevron = doc.getElementById(chevronId);
-    this._chevron.addEventListener("command", this);
+    this._chevron.addEventListener("mousedown", this);
     this._chevron.addEventListener("dragover", this);
     this._chevron.addEventListener("dragend", this);
 
     let panelId = this._toolbar.getAttribute("overflowpanel");
     this._panel = doc.getElementById(panelId);
     this._panel.addEventListener("popuphiding", this);
     CustomizableUIInternal.addPanelCloseListeners(this._panel);
 
@@ -4200,17 +4200,17 @@ OverflowableToolbar.prototype = {
     CustomizableUIInternal.removePanelCloseListeners(this._panel);
   },
 
   handleEvent(aEvent) {
     switch (aEvent.type) {
       case "aftercustomization":
         this._enable();
         break;
-      case "command":
+      case "mousedown":
         if (aEvent.target == this._chevron) {
           this._onClickChevron(aEvent);
         } else {
           this._panel.hidePopup();
         }
         break;
       case "customizationstarting":
         this._disable();
--- a/browser/components/downloads/test/browser/browser_overflow_anchor.js
+++ b/browser/components/downloads/test/browser/browser_overflow_anchor.js
@@ -32,17 +32,17 @@ add_task(async function test_overflow_an
   lockWidth(kFlexyItems);
 
   // Resize the window to half of its original size. That should
   // be enough to overflow the downloads button.
   window.resizeTo(oldWidth / 2, window.outerHeight);
   await waitForOverflowed(button, true);
 
   let promise = promisePanelOpened();
-  button.node.doCommand();
+  button.node.dispatchEvent(new Event("mousedown"));
   await promise;
 
   let panel = DownloadsPanel.panel;
   let chevron = document.getElementById("nav-bar-overflow-button");
   is(panel.anchorNode, chevron, "Panel should be anchored to the chevron.");
 
   DownloadsPanel.hidePanel();
 
@@ -52,17 +52,17 @@ add_task(async function test_overflow_an
   // Put the window back to its original dimensions.
   window.resizeTo(oldWidth, window.outerHeight);
 
   // The downloads button should eventually be un-overflowed.
   await waitForOverflowed(button, false);
 
   // Now try opening the panel again.
   promise = promisePanelOpened();
-  button.node.doCommand();
+  button.node.dispatchEvent(new Event("mousedown"));
   await promise;
 
   is(panel.anchorNode.id, "downloads-indicator-anchor");
 
   DownloadsPanel.hidePanel();
 });
 
 /**
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -544,17 +544,17 @@
 
       <handler event="mousedown" phase="capturing">
       <![CDATA[
         if (event.originalTarget.getAttribute("anonid") == "searchbar-search-button") {
           this._clickClosedPopup = this._textbox.popup._isHiding;
         }
       ]]></handler>
 
-      <handler event="click" button="0">
+      <handler event="mousedown" button="0">
       <![CDATA[
         // Ignore clicks on the search go button.
         if (event.originalTarget.getAttribute("anonid") == "search-go-button") {
           return;
         }
 
         let isIconClick = event.originalTarget.getAttribute("anonid") == "searchbar-search-button";