diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/cache/test/mochitest/test_cache_requestCache.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/cache/test/mochitest/test_cache_requestCache.js')
-rw-r--r-- | dom/cache/test/mochitest/test_cache_requestCache.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dom/cache/test/mochitest/test_cache_requestCache.js b/dom/cache/test/mochitest/test_cache_requestCache.js new file mode 100644 index 0000000000..14b2d939c8 --- /dev/null +++ b/dom/cache/test/mochitest/test_cache_requestCache.js @@ -0,0 +1,35 @@ +/* global context testDone:true */ + +var name = "requestCache" + context; +var c; + +var reqWithoutCache = new Request("//mochi.test:8888/?noCache" + context); +var reqWithCache = new Request("//mochi.test:8888/?withCache" + context, { + cache: "force-cache", +}); + +// Sanity check +is(reqWithoutCache.cache, "default", "Correct default value"); +is(reqWithCache.cache, "force-cache", "Correct value set by the ctor"); + +caches + .open(name) + .then(function(cache) { + c = cache; + return c.addAll([reqWithoutCache, reqWithCache]); + }) + .then(function() { + return c.keys(); + }) + .then(function(keys) { + is(keys.length, 2, "Correct number of requests"); + is(keys[0].url, reqWithoutCache.url, "Correct URL"); + is(keys[0].cache, reqWithoutCache.cache, "Correct cache attribute"); + is(keys[1].url, reqWithCache.url, "Correct URL"); + is(keys[1].cache, reqWithCache.cache, "Correct cache attribute"); + return caches.delete(name); + }) + .then(function(deleted) { + ok(deleted, "The cache should be successfully deleted"); + testDone(); + }); |