blob: a9ccc54a935beadaaef6454d43caf175922e2056 [file] [log] [blame]
<body>
<p>Test that MessagePort close event gets delivered (without crashing) even if the channel object is garbage collected.</p>
<pre id=log></pre>
<script>
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");
}
}
function log(message)
{
document.getElementById("log").innerHTML += message + "<br>";
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var channel = new MessageChannel;
gc();
channel.port1.start();
channel.port2.postMessage("msg");
gc();
channel.port1.close();
channel.port2.close();
gc();
setTimeout(function() {
log("DONE");
gc();
if (window.testRunner)
testRunner.notifyDone();
}, 0);
channel = new MessageChannel;
gc();
</script>
</body>