Bug 1857386 [wpt PR 42383] - Update wpt metadata, a=testonly
[gecko.git] / netwerk / test / unit / test_cache2-30a-entry-pinning.js
blobb2541cbf86d40af7aa2c2d3848239a99a3945723
1 "use strict";
3 function run_test() {
4   do_get_profile();
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();
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   );
38   do_test_pending();