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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 }); | 182 }); |
183 }, 'Referrer and origin are set correctly in ForeignFetchEvent.'); | 183 }, 'Referrer and origin are set correctly in ForeignFetchEvent.'); |
184 | 184 |
185 function fetch_from_iframe(origin, url) { | 185 function fetch_from_iframe(origin, url) { |
186 return with_iframe(origin + | 186 return with_iframe(origin + |
187 '/serviceworker/resources/foreign-fetch-helper-iframe.html') | 187 '/serviceworker/resources/foreign-fetch-helper-iframe.html') |
188 .then(frame => new Promise((resolve) => { | 188 .then(frame => new Promise((resolve) => { |
189 var channel = new MessageChannel(); | 189 var channel = new MessageChannel(); |
190 frame.contentWindow.postMessage({url: url, | 190 frame.contentWindow.postMessage({url: url, |
191 port: channel.port1}, | 191 port: channel.port1}, |
192 '*', [channel.port1]); | 192 '*', [channel.port1]); |
193 channel.port2.onmessage = reply => resolve(reply.data); | 193 channel.port2.onmessage = reply => resolve(reply.data); |
194 })); | 194 })); |
195 } | 195 } |
196 | 196 |
197 promise_test(t => { | 197 promise_test(t => { |
198 var scope = 'simple.txt?basic_insecure'; | 198 var scope = 'simple.txt?basic_insecure'; |
199 var remote_url = | 199 var remote_url = |
200 host_info.AUTHENTICATED_ORIGIN + '/serviceworker/resources/' + scope; | 200 host_info.AUTHENTICATED_ORIGIN + '/serviceworker/resources/' + scope; |
201 return install_cross_origin_worker(t, worker_for_scopes(['']), scope, | 201 return install_cross_origin_worker(t, worker_for_scopes(['']), scope, |
202 host_info.AUTHENTICATED_ORIGIN) | 202 host_info.AUTHENTICATED_ORIGIN) |
(...skipping 10 matching lines...) Expand all Loading... |
213 var remote_url = | 213 var remote_url = |
214 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; | 214 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope; |
215 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) | 215 return install_cross_origin_worker(t, worker_for_scopes(['']), scope) |
216 .then(() => fetch(remote_url, {method: 'SPECIAL'})) | 216 .then(() => fetch(remote_url, {method: 'SPECIAL'})) |
217 .then(response => response.text()) | 217 .then(response => response.text()) |
218 .then(response_text => assert_true(response_text.startsWith('report('))); | 218 .then(response_text => assert_true(response_text.startsWith('report('))); |
219 }, 'Service Worker does not intercept fetches with CORS preflight'); | 219 }, 'Service Worker does not intercept fetches with CORS preflight'); |
220 | 220 |
221 </script> | 221 </script> |
222 </body> | 222 </body> |
OLD | NEW |