Bug 563337 - "Error: preview is undefined" and "this.preview is undefined" when closing the last tab with browser.tabs.closeWindowWithLastTab = false. r=gavin
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1532,18 +1532,20 @@
this._removingTabs.length == 0 &&
(this._windowIsClosing = window.closeWindow(true)))
return null;
newTab = true;
}
this._removingTabs.push(aTab);
-
- this.tabContainer.updateVisibility();
+ if (newTab)
+ this.addTab("about:blank", {skipAnimation: true});
+ else
+ this.tabContainer.updateVisibility();
// We're committed to closing the tab now.
// Dispatch a notification.
// We dispatch it before any teardown so that event listeners can
// inspect the tab that's about to close.
var evt = document.createEvent("UIEvent");
evt.initUIEvent("TabClose", true, false, window, aTabWillBeMoved ? 1 : 0);
aTab.dispatchEvent(evt);
@@ -1589,18 +1591,16 @@
aCloseWindow = false;
aNewTab = false;
}
this._lastRelatedTab = null;
// update the UI early for responsiveness
aTab.collapsed = true;
- if (aNewTab)
- this.addTab("about:blank", {skipAnimation: true});
this.tabContainer._fillTrailingGap();
this._blurTab(aTab);
this._removingTabs.splice(this._removingTabs.indexOf(aTab), 1);
if (aCloseWindow) {
this._windowIsClosing = true;
while (this._removingTabs.length)