Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-service-worker-no-xorigin-caching.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-service-worker-no-xorigin-caching.html b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-service-worker-no-xorigin-caching.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..06f53b8ba04ecfce48543d25f7ecddd5ffb8d2cd |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-service-worker-no-xorigin-caching.html |
| @@ -0,0 +1,43 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<title>Service Worker responses aren't cached to suborigins</title> |
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +</head> |
| + |
| +<body> |
| +<script> |
| +var t_is_mem_cached = async_test("Service worker responses aren't cached for suborigins"); |
|
falken
2016/09/20 04:52:52
nit (sorry): three double quoted JS strings in thi
jww
2016/09/20 17:52:26
Done.
|
| +window.addEventListener('message', function(e) { |
| + if (e.data.id == 'suborigin') { |
| + t_is_mem_cached.step(function() { |
| + assert_false(e.data.is_mem_cached); |
| + t_is_mem_cached.done(); |
| + }); |
| + } else if (e.data.id == 'nonsuborigin') { |
| + var iframe = document.createElement('iframe'); |
| + iframe.src = "resources/fetch-resource.php?suborigin=foobar&resource=/resources/dummy.txt?bypass&id=suborigin&bypass"; |
| + document.body.appendChild(iframe); |
| + } else { |
| + assert_unreached('id must be one of \'suborigin\' or \'nonsuborigin\''); |
| + } |
| +}); |
| + |
| +navigator.serviceWorker.register('/security/suborigins/resources/sw-reject-all-with-error.js') |
| +.then(function(swr) { |
| + var tests_started = false; |
| + |
| + swr.installing.onstatechange = function() { |
| + if (tests_started) |
| + return; |
| + |
| + tests_started = true; |
| + |
| + var iframe = document.createElement('iframe'); |
| + iframe.src = "resources/fetch-resource.php?resource=/resources/dummy.txt?bypass&id=nonsuborigin&bypass"; |
| + document.body.appendChild(iframe); |
| + } |
| +}); |
| +</script> |
| +</body> |