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