blob: ddfdbb702c3e70bfc5470e73e69bf592c133e3e2 [file] [log] [blame]
<body>
<p>Test that worker object is not garbage collected if there is a message from
worker context. Should print "SUCCESS".
<a href="https://bugs.webkit.org/show_bug.cgi?id=62446">Bug 62446</a></p>
<div id=result></div>
<script>
function log(message)
{
document.getElementById("result").innerHTML += message + "<br>";
}
function gc()
{
if (window.GCController)
return GCController.collect();
var head;
for (var i = 0; i < 10000; i++) {
var newHead = new Array(1000);
newHead[0] = head;
head = newHead;
}
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var interval = setInterval(gc, 0);
var worker = new Worker('resources/worker-init.js');
worker.onmessage = function(evt) {
log(evt.data);
clearInterval(interval);
if (window.testRunner)
testRunner.notifyDone();
}
worker = 0;
gc();
</script>
</body>
</html>