netwerk/test/unit/test_cache2-14-concurent-readers.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 function run_test()
     2 {
     3   do_get_profile();
     5   asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
     6     new OpenCallback(NEW, "x1m", "x1d", function(entry) {
     7       // nothing to do here, we expect concurent callbacks to get
     8       // all notified, then the test finishes
     9     })
    10   );
    12   var mc = new MultipleCallbacks(3, finish_cache2_test);
    14   asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    15     new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
    16       mc.fired();
    17     })
    18   );
    19   asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    20     new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
    21       mc.fired();
    22     })
    23   );
    24   asyncOpenCacheEntry("http://x/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    25     new OpenCallback(NORMAL, "x1m", "x1d", function(entry) {
    26       mc.fired();
    27     })
    28   );
    30   do_test_pending();
    31 }

mercurial