tor-browser

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

test_cache2-02-open-non-existing.js (1184B)


      1 "use strict";
      2 
      3 function run_test() {
      4  do_get_profile();
      5 
      6  // Open non-existing for read, should fail
      7  asyncOpenCacheEntry(
      8    "http://b/",
      9    "disk",
     10    Ci.nsICacheStorage.OPEN_READONLY,
     11    null,
     12    new OpenCallback(NOTFOUND, null, null, function () {
     13      // Open the same non-existing for read again, should fail second time
     14      asyncOpenCacheEntry(
     15        "http://b/",
     16        "disk",
     17        Ci.nsICacheStorage.OPEN_READONLY,
     18        null,
     19        new OpenCallback(NOTFOUND, null, null, function () {
     20          // Try it again normally, should go
     21          asyncOpenCacheEntry(
     22            "http://b/",
     23            "disk",
     24            Ci.nsICacheStorage.OPEN_NORMALLY,
     25            null,
     26            new OpenCallback(NEW, "b1m", "b1d", function () {
     27              // ...and check
     28              asyncOpenCacheEntry(
     29                "http://b/",
     30                "disk",
     31                Ci.nsICacheStorage.OPEN_NORMALLY,
     32                null,
     33                new OpenCallback(NORMAL, "b1m", "b1d", function () {
     34                  finish_cache2_test();
     35                })
     36              );
     37            })
     38          );
     39        })
     40      );
     41    })
     42  );
     43 
     44  do_test_pending();
     45 }