Bug 585361 - Handle requests for synchronously removing an already asynchronously closing tab. r=gavin

This commit is contained in:
Dão Gottwald 2010-08-11 14:02:49 +02:00
parent 83666a4b0d
commit 614ec4a44c
3 changed files with 16 additions and 6 deletions

View File

@ -1323,10 +1323,19 @@
<parameter name="aParams"/>
<body>
<![CDATA[
var isLastTab = (this.tabs.length - this._removingTabs.length == 1);
if (aParams)
var animate = aParams.animate;
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate &&
this._removingTabs.indexOf(aTab) > -1) {
this._endRemoveTab(aTab);
return;
}
var isLastTab = (this.tabs.length - this._removingTabs.length == 1);
if (!this._beginRemoveTab(aTab, false, null, true))
return;
@ -2404,7 +2413,7 @@
var tabs = document.getBindingParent(this);
tabs.removeAttribute("overflow");
tabs.tabbrowser._removingTabs.forEach(tabs.tabbrowser._endRemoveTab,
tabs.tabbrowser._removingTabs.forEach(tabs.tabbrowser.removeTab,
tabs.tabbrowser);
tabs._positionPinnedTabs();

View File

@ -5,6 +5,11 @@ function test() {
gBrowser.removeTab(tab);
is(tab.parentNode, null, "tab removed immediately");
tab = gBrowser.addTab("about:blank", { skipAnimation: true });
gBrowser.removeTab(tab, { animate: true });
gBrowser.removeTab(tab);
is(tab.parentNode, null, "tab removed immediately when calling removeTab again after the animation was kicked off");
waitForExplicitFinish();
Services.prefs.setBoolPref("browser.tabs.animate", true);

View File

@ -83,10 +83,6 @@ Tester.prototype = {
let msg = baseMsg.replace("{elt}", "tab") +
": " + lastTab.linkedBrowser.currentURI.spec;
this.currentTest.addResult(new testResult(false, msg, "", false));
if (gBrowser._removingTabs && gBrowser._removingTabs.indexOf(lastTab) > -1) {
gBrowser._endRemoveTab(lastTab);
continue;
}
gBrowser.removeTab(lastTab);
}
}