tor-browser

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

test_cache2-26-no-outputstream-open.js (829B)


      1 "use strict";
      2 
      3 function run_test() {
      4  do_get_profile();
      5 
      6  // Open for write, but never write and never mark valid
      7  asyncOpenCacheEntry(
      8    "http://no-data/",
      9    "disk",
     10    Ci.nsICacheStorage.OPEN_NORMALLY,
     11    null,
     12    new OpenCallback(
     13      NEW | METAONLY | DONTSETVALID | WAITFORWRITE,
     14      "meta",
     15      "",
     16      function () {
     17        // Open again, we must get the callback and zero-length data
     18        executeSoon(() => {
     19          Cu.forceGC(); // invokes OnHandleClosed on the entry
     20 
     21          asyncOpenCacheEntry(
     22            "http://no-data/",
     23            "disk",
     24            Ci.nsICacheStorage.OPEN_NORMALLY,
     25            null,
     26            new OpenCallback(NORMAL, "meta", "", function () {
     27              finish_cache2_test();
     28            })
     29          );
     30        });
     31      }
     32    )
     33  );
     34 
     35  do_test_pending();
     36 }