Bug 617795 - Blank tab is not closed correctly when it is about:empty or is the only tab [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 09 Dec 2010 13:24:06 -0800
changeset 67099 f05b417eb61f94cdc5a162279cb659f85f747340
parent 67098 90999965babda98b899b90c92d2ea7ea338acadb
child 67100 c9c28ad8afa9bf084bb718945024d2828b7679ad
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
bugs617795
Bug 617795 - Blank tab is not closed correctly when it is about:empty or is the only tab [r=mfinkle]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -529,22 +529,24 @@ var Browser = {
     // We need to keep about: pages opening in new "local" tabs. We also want to spawn
     // new "remote" tabs if opening web pages from a "local" about: page.
     let currentURI = browser.currentURI.spec;
     let useLocal = Util.isLocalScheme(aURI);
     let hasLocal = Util.isLocalScheme(currentURI);
 
     if (hasLocal != useLocal) {
       let oldTab = this.selectedTab;
-      if (currentURI == "about:blank" && !browser.canGoBack && !browser.canGoForward) {
+
+      // Add new tab before closing the old one, in case there is only one.
+      Browser.addTab(aURI, true, oldTab, aParams);
+      if (/^about:(blank|empty)$/.test(currentURI) && !browser.canGoBack && !browser.canGoForward) {
         oldTab.chromeTab.ignoreUndo = true;
         this.closeTab(oldTab);
         oldTab = null;
       }
-      Browser.addTab(aURI, true, oldTab, aParams);
     }
     else {
       let params = aParams || {};
       let flags = params.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
       browser.loadURIWithFlags(aURI, flags, params.referrerURI, params.charset, params.postData);
     }
   },