browser/components/sessionstore/test/browser_624727.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   TestRunner.run();
     6 }
     8 function runTests() {
     9   function assertNumberOfTabs(num, msg) {
    10     is(gBrowser.tabs.length, num, msg);
    11   }
    13   function assertNumberOfPinnedTabs(num, msg) {
    14     is(gBrowser._numPinnedTabs, num, msg);
    15   }
    17   // check prerequisites
    18   assertNumberOfTabs(1, "we start off with one tab");
    19   assertNumberOfPinnedTabs(0, "no pinned tabs so far");
    21   // setup
    22   gBrowser.addTab("about:blank");
    23   assertNumberOfTabs(2, "there are two tabs, now");
    25   let [tab1, tab2] = gBrowser.tabs;
    26   let linkedBrowser = tab1.linkedBrowser;
    27   gBrowser.pinTab(tab1);
    28   gBrowser.pinTab(tab2);
    29   assertNumberOfPinnedTabs(2, "both tabs are now pinned");
    31   // run the test
    32   yield waitForBrowserState(
    33     { windows: [{ tabs: [{ url: "about:blank" }] }] },
    34     function () {
    35       assertNumberOfTabs(1, "one tab left after setBrowserState()");
    36       assertNumberOfPinnedTabs(0, "there are no pinned tabs");
    37       is(gBrowser.tabs[0].linkedBrowser, linkedBrowser, "first tab's browser got re-used");
    38       next();
    39     }
    40   );
    41 }

mercurial