netwerk/test/unit/test_cache2-22-anon-visit.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
     3 function run_test()
     4 {
     5   do_get_profile();
     7   function checkNewBackEnd()
     8   {
     9     var storage = getCacheStorage("disk", LoadContextInfo.default);
    10     storage.asyncVisitStorage(
    11       new VisitCallback(1, 12, ["http://an2/"], function() {
    12         storage = getCacheStorage("disk", LoadContextInfo.anonymous);
    13         storage.asyncVisitStorage(
    14           new VisitCallback(1, 12, ["http://an2/"], function() {
    15             finish_cache2_test();
    16           }),
    17           true
    18         );
    19       }),
    20       true
    21     );
    22   }
    24   function checkOldBackEnd()
    25   {
    26     syncWithCacheIOThread(function() {
    27       var storage = getCacheStorage("disk", LoadContextInfo.default);
    28       storage.asyncVisitStorage(
    29         new VisitCallback(2, 24, ["http://an2/", "anon&uri=http://an2/"], function() {
    30           storage = getCacheStorage("disk", LoadContextInfo.anonymous);
    31           storage.asyncVisitStorage(
    32             new VisitCallback(0, 0, [], function() {
    33               finish_cache2_test();
    34             }),
    35             true
    36           );
    37         }),
    38         true
    39       );
    40     });
    41   }
    43   var mc = new MultipleCallbacks(2, newCacheBackEndUsed() ? checkNewBackEnd : checkOldBackEnd, !newCacheBackEndUsed());
    45   asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
    46     new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
    47       mc.fired();
    48     })
    49   );
    51   asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous,
    52     new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) {
    53       mc.fired();
    54     })
    55   );
    57   do_test_pending();
    58 }

mercurial