tor-browser

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

test_cache2-30a-entry-pinning.js (998B)


      1 "use strict";
      2 
      3 function run_test() {
      4  do_get_profile();
      5 
      6  // Open for write, write
      7  asyncOpenCacheEntry(
      8    "http://a/",
      9    "pin",
     10    Ci.nsICacheStorage.OPEN_TRUNCATE,
     11    Services.loadContextInfo.default,
     12    new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function () {
     13      // Open for read and check
     14      asyncOpenCacheEntry(
     15        "http://a/",
     16        "disk",
     17        Ci.nsICacheStorage.OPEN_NORMALLY,
     18        Services.loadContextInfo.default,
     19        new OpenCallback(NORMAL, "a1m", "a1d", function () {
     20          // Now clear the whole cache
     21          Services.cache2.clear();
     22 
     23          // The pinned entry should be intact
     24          asyncOpenCacheEntry(
     25            "http://a/",
     26            "disk",
     27            Ci.nsICacheStorage.OPEN_NORMALLY,
     28            Services.loadContextInfo.default,
     29            new OpenCallback(NORMAL, "a1m", "a1d", function () {
     30              finish_cache2_test();
     31            })
     32          );
     33        })
     34      );
     35    })
     36  );
     37 
     38  do_test_pending();
     39 }