| Index: LayoutTests/http/tests/serviceworker/chromium/resources/postmessage-cross-process-helper.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/chromium/resources/postmessage-cross-process-helper.html b/LayoutTests/http/tests/serviceworker/chromium/resources/postmessage-cross-process-helper.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..89804fd0ce5e9dcf940d127514431c407e30e2c2
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/serviceworker/chromium/resources/postmessage-cross-process-helper.html
|
| @@ -0,0 +1,33 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/test-helpers.js"></script>
|
| +<script>
|
| +if (window.testRunner) {
|
| + // waitUntilDone here is necessary to make sure content_shell doesn't exit as
|
| + // soon as this file is loaded.
|
| + testRunner.waitUntilDone();
|
| +}
|
| +
|
| +var worker;
|
| +
|
| +navigator.serviceWorker.getRegistration('simple.html')
|
| + .then(function(registration) {
|
| + worker = registration.active;
|
| + var messageChannel = new MessageChannel();
|
| + messageChannel.port1.onmessage = on_message;
|
| + worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
|
| + messageChannel.port1.postMessage({value: 1});
|
| + messageChannel.port1.postMessage({value: 2});
|
| + messageChannel.port1.postMessage({done: true});
|
| + });
|
| +
|
| +var result = [];
|
| +
|
| +function on_message(e) {
|
| + var message = e.data;
|
| + if (message === 'quit') {
|
| + worker.postMessage({done: result});
|
| + } else {
|
| + result.push(message);
|
| + }
|
| +}
|
| +</script>
|
|
|