Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / termination-with-port-messages.html
blob1c19d99850e8f28ec25112456ef198e645b75704
1 <script>
2 function test()
4 if (window.testRunner) {
5 testRunner.dumpAsText();
6 testRunner.waitUntilDone();
9 var worker = new Worker("resources/termination-with-port-messages.js");
10 var channel = new MessageChannel();
12 channel.port2.onmessage = function(evt)
14 // On first message back from worker, terminate it.
15 worker.terminate();
16 if (window.testRunner)
17 setTimeout("testRunner.notifyDone();", 0);
19 channel.port2.start();
21 worker.postMessage("", [channel.port1]);
22 for (i = 0; i < 1000; i++)
23 channel.port2.postMessage("message to worker");
25 </script>
26 <body onload=test()>
27 <p>This test terminates a worker when there are many undelivered MessagePort messages still waiting to be dispatched into the Worker Context. This causes termination of JS execution and test should not try to dispatch the remaining messages. Test succeeds if it does not hang or crash (if worker thread is running in the separate process, that process could hang or crash).</p>
28 </body>