Bug 1110235 - Clicking on the header region of the search dropdown should trigger a search with the default engine. r=florian, a=sledru
authorFelipe Gomes <felipc@gmail.com>
Thu, 18 Dec 2014 14:08:17 -0200
changeset 235602 68cc16f708c69885838d9a1c9cf43755823ccffb
parent 235601 2bda8e5c35c1fe0eace98554bbf7f7ba1e5185f2
child 235603 cf5b60ff001d157d5e3659c64eabe4fea392bb8d
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, sledru
bugs1110235
milestone35.0
Bug 1110235 - Clicking on the header region of the search dropdown should trigger a search with the default engine. r=florian, a=sledru
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1017,16 +1017,18 @@
         }
 
         const kBundleURI = "chrome://browser/locale/search.properties";
         let bundle = Services.strings.createBundle(kBundleURI);
         let headerText = bundle.formatStringFromName("searchHeader",
                                                      [currentEngine.name], 1);
         document.getAnonymousElementByAttribute(this, "anonid", "searchbar-engine-name")
                 .setAttribute("value", headerText);
+        document.getAnonymousElementByAttribute(this, "anonid", "searchbar-engine")
+                .engine = currentEngine;
 
         // Update the 'Search for <keywords> with:" header.
         let headerSearchText =
           document.getAnonymousElementByAttribute(this, "anonid",
                                                   "searchbar-oneoffheader-searchtext");
         let textbox = searchbar.textbox;
         let self = this;
         let keyPressHandler = function() {
@@ -1175,21 +1177,23 @@
         }
       ]]></handler>
 
       <handler event="click"><![CDATA[
         if (event.button == 2)
           return; // ignore right clicks.
 
         let button = event.originalTarget;
-        if (button.localName != "button" || !button.engine)
+        let engine = button.engine || button.parentNode.engine;
+
+        if (!engine)
           return;
 
         let searchbar = document.getElementById("searchbar");
-        searchbar.handleSearchCommand(event, button.engine);
+        searchbar.handleSearchCommand(event, engine);
       ]]></handler>
 
       <handler event="command"><![CDATA[
         let target = event.originalTarget;
         if (target.classList.contains("addengine-item")) {
           // On success, hide and reshow the panel to show the new engine.
           let installCallback = {
             onSuccess: function(engine) {