2 <script src=
"../../resources/test-helpers.js"></script>
4 if (window
.testRunner
) {
5 // waitUntilDone here is necessary to make sure content_shell doesn't exit as
6 // soon as this file is loaded.
7 testRunner
.waitUntilDone();
12 navigator
.serviceWorker
.getRegistration('simple.html')
13 .then(function(registration
) {
14 worker
= registration
.active
;
15 var messageChannel
= new MessageChannel();
16 messageChannel
.port1
.onmessage
= on_message
;
17 worker
.postMessage({port
: messageChannel
.port2
}, [messageChannel
.port2
]);
18 messageChannel
.port1
.postMessage({value
: 1});
19 messageChannel
.port1
.postMessage({value
: 2});
20 messageChannel
.port1
.postMessage({done
: true});
25 function on_message(e
) {
27 if (message
=== 'quit') {
28 worker
.postMessage({done
: result
});