tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_cache2-24-exists.js (1064B)


      1 "use strict";
      2 
      3 function run_test() {
      4  do_get_profile();
      5 
      6  var mc = new MultipleCallbacks(2, function () {
      7    var mem = getCacheStorage("memory");
      8    var disk = getCacheStorage("disk");
      9 
     10    Assert.ok(disk.exists(createURI("http://m1/"), ""));
     11    Assert.ok(mem.exists(createURI("http://m1/"), ""));
     12    Assert.ok(!mem.exists(createURI("http://m2/"), ""));
     13    Assert.ok(disk.exists(createURI("http://d1/"), ""));
     14    do_check_throws_nsIException(
     15      () => disk.exists(createURI("http://d2/"), ""),
     16      "NS_ERROR_NOT_AVAILABLE"
     17    );
     18 
     19    finish_cache2_test();
     20  });
     21 
     22  asyncOpenCacheEntry(
     23    "http://d1/",
     24    "disk",
     25    Ci.nsICacheStorage.OPEN_NORMALLY,
     26    Services.loadContextInfo.default,
     27    new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function () {
     28      mc.fired();
     29    })
     30  );
     31 
     32  asyncOpenCacheEntry(
     33    "http://m1/",
     34    "memory",
     35    Ci.nsICacheStorage.OPEN_NORMALLY,
     36    Services.loadContextInfo.default,
     37    new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function () {
     38      mc.fired();
     39    })
     40  );
     41 
     42  do_test_pending();
     43 }