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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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