Bug 509877: Show awsomescreen on opening new tab, r=mfinkle
authorBenjamin Stover <ben@vidoop.com>
Tue, 25 Aug 2009 23:45:11 -0400
changeset 65476 ff622d1760a3df3d2630b9ecda2bbf2fd14d11bc
parent 65475 0c697d3ff8f6245309b62fc01818e62c92b2cb7a
child 65477 a788213e9f2dcd48fbde3fb1c5f5c5fb203d0d54
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs509877
Bug 509877: Show awsomescreen on opening new tab, r=mfinkle
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -394,28 +394,34 @@ var BrowserUI = {
 
   update : function(aState) {
     let icons = document.getElementById("urlbar-icons");
     let uri = Browser.selectedBrowser.currentURI;
 
     switch (aState) {
       case TOOLBARSTATE_LOADED:
         icons.setAttribute("mode", "view");
-        this.showToolbar(uri.spec == "about:blank");
+        
+        // We handle showing the toolbar for new tabs in BrowserUI.newTab()
+        if (uri.spec != "about:blank") {
+          this.showToolbar(false);
+        }
 
         if (!this._faviconLink)
           this._faviconLink = uri.prePath + "/favicon.ico";
         this._setIcon(this._faviconLink);
         this.updateIcon();
         this._faviconLink = null;
         break;
 
       case TOOLBARSTATE_LOADING:
         this.showToolbar();
-        // Force the mode back to "loading"
+        
+        // Force the mode back to "loading" since showToolbar() changes it to "view"
+        // and that messes up the CSS rules depending on the "mode" attribute
         icons.setAttribute("mode", "loading");
 
         this._favicon.src = "";
         this._faviconLink = null;
         this.updateIcon();
         break;
     }
   },
@@ -544,18 +550,19 @@ var BrowserUI = {
     // XXX Fix me with a real UI
   },
 
   showBookmarks : function () {
     BookmarkList.show();
   },
 
   newTab : function newTab(aURI) {
-    //ws.panTo(0, -this.toolbarH);
-    return Browser.addTab(aURI || "about:blank", true);
+    let tab = Browser.addTab(aURI || "about:blank", true);
+    this.showAutoComplete();
+    return tab;
   },
 
   closeTab : function closeTab(aTab) {
     // If no tab is passed in, assume the current tab
     Browser.closeTab(aTab || Browser.selectedTab);
   },
 
   selectTab : function selectTab(aTab) {
@@ -695,17 +702,17 @@ var BrowserUI = {
       case "cmd_search":
         this.search();
         break;
       case "cmd_go":
         this.goToURI();
         break;
       case "cmd_openLocation":
         this.showToolbar(true);
-        setTimeout(function () { BrowserUI.showAutoComplete(); }, 0);
+        BrowserUI.showAutoComplete();
         break;
       case "cmd_star":
       {
         var bookmarkURI = browser.currentURI;
         var bookmarkTitle = browser.contentDocument.title || bookmarkURI.spec;
 
         let autoClose = false;