netwerk/test/unit/test_cache2-15-conditional-304.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 function run_test()
     2 {
     3   do_get_profile();
     5   // Open for write, write
     6   asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
     7     new OpenCallback(NEW, "31m", "31d", function(entry) {
     8       // Open normally but wait for validation from the server
     9       asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    10         new OpenCallback(REVAL, "31m", "31d", function(entry) {
    11           // emulate 304 from the server
    12           do_execute_soon(function() {
    13             entry.setValid(); // this will trigger OpenCallbacks bellow
    14           });
    15         })
    16       );
    18       var mc = new MultipleCallbacks(3, finish_cache2_test);
    20       asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    21         new OpenCallback(NORMAL, "31m", "31d", function(entry) {
    22           mc.fired();
    23         })
    24       );
    25       asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    26         new OpenCallback(NORMAL, "31m", "31d", function(entry) {
    27           mc.fired();
    28         })
    29       );
    30       asyncOpenCacheEntry("http://304/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
    31         new OpenCallback(NORMAL, "31m", "31d", function(entry) {
    32           mc.fired();
    33         })
    34       );
    35     })
    36   );
    38   do_test_pending();
    39 }

mercurial