michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // Bug 587922: tabs don't get removed if they're hidden michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: // Add a tab that will get removed and hidden michael@0: let testTab = gBrowser.addTab("about:blank", {skipAnimation: true}); michael@0: is(gBrowser.visibleTabs.length, 2, "just added a tab, so 2 tabs"); michael@0: gBrowser.selectedTab = testTab; michael@0: michael@0: let numVisBeforeHide, numVisAfterHide; michael@0: gBrowser.tabContainer.addEventListener("TabSelect", function() { michael@0: gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee, false); michael@0: michael@0: // While the next tab is being selected, hide the removing tab michael@0: numVisBeforeHide = gBrowser.visibleTabs.length; michael@0: gBrowser.hideTab(testTab); michael@0: numVisAfterHide = gBrowser.visibleTabs.length; michael@0: }, false); michael@0: gBrowser.removeTab(testTab, {animate: true}); michael@0: michael@0: // Make sure the tab gets removed at the end of the animation by polling michael@0: (function checkRemoved() setTimeout(function() { michael@0: if (gBrowser.tabs.length != 1) michael@0: return checkRemoved(); michael@0: michael@0: is(numVisBeforeHide, 1, "animated remove has in 1 tab left"); michael@0: is(numVisAfterHide, 1, "hiding a removing tab is also has 1 tab"); michael@0: finish(); michael@0: }, 50))(); michael@0: }