Backed out changeset d79fb9007765 (bug 1139655) for browser_searchbar_keyboard_navigation.js failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 11 Sep 2015 11:08:13 -0700
changeset 294741 1199232e985b2b477d770f336af9edc19f004c6c
parent 294740 0c7ecbc664434f625d2a74349836d6fedfd85075
child 294742 7ae566736bc0125dfd77872768ed29ae274b1d63
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1139655
milestone43.0a1
backs outd79fb9007765485213040ea6d869d41b499de80a
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
Backed out changeset d79fb9007765 (bug 1139655) for browser_searchbar_keyboard_navigation.js failures CLOSED TREE
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -722,17 +722,17 @@
       <!-- override |onTextEntered| in autocomplete.xml -->
       <method name="onTextEntered">
         <parameter name="aEvent"/>
         <body><![CDATA[
           var evt = aEvent || this.mEnterEvent;
 
           let engine;
           let oneOff = this.selectedButton;
-          if (oneOff && !this.selectionFromMouseOver) {
+          if (oneOff) {
             if (!oneOff.engine) {
               oneOff.doCommand();
               this.mEnterEvent = null;
               return;
             }
             engine = oneOff.engine;
           }
           if (this.mEnterEvent && this._selectionDetails &&
@@ -744,19 +744,16 @@
 
           this.mEnterEvent = null;
         ]]></body>
       </method>
 
       <field name="_selectedButton"/>
       <property name="selectedButton" onget="return this._selectedButton;">
         <setter><![CDATA[
-          // Set to true from the mouseover handler right after this setter call.
-          this.selectionFromMouseOver = false;
-
           if (this._selectedButton)
             this._selectedButton.removeAttribute("selected");
 
           let textbox = document.getBindingParent(this).textbox;
           let header =
             document.getAnonymousElementByAttribute(this.popup, "anonid",
                                                     "search-panel-one-offs-header");
           // Avoid selecting dummy buttons.
@@ -1201,16 +1198,20 @@
             addEngineList.appendChild(button);
           }
         }
 
         // Finally, build the list of one-off buttons.
         while (list.firstChild)
           list.firstChild.remove();
 
+        // Avoid setting the selection based on mouse events before
+        // the 'popupshown' event has fired.
+        this._ignoreMouseEvents = true;
+
         let Preferences =
           Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences;
         let pref = Preferences.get("browser.search.hiddenOneOffs");
         let hiddenList = pref ? pref.split(",") : [];
 
         let currentEngineName = Services.search.currentEngine.name;
         let engines = Services.search.getVisibleEngines()
                               .filter(e => e.name != currentEngineName &&
@@ -1292,34 +1293,41 @@
 
           if (!--dummyItems)
             button.classList.add("last-of-row");
 
           list.appendChild(button);
         }
       ]]></handler>
 
+      <handler event="popupshown"><![CDATA[
+        this._ignoreMouseEvents = false;
+      ]]></handler>
+
       <handler event="mousedown"><![CDATA[
         // Required to receive click events from the buttons on Linux.
         event.preventDefault();
       ]]></handler>
 
       <handler event="mouseover"><![CDATA[
         let target = event.originalTarget;
         if (target.localName != "button")
           return;
 
+        // We ignore mouse events between the popupshowing and popupshown
+        // events to avoid selecting the button that happens to be under the
+        // mouse when the panel opens.
+        if (this._ignoreMouseEvents)
+          return;
+
         if ((target.classList.contains("searchbar-engine-one-off-item") &&
              !target.classList.contains("dummy")) ||
             target.classList.contains("addengine-item") ||
-            target.classList.contains("search-setting-button")) {
-          let textbox = document.getElementById("searchbar").textbox;
-          textbox.selectedButton = target;
-          textbox.selectionFromMouseOver = true;
-        }
+            target.classList.contains("search-setting-button"))
+          document.getElementById("searchbar").textbox.selectedButton = target;
       ]]></handler>
 
       <handler event="mouseout"><![CDATA[
         let target = event.originalTarget;
         if (target.localName != "button")
           return;
 
         let textbox = document.getElementById("searchbar").textbox;