Bug 481560 - tab closes and location bar clears before the window closes. r=gavin

This commit is contained in:
Dão Gottwald 2009-04-05 10:10:24 +02:00
Родитель 82ad98fe12
Коммит 1244bc4295
3 изменённых файлов: 31 добавлений и 1 удалений

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

@ -1510,7 +1510,7 @@
<parameter name="aTab"/>
<body>
<![CDATA[
this._endRemoveTab(this._beginRemoveTab(aTab, true));
this._endRemoveTab(this._beginRemoveTab(aTab, true, null, true));
]]>
</body>
</method>
@ -1526,6 +1526,7 @@
<parameter name="aTab"/>
<parameter name="aFireBeforeUnload"/>
<parameter name="aCloseWindowWithLastTab"/>
<parameter name="aCloseWindowFastpath"/>
<body>
<![CDATA[
if (this._removingTabs.indexOf(aTab) > -1 || this._windowIsClosing)
@ -1547,6 +1548,15 @@
aCloseWindowWithLastTab :
this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
// Closing the tab and replacing it with a blank one is notably slower
// than closing the window right away. If the caller opts in, take
// the fast path.
if (closeWindow &&
aCloseWindowFastpath &&
this._removingTabs.length == 0 &&
(this._windowIsClosing = window.closeWindow(true)))
return null;
newTab = this.addTab("about:blank");
newTab.collapsed = true;
l++;

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

@ -74,6 +74,7 @@ _BROWSER_FILES = browser_sanitize-timespans.js \
browser_bug441778.js \
browser_bug455852.js \
browser_bug462673.js \
browser_bug481560.js \
browser_discovery.js \
discovery.html \
moz.png \

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

@ -0,0 +1,19 @@
function test() {
waitForExplicitFinish();
var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
win.addEventListener("load", function () {
win.removeEventListener("load", arguments.callee, false);
win.gBrowser.selectedTab.addEventListener("TabClose", function () {
ok(false, "shouldn't have gotten the TabClose event for the last tab");
}, false);
EventUtils.synthesizeKey("w", { accelKey: true }, win);
ok(win.closed, "accel+w closed the window immediately");
finish();
}, false);
}