browser/base/content/test/general/browser_hide_removing.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial