blob: a89b9b4c2c47ddeaa38f275b7d3a1a53922d3578 [file] [log] [blame]
<body>
<p>Test Worker.terminate().</p>
<div id=result></div>
<script>
function log(message)
{
document.getElementById("result").innerHTML += message + "<br>";
}
function gc()
{
if (window.GCController)
return GCController.collect();
for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
var s = new String("abc");
}
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var worker = new Worker('resources/worker-common.js');
worker.terminate();
var worker2 = new Worker('resources/worker-common.js');
worker2.terminate();
worker2 = 0;
gc();
var worker3 = new Worker('resources/worker-common.js');
worker3.onmessage = function(evt) {
log("FAIL");
}
worker3.postMessage("eval true");
worker3.terminate();
var worker4 = new Worker('resources/worker-common.js');
worker4.onmessage = function(evt) {
worker4.onmessage = function() { log("FAIL"); }
worker4.postMessage("eval true");
worker4.terminate();
log("Received message from worker4.");
setTimeout("log('DONE'); if (window.testRunner) testRunner.notifyDone()", 1000);
}
worker4.postMessage("eval true");
</script>
</body>
</html>