Bug 457096 - When closing the last tab, two tabs are briefly visible (browser.tabs.closeWindowWithLastTab = false). r=gavin

This commit is contained in:
Dão Gottwald 2009-03-25 10:54:33 +01:00
Родитель 8ad19fa874
Коммит 2a46a7adf6
1 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -1541,17 +1541,14 @@
var closeWindow = false; var closeWindow = false;
var l = this.mTabs.length - this._removingTabs.length; var l = this.mTabs.length - this._removingTabs.length;
var newTab;
if (l == 1) { if (l == 1) {
closeWindow = aCloseWindowWithLastTab != null ? closeWindow = aCloseWindowWithLastTab != null ?
aCloseWindowWithLastTab : aCloseWindowWithLastTab :
this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab"); this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
// BrowserOpenTab focuses the location bar. Use it only if that's newTab = this.addTab("about:blank");
// really wanted. newTab.collapsed = true;
if (closeWindow)
this.addTab("about:blank");
else
BrowserOpenTab();
l++; l++;
} }
if (l == 2) { if (l == 2) {
@ -1589,7 +1586,7 @@
tab.owner = null; tab.owner = null;
}); });
return [aTab, closeWindow]; return [aTab, closeWindow, newTab];
]]> ]]>
</body> </body>
</method> </method>
@ -1600,7 +1597,7 @@
<![CDATA[ <![CDATA[
if (!args) if (!args)
return; return;
var [aTab, aCloseWindow] = args; var [aTab, aCloseWindow, aNewTab] = args;
// update the UI early for responsiveness // update the UI early for responsiveness
aTab.collapsed = true; aTab.collapsed = true;
@ -1620,6 +1617,12 @@
aTabContainer.mTabstrip._updateScrollButtonsDisabledState(); aTabContainer.mTabstrip._updateScrollButtonsDisabledState();
}; };
setTimeout(_delayedUpdate, 0, this.tabContainer); setTimeout(_delayedUpdate, 0, this.tabContainer);
if (aNewTab) {
aNewTab.collapsed = false;
if (gURLBar)
gURLBar.focus();
}
} }
// We're going to remove the tab and the browser now. // We're going to remove the tab and the browser now.