|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 // Bug 587922: tabs don't get removed if they're hidden |
|
6 |
|
7 function test() { |
|
8 waitForExplicitFinish(); |
|
9 |
|
10 // Add a tab that will get removed and hidden |
|
11 let testTab = gBrowser.addTab("about:blank", {skipAnimation: true}); |
|
12 is(gBrowser.visibleTabs.length, 2, "just added a tab, so 2 tabs"); |
|
13 gBrowser.selectedTab = testTab; |
|
14 |
|
15 let numVisBeforeHide, numVisAfterHide; |
|
16 gBrowser.tabContainer.addEventListener("TabSelect", function() { |
|
17 gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee, false); |
|
18 |
|
19 // While the next tab is being selected, hide the removing tab |
|
20 numVisBeforeHide = gBrowser.visibleTabs.length; |
|
21 gBrowser.hideTab(testTab); |
|
22 numVisAfterHide = gBrowser.visibleTabs.length; |
|
23 }, false); |
|
24 gBrowser.removeTab(testTab, {animate: true}); |
|
25 |
|
26 // Make sure the tab gets removed at the end of the animation by polling |
|
27 (function checkRemoved() setTimeout(function() { |
|
28 if (gBrowser.tabs.length != 1) |
|
29 return checkRemoved(); |
|
30 |
|
31 is(numVisBeforeHide, 1, "animated remove has in 1 tab left"); |
|
32 is(numVisAfterHide, 1, "hiding a removing tab is also has 1 tab"); |
|
33 finish(); |
|
34 }, 50))(); |
|
35 } |