Bug 1205385 - Focus urlbar when search suggestions opt-in is dismissed only after pressing an opt-in accesskey. r=mak
authorDrew Willcoxon <adw@mozilla.com>
Thu, 17 Sep 2015 09:37:35 -0700
changeset 295600 87008f7ea9d077df7e318d636a804d1c52203ef3
parent 295599 0159f007b4028f5394e14c6792f213c15a375c24
child 295601 214fe6c504eca1de730ab8234a2649c36ae3cd96
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)
reviewersmak
bugs1205385
milestone43.0a1
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
Bug 1205385 - Focus urlbar when search suggestions opt-in is dismissed only after pressing an opt-in accesskey. r=mak
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -658,22 +658,16 @@ file, You can obtain one at http://mozil
                 this.timeout = this._prefs.getIntPref(aData);
                 break;
               case "formatting.enabled":
                 this._formattingEnabled = this._prefs.getBoolPref(aData);
                 break;
               case "userMadeSearchSuggestionsChoice":
               case "suggest.searches":
                 this._cacheUserMadeSearchSuggestionsChoice();
-                // Make sure the urlbar is focused.  It won't be, for example,
-                // if the user used an accesskey to make an opt-in choice.
-                // mIgnoreFocus prevents the text from being selected.
-                this.mIgnoreFocus = true;
-                this.focus();
-                this.mIgnoreFocus = false;
                 if (this._userMadeSearchSuggestionsChoice) {
                   this.popup.searchSuggestionsNotificationWasDismissed(
                     this._prefs.getBoolPref("suggest.searches")
                   );
                 }
                 break;
               case "trimURLs":
                 this._mayTrimURLs = this._prefs.getBoolPref(aData);
@@ -1184,16 +1178,23 @@ file, You can obtain one at http://mozil
         );
         openUILinkIn(url, "tab");
         ]]></body>
       </method>
 
       <method name="dismissSearchSuggestionsNotification">
         <parameter name="enableSuggestions"/>
         <body><![CDATA[
+          // Make sure the urlbar is focused.  It won't be, for example, if the
+          // user used an accesskey to make an opt-in choice.  mIgnoreFocus
+          // prevents the text from being selected.
+          this.input.mIgnoreFocus = true;
+          this.input.focus();
+          this.input.mIgnoreFocus = false;
+
           Services.prefs.setBoolPref(
             "browser.urlbar.suggest.searches", enableSuggestions
           );
           Services.prefs.setBoolPref(
             "browser.urlbar.userMadeSearchSuggestionsChoice", true
           );
           // The input's pref observer will now hide the notification.
         ]]></body>