tor-browser

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

test_cache2-27-force-valid-for.js (758B)


      1 "use strict";
      2 
      3 function run_test() {
      4  do_get_profile();
      5 
      6  var mc = new MultipleCallbacks(2, function () {
      7    finish_cache2_test();
      8  });
      9 
     10  asyncOpenCacheEntry(
     11    "http://m1/",
     12    "memory",
     13    Ci.nsICacheStorage.OPEN_NORMALLY,
     14    Services.loadContextInfo.default,
     15    new OpenCallback(NEW, "meta", "data", function (entry) {
     16      // Check the default
     17      equal(entry.isForcedValid, false);
     18 
     19      // Forced valid and confirm
     20      entry.forceValidFor(2);
     21      do_timeout(1000, function () {
     22        equal(entry.isForcedValid, true);
     23        mc.fired();
     24      });
     25 
     26      // Confirm the timeout occurs
     27      do_timeout(3000, function () {
     28        equal(entry.isForcedValid, false);
     29        mc.fired();
     30      });
     31    })
     32  );
     33 
     34  do_test_pending();
     35 }