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/testharness-helpers.js"></script> | 3 <script src="../resources/testharness-helpers.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="resources/test-helpers.js"></script> | 5 <script src="resources/test-helpers.js"></script> |
6 <script> | 6 <script> |
7 promise_test(function(t) { | 7 promise_test(function(t) { |
8 var script = | 8 var script = |
9 'resources/fetch-event-respond-with-stops-propagation-worker.js'; | 9 'resources/fetch-event-respond-with-stops-propagation-worker.js'; |
10 var scope = 'resources/simple.html'; | 10 var scope = 'resources/simple.html'; |
11 | 11 |
12 return service_worker_unregister_and_register(t, script, scope) | 12 return service_worker_unregister_and_register(t, script, scope) |
13 .then(function(registration) { | 13 .then(function(registration) { |
14 return wait_for_state(t, registration.installing, 'activated'); | 14 return wait_for_state(t, registration.installing, 'activated'); |
15 }) | 15 }) |
16 .then(function() { | 16 .then(function() { |
17 return with_iframe(scope); | 17 return with_iframe(scope); |
18 }) | 18 }) |
19 .then(function(frame) { | 19 .then(function(frame) { |
| 20 add_completion_callback(function() { frame.remove(); }); |
20 var channel = new MessageChannel(); | 21 var channel = new MessageChannel(); |
21 var saw_message = new Promise(function(resolve) { | 22 var saw_message = new Promise(function(resolve) { |
22 channel.port1.onmessage = function(e) { resolve(e.data); } | 23 channel.port1.onmessage = function(e) { resolve(e.data); } |
23 }); | 24 }); |
24 var worker = frame.contentWindow.navigator.serviceWorker.controller; | 25 var worker = frame.contentWindow.navigator.serviceWorker.controller; |
25 | 26 |
26 frame.remove(); | |
27 worker.postMessage({port: channel.port2}, [channel.port2]); | 27 worker.postMessage({port: channel.port2}, [channel.port2]); |
28 return saw_message; | 28 return saw_message; |
29 }) | 29 }) |
30 .then(function(message) { | 30 .then(function(message) { |
31 assert_equals(message, 'PASS'); | 31 assert_equals(message, 'PASS'); |
32 return service_worker_unregister_and_done(t, scope); | 32 return service_worker_unregister_and_done(t, scope); |
33 }) | 33 }) |
34 }, 'respondWith() invokes stopImmediatePropagation()'); | 34 }, 'respondWith() invokes stopImmediatePropagation()'); |
35 </script> | 35 </script> |
OLD | NEW |