All pastes #122633 Raw Edit

Mossop

public text v1 · immutable
·published 2006-08-08 20:28 UTC
rendered paste body
Index: browser/base/content/browser.js
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
retrieving revision 1.676
diff -u -8 -p -r1.676 browser.js
--- browser/base/content/browser.js	7 Aug 2006 22:54:45 -0000	1.676
+++ browser/base/content/browser.js	8 Aug 2006 18:43:32 -0000
@@ -1813,19 +1813,21 @@ function addBookmarkForBrowser(aDocShell
     title = url;
   }
   BookmarksUtils.addBookmark(url, title, charSet, aIsWebPanel, description);
 }
 #endif
 
 function openLocation()
 {
-  if (gURLBar && !gURLBarContainer.parentNode.collapsed &&
-      (document.defaultView.getComputedStyle(gURLBarContainer, null).display
-       != "none")) {
+  var style;
+  if (gURLBarContainer)
+    style = document.defaultView.getComputedStyle(gURLBarContainer, null);
+  if (gURLBar && 
+      style.visibility == "visible" && style.display != "none") {
     gURLBar.focus();
     gURLBar.select();
   }
 #ifdef XP_MACOSX
   else if (window.location.href != getBrowserURL()) {
     var win = getTopWin();
     if (win) {
       // If there's an open browser window, it should handle this command
@@ -3140,19 +3142,22 @@ const BrowserSearch = {
   },
 
   /**
    * Returns the search bar element if it is present in the toolbar and not
    * hidden, null otherwise.
    */
   getSearchBar: function BrowserSearch_getSearchBar() {
     var searchBar = document.getElementById("searchbar");
-    if (searchBar && !searchBar.parentNode.parentNode.collapsed &&
-        window.getComputedStyle(searchBar.parentNode, null).display != "none")
-      return searchBar;
+    var style;
+    if (searchBar) {
+      var style = window.getComputedStyle(searchBar.parentNode, null);
+      if (style.visibility == "visible" && style.display != "none")
+        return searchBar;
+    }
     return null;
   },
 
   loadAddEngines: function BrowserSearch_loadAddEngines() {
     var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
     var where = newWindowPref == 3 ? "tab" : "window";
     var regionBundle = document.getElementById("bundle_browser_region");
     var searchEnginesURL = regionBundle.getString("searchEnginesURL");