Bug 1857386 [wpt PR 42383] - Update wpt metadata, a=testonly
[gecko.git] / netwerk / test / unit / test_cache2-24-exists.js
blob7f7c50e9f063754333f608f04db954e22b73c1d8
1 "use strict";
3 function run_test() {
4   do_get_profile();
6   var mc = new MultipleCallbacks(2, function () {
7     var mem = getCacheStorage("memory");
8     var disk = getCacheStorage("disk");
10     Assert.ok(disk.exists(createURI("http://m1/"), ""));
11     Assert.ok(mem.exists(createURI("http://m1/"), ""));
12     Assert.ok(!mem.exists(createURI("http://m2/"), ""));
13     Assert.ok(disk.exists(createURI("http://d1/"), ""));
14     do_check_throws_nsIException(
15       () => disk.exists(createURI("http://d2/"), ""),
16       "NS_ERROR_NOT_AVAILABLE"
17     );
19     finish_cache2_test();
20   });
22   asyncOpenCacheEntry(
23     "http://d1/",
24     "disk",
25     Ci.nsICacheStorage.OPEN_NORMALLY,
26     Services.loadContextInfo.default,
27     new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function (entry) {
28       mc.fired();
29     })
30   );
32   asyncOpenCacheEntry(
33     "http://m1/",
34     "memory",
35     Ci.nsICacheStorage.OPEN_NORMALLY,
36     Services.loadContextInfo.default,
37     new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function (entry) {
38       mc.fired();
39     })
40   );
42   do_test_pending();