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 107618 b267a6f936fd893cdce228a358818f3cd2423ae9
parent 107617 7276747d52605bf16fbe4a9b5aced5174f83d359
child 107619 c0d1f69cc901b06c8febfc12f3363aa8de28694b
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersenn
bugs792390
milestone18.0a1
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.