Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=182637 #9460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions service-workers/cache-storage/script-tests/cache-put.js
Expand Up @@ -335,4 +335,12 @@ cache_test(function(cache) {
});
}, 'Cache.put should store Response.redirect() correctly');

cache_test(async (cache) => {
var request = new Request(test_url);
var response = new Response(new Blob([test_body]));
await cache.put(request, response);
var cachedResponse = await cache.match(request);
assert_equals(await cachedResponse.text(), test_body);
}, 'Cache.put called with simple Request and blob Response');

done();
13 changes: 13 additions & 0 deletions service-workers/cache-storage/window/cache-put.https.html
Expand Up @@ -6,3 +6,16 @@
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-put.js"></script>
<script>
cache_test(async (cache) => {
var formData = new FormData();
formData.append("name", "value");

var request = new Request(test_url);
var response = new Response(formData);
await cache.put(request, response);
var cachedResponse = await cache.match(request);
var cachedResponseText = await cachedResponse.text();
assert_true(cachedResponseText.indexOf("name=\"name\"\r\n\r\nvalue") !== -1);
}, 'Cache.put called with simple Request and form data Response');
</script>