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 242546 105f49fda652dad6765ea2cd1ffbf8bb4562a1e5
parent 242545 197b58471fe1ff088f54af1fc474af1fa6897c97
child 242547 b573f064a72519ac4c8afa8aa76e072a0d24b416
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, sledru
bugs1110235
milestone36.0a2
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
@@ -1035,16 +1035,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 inputHandler = function() {
@@ -1195,21 +1197,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) {