Bug 1316863 - stop manually closing the search popup to solve issues that seem to not exist anymore, r?nhnt11,florian draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 16 Nov 2016 13:33:37 +0000
changeset 447047 759c3ebafa2511a119a9660e984212dff539475d
parent 447006 f65ad27efe839ce9df0283840a1a40b4bbc9ead0
child 538940 6b4dbcb4b56883acd93d63acc59d11349c901296
push id37958
push userbmo:gijskruitbosch+bugs@gmail.com
push dateFri, 02 Dec 2016 11:49:56 +0000
reviewersnhnt11, florian
bugs1316863
milestone53.0a1
Bug 1316863 - stop manually closing the search popup to solve issues that seem to not exist anymore, r?nhnt11,florian MozReview-Commit-ID: 3lcONwqYEFc
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -969,32 +969,35 @@
             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>
@@ -2222,24 +2225,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;