Bug 792390 - Avoid calling textbox.focus() before textbox.select(). r=enn
authorDão Gottwald <dao@mozilla.com>
Wed, 19 Sep 2012 18:55:21 +0200
changeset 107489 b267a6f936fd893cdce228a358818f3cd2423ae9
parent 107488 7276747d52605bf16fbe4a9b5aced5174f83d359
child 107490 c0d1f69cc901b06c8febfc12f3363aa8de28694b
push id15068
push userdgottwald@mozilla.com
push dateWed, 19 Sep 2012 16:56:02 +0000
treeherdermozilla-inbound@b267a6f936fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs792390
milestone18.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 792390 - Avoid calling textbox.focus() before textbox.select(). r=enn
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1978,21 +1978,19 @@ function loadOneOrMoreURIs(aURIString)
   }
 }
 
 function focusAndSelectUrlBar() {
   if (gURLBar) {
     if (window.fullScreen)
       FullScreen.mouseoverToggle(true);
 
-    gURLBar.focus();
-    if (document.activeElement == gURLBar.inputField) {
-      gURLBar.select();
+    gURLBar.select();
+    if (document.activeElement == gURLBar.inputField)
       return true;
-    }
   }
   return false;
 }
 
 function openLocation() {
   if (focusAndSelectUrlBar())
     return;
 
@@ -3324,22 +3322,19 @@ const BrowserSearch = {
       }
       return;
     }
 #endif
     var searchBar = this.searchBar;
     if (searchBar && window.fullScreen)
       FullScreen.mouseoverToggle(true);
     if (searchBar)
-      searchBar.focus();
-    if (searchBar && document.activeElement == searchBar.textbox.inputField) {
       searchBar.select();
-    } else {
+    if (!searchBar || document.activeElement != searchBar.textbox.inputField)
       openUILinkIn(Services.search.defaultEngine.searchForm, "current");
-    }
   },
 
   /**
    * Loads a search results page, given a set of search terms. Uses the current
    * engine if the search bar is visible, or the default engine otherwise.
    *
    * @param searchText
    *        The search terms to use for the search.