Bug 1316863 - stop manually closing the search popup to solve issues that seem to not exist anymore, r=florian,nhnt11,a=jcristau
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 16 Nov 2016 13:33:37 +0000
changeset 353059 315219009f706d386fb26430e72eaa6e947bce1d
parent 353058 818666e181d63b44c88a782c0d81f6a9d6d51134
child 353060 2e3b36eb8a252a2073c89f6d82e1211b668e7ec2
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, nhnt11, jcristau
bugs1316863
milestone52.0a2
Bug 1316863 - stop manually closing the search popup to solve issues that seem to not exist anymore, r=florian,nhnt11,a=jcristau MozReview-Commit-ID: 3lcONwqYEFc
browser/base/content/urlbarBindings.xml
browser/components/search/content/search.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1292,32 +1292,35 @@ file, You can obtain one at http://mozil
             return;
           }
 
           // Check for middle-click or modified clicks on the search bar
           if (popupForSearchBar) {
             // Handle search bar popup clicks
             var search = controller.getValueAt(this.selectedIndex);
 
-            // close the autocomplete popup and revert the entered search term
-            this.closePopup();
-            controller.handleEscape();
-
             // open the search results according to the clicking subtlety
             var where = whereToOpenLink(aEvent, false, true);
             let params = {};
 
             // But open ctrl/cmd clicks on autocomplete items in a new background tab.
             let modifier = this.AppConstants.platform == "macosx" ?
                            aEvent.metaKey :
                            aEvent.ctrlKey;
             if (where == "tab" && (aEvent instanceof MouseEvent) &&
                 (aEvent.button == 1 || modifier))
               params.inBackground = true;
 
+            // leave the popup open for background tab loads
+            if (!(where == "tab" && params.inBackground)) {
+              // close the autocomplete popup and revert the entered search term
+              this.closePopup();
+              controller.handleEscape();
+            }
+
             searchBar.doSearch(search, where, null, params);
             if (where == "tab" && params.inBackground)
               searchBar.focus();
             else
               searchBar.value = search;
           }
         ]]></body>
       </method>
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1972,24 +1972,16 @@
           return; // ignore right clicks.
 
         let button = event.originalTarget;
         let engine = button.engine || button.parentNode.engine;
 
         if (!engine)
           return;
 
-        // For some reason, if the context menu had been opened prior to the
-        // click, the suggestions popup won't be closed after loading the search
-        // in the current tab - so we hide it manually. Some focusing magic
-        // that happens when a search is loaded ensures that the popup is opened
-        // again if it needs to be, so we don't need to worry about which cases
-        // require manual hiding.
-        this.popup.hidePopup();
-
         // Select the clicked button so that consumers can easily tell which
         // button was acted on.
         this.selectedButton = button;
         this.handleSearchCommand(event, engine);
       ]]></handler>
 
       <handler event="command"><![CDATA[
         let target = event.originalTarget;