Backed out changeset 7338770d735a (bug 1849873) for causing failures on test_brotli_h...
[gecko.git] / netwerk / test / unit / test_cache2-01a-basic-readonly.js
blob99d250f7b5eb4c293ae622a1187649372f2aceaf
1 "use strict";
3 function run_test() {
4   do_get_profile();
6   // Open for write, write
7   asyncOpenCacheEntry(
8     "http://ro/",
9     "disk",
10     Ci.nsICacheStorage.OPEN_NORMALLY,
11     null,
12     new OpenCallback(NEW, "a1m", "a1d", function (entry) {
13       // Open for read and check
14       asyncOpenCacheEntry(
15         "http://ro/",
16         "disk",
17         Ci.nsICacheStorage.OPEN_READONLY,
18         null,
19         new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
20           // Open for rewrite (truncate), write different meta and data
21           asyncOpenCacheEntry(
22             "http://ro/",
23             "disk",
24             Ci.nsICacheStorage.OPEN_TRUNCATE,
25             null,
26             new OpenCallback(NEW, "a2m", "a2d", function (entry) {
27               // Open for read and check
28               asyncOpenCacheEntry(
29                 "http://ro/",
30                 "disk",
31                 Ci.nsICacheStorage.OPEN_READONLY,
32                 null,
33                 new OpenCallback(NORMAL, "a2m", "a2d", function (entry) {
34                   finish_cache2_test();
35                 })
36               );
37             })
38           );
39         })
40       );
41     })
42   );
44   do_test_pending();