Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/opaque-response-preloaded.https.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/opaque-response-in-memorycache.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/opaque-response-preloaded.https.html |
similarity index 50% |
rename from third_party/WebKit/LayoutTests/http/tests/serviceworker/opaque-response-in-memorycache.html |
rename to third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/opaque-response-preloaded.https.html |
index a723e241ebcaabc11a3d5df742ae831ccc2d13a8..ffe9344ea84ef4fe658f1827504082c9c81602c1 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/opaque-response-in-memorycache.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/opaque-response-preloaded.https.html |
@@ -1,22 +1,24 @@ |
<!DOCTYPE html> |
<meta charset="utf-8"> |
-<title>Opaque responses on MemoryCache should not be reused for XHRs</title> |
+<title>Opaque responses should not be reused for XHRs</title> |
<script src="/resources/testharness.js"></script> |
<script src="/resources/testharnessreport.js"></script> |
-<script src="resources/test-helpers.js"></script> |
+<script src="resources/test-helpers.sub.js"></script> |
<script> |
const WORKER = |
- 'resources/opaque-response-in-memorycache-worker.js'; |
+ 'resources/opaque-response-preloaded-worker.js'; |
const SCOPE = |
- 'resources/opaque-response-in-memorycache-iframe.html'; |
+ 'resources/opaque-response-preloaded-iframe.html'; |
var resolve_done; |
var done_was_called = new Promise(resolve => resolve_done = resolve); |
// Called by the iframe when done. |
function done(result) { resolve_done(result); } |
-// This test creates an controlled iframe that makes a fetch request. The |
-// service worker returns a response with a body stream containing an invalid |
-// chunk. |
+// This tests that the browser does not inappropriately use a cached opaque |
+// response for a request that is not no-cors. The test opens a controlled |
+// iframe that uses link rel=preload to issue a same-origin no-cors request. |
+// The service worker responds to the request with an opaque response. Then the |
+// iframe does an XHR (not no-cors) to that URL again. The request should fail. |
promise_test(t => { |
return service_worker_unregister_and_register(t, WORKER, SCOPE) |
.then(reg => { |
@@ -24,7 +26,8 @@ promise_test(t => { |
return wait_for_state(t, reg.installing, 'activated'); |
}) |
.then(() => with_iframe(SCOPE)) |
+ .then(frame => t.add_cleanup(() => frame.remove() )) |
.then(() => done_was_called) |
.then(result => assert_equals(result, 'PASS')); |
- }, 'Opaque responses on MemoryCache should not be reused for XHRs'); |
+ }, 'Opaque responses should not be reused for XHRs'); |
</script> |