| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../resources/get-host-info.js"></script> | 4 <script src="../resources/get-host-info.js"></script> |
| 5 <script src="resources/test-helpers.js"></script> | 5 <script src="resources/test-helpers.js"></script> |
| 6 <script src="resources/foreign-fetch-helpers.js"></script> | 6 <script src="resources/foreign-fetch-helpers.js"></script> |
| 7 <body> | 7 <body> |
| 8 <script> | 8 <script> |
| 9 var host_info = get_host_info(); | 9 var host_info = get_host_info(); |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 var scope = 'fetch-access-control.php?fallback&ACAOrigin=*'; | 106 var scope = 'fetch-access-control.php?fallback&ACAOrigin=*'; |
| 107 var remote_url = | 107 var remote_url = |
| 108 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; | 108 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; |
| 109 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) | 109 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) |
| 110 .then(() => fetch(remote_url)) | 110 .then(() => fetch(remote_url)) |
| 111 .then(response => response.text()) | 111 .then(response => response.text()) |
| 112 .then(response_text => assert_true(response_text.startsWith('report('))); | 112 .then(response_text => assert_true(response_text.startsWith('report('))); |
| 113 }, 'Service Worker that fallback to network should fallback to network.'); | 113 }, 'Service Worker that fallback to network should fallback to network.'); |
| 114 | 114 |
| 115 promise_test(t => { | 115 promise_test(t => { |
| 116 var scope = 'fetch-access-control.php?fetch&ACAOrigin=*'; |
| 117 var remote_url = |
| 118 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; |
| 119 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) |
| 120 .then(() => fetch(remote_url)) |
| 121 .then(response => response.text()) |
| 122 .then(response_text => assert_true(response_text.startsWith('report('))); |
| 123 }, 'Service Worker that fetch from the network should fallback to network.'); |
| 124 |
| 125 promise_test(t => { |
| 116 var scope = 'simple.txt?fallback'; | 126 var scope = 'simple.txt?fallback'; |
| 117 var remote_url = | 127 var remote_url = |
| 118 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; | 128 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; |
| 119 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) | 129 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) |
| 120 .then(() => fetch(remote_url, {mode: 'no-cors'})) | 130 .then(() => fetch(remote_url, {mode: 'no-cors'})) |
| 121 .then(response => assert_equals(response.type, 'opaque')) | 131 .then(response => assert_equals(response.type, 'opaque')) |
| 122 .then(() => promise_rejects(t, new TypeError(), fetch(remote_url))); | 132 .then(() => promise_rejects(t, new TypeError(), fetch(remote_url))); |
| 123 }, 'Falling back to network should still respect CORS.'); | 133 }, 'Falling back to network should still respect CORS.'); |
| 124 | 134 |
| 125 promise_test(t => { | 135 promise_test(t => { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 var remote_url = | 234 var remote_url = |
| 225 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; | 235 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; |
| 226 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) | 236 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) |
| 227 .then(() => fetch(remote_url, {method: 'SPECIAL'})) | 237 .then(() => fetch(remote_url, {method: 'SPECIAL'})) |
| 228 .then(response => response.text()) | 238 .then(response => response.text()) |
| 229 .then(response_text => assert_true(response_text.startsWith('report('))); | 239 .then(response_text => assert_true(response_text.startsWith('report('))); |
| 230 }, 'Service Worker does not intercept fetches with CORS preflight'); | 240 }, 'Service Worker does not intercept fetches with CORS preflight'); |
| 231 | 241 |
| 232 </script> | 242 </script> |
| 233 </body> | 243 </body> |
| OLD | NEW |