Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>Service Worker: Stopping the worker during responding to a fetch</title> | |
| 3 <script src="../../resources/testharness.js"></script> | |
| 4 <script src="../../resources/testharnessreport.js"></script> | |
| 5 <script src="../resources/test-helpers.js"></script> | |
| 6 <script> | |
| 7 | |
| 8 promise_test(t => { | |
| 9 var SCOPE = 'resources/'; | |
| 
 
horo
2017/04/12 06:21:58
nit:
I prefer narrow scope to avoid interactions b
 
shimazu
2017/04/18 01:50:04
Done.
 
 | |
| 10 var SCRIPT = 'resources/respondwith-fetch-worker.js'; | |
| 11 var IFRAME_URL = 'resources/slow-fetch-and-stop-worker-iframe.html'; | |
| 12 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) | |
| 13 .then(r => { | |
| 14 add_completion_callback(() => r.unregister()); | |
| 15 return wait_for_state(t, r.installing, 'activated'); | |
| 16 }) | |
| 17 .then(() => { return with_iframe(IFRAME_URL, {auto_remove: true}); }) | |
| 18 .then(f => { | |
| 19 return new Promise(resolve => { | |
| 20 addEventListener('message', resolve); | |
| 21 f.contentWindow.postMessage('run', '*'); | |
| 22 }) | |
| 23 }) | |
| 24 .then(e => { | |
| 25 assert_equals(e.data, 'Rejected successfully'); | |
| 26 }); | |
| 27 }, 'Stopping the worker during responding fetch event cancels the request.'); | |
| 28 | |
| 29 </script> | |
| OLD | NEW |