mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1147184 - Extend the tests for Cache.put; r=bkelly
This commit is contained in:
parent
ab1bb39c6b
commit
dfd730a737
26
dom/cache/test/mochitest/test_cache_put.js
vendored
26
dom/cache/test/mochitest/test_cache_put.js
vendored
@ -15,10 +15,34 @@ Promise.all([fetch(url),
|
||||
return Promise.all([fetchResponse.text(),
|
||||
response.text()]);
|
||||
}).then(function(results) {
|
||||
// suppress large assert spam unless its relevent
|
||||
// suppress large assert spam unless it's relevent
|
||||
if (results[0] !== results[1]) {
|
||||
is(results[0], results[1], 'stored response body should match original');
|
||||
}
|
||||
|
||||
// Now, try to overwrite the request with a different response object.
|
||||
return cache.put(url, new Response("overwritten"));
|
||||
}).then(function() {
|
||||
return cache.matchAll(url);
|
||||
}).then(function(result) {
|
||||
is(result.length, 1, "Only one entry should exist");
|
||||
return result[0].text();
|
||||
}).then(function(body) {
|
||||
is(body, "overwritten", "The cache entry should be successfully overwritten");
|
||||
|
||||
// Now, try to write a URL with a fragment
|
||||
return cache.put(url + "#fragment", new Response("more overwritten"));
|
||||
}).then(function() {
|
||||
return cache.matchAll(url + "#differentFragment");
|
||||
}).then(function(result) {
|
||||
is(result.length, 1, "Only one entry should exist");
|
||||
return result[0].text();
|
||||
}).then(function(body) {
|
||||
is(body, "more overwritten", "The cache entry should be successfully overwritten");
|
||||
|
||||
// TODO: Verify that trying to store a response with an error raises a TypeError
|
||||
// when bug 1147178 is fixed.
|
||||
|
||||
return caches.delete('putter' + context);
|
||||
}).then(function(deleted) {
|
||||
ok(deleted, "The cache should be deleted successfully");
|
||||
|
Loading…
Reference in New Issue
Block a user