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.

     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/. */
     5 // Bug 587922: tabs don't get removed if they're hidden
     7 function test() {
     8   waitForExplicitFinish();
    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;
    15   let numVisBeforeHide, numVisAfterHide;
    16   gBrowser.tabContainer.addEventListener("TabSelect", function() {
    17     gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee, false);
    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});
    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();
    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 }

mercurial