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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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