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.
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");
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>