browser/base/content/test/general/browser_tabs_isActive.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   test_tab("about:blank");
     6   test_tab("about:license");
     7 }
     9 function test_tab(url) {
    10   let originalTab = gBrowser.selectedTab;
    11   let newTab = gBrowser.addTab(url, {skipAnimation: true});
    12   is(tabIsActive(newTab), false, "newly added " + url + " tab is not active");
    13   is(tabIsActive(originalTab), true, "original tab is active initially");
    15   gBrowser.selectedTab = newTab;
    16   is(tabIsActive(newTab), true, "newly added " + url + " tab is active after selection");
    17   is(tabIsActive(originalTab), false, "original tab is not active while unselected");
    19   gBrowser.selectedTab = originalTab;
    20   is(tabIsActive(newTab), false, "newly added " + url + " tab is not active after switch back");
    21   is(tabIsActive(originalTab), true, "original tab is active again after switch back");
    23   gBrowser.removeTab(newTab);
    24 }
    26 function tabIsActive(tab) {
    27   let browser = tab.linkedBrowser;
    28   return browser.docShell.isActive;
    29 }

mercurial