Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-iframe.html

Issue 2177283006: Do not reuse opaque Resource from a service worker for non no-cors requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests, reflect comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-iframe.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..5214b91d66ee189ba35c69c5d11b804dd0d6042a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-iframe.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<body></body>
+<script>
+function runTest() {
+ var l = document.createElement('link');
+ l.setAttribute('rel', 'preload');
+ l.setAttribute('href', 'opaque-response');
+ l.onload = function() {
+ xhr = new XMLHttpRequest;
+ xhr.withCredentials = true;
+ xhr.open('GET', 'opaque-response');
+ // opaque-response returns an opaque response from serviceworker and thus
+ // the XHR must fail because it is not no-cors request.
+ // Particularly, the XHR must not reuse preloaded the opaque response on
+ // MemoryCache.
+ xhr.onerror = function() {
+ parent.done('PASS');
+ };
+ xhr.onload = function() {
+ parent.done('FAIL: ' + xhr.responseText);
+ };
+ xhr.send();
+ };
+ l.onerror = function() {
+ parent.done('FAIL: preload failed unexpectedly');
+ };
+ document.body.appendChild(l);
+}
+</script>
+<body onload="setTimeout(runTest, 100)"></body>

Powered by Google App Engine
This is Rietveld 408576698