browser_hide_removing.js (1136B)
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 add_setup(async function () { 8 await SpecialPowers.pushPrefEnv({ 9 set: [["test.wait300msAfterTabSwitch", true]], 10 }); 11 }); 12 13 add_task(async function () { 14 // Add a tab that will get removed and hidden 15 let testTab = BrowserTestUtils.addTab(gBrowser, "about:blank", { 16 skipAnimation: true, 17 }); 18 is(gBrowser.visibleTabs.length, 2, "just added a tab, so 2 tabs"); 19 await BrowserTestUtils.switchTab(gBrowser, testTab); 20 21 let numVisBeforeHide, numVisAfterHide; 22 23 // We have to animate the tab removal in order to get an async 24 // tab close. 25 BrowserTestUtils.removeTab(testTab, { animate: true }); 26 27 numVisBeforeHide = gBrowser.visibleTabs.length; 28 gBrowser.hideTab(testTab); 29 numVisAfterHide = gBrowser.visibleTabs.length; 30 31 is(numVisBeforeHide, 1, "animated remove has in 1 tab left"); 32 is(numVisAfterHide, 1, "hiding a removing tab also has 1 tab"); 33 });