blob: 0c081e1ffe57c33c523c4db4b8d32b11e524d5be [file] [log] [blame]
<html>
<body>
<p>Test postMessage and garbage collection.</p>
<div id=result></div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var worker = new Worker('resources/messageport-echo-worker.js');
worker.onmessage = (event) => {
if (event.data !== "ready") {
document.body.innerHTML = "FAIL";
if (window.testRunner)
testRunner.notifyDone();
return;
}
worker.terminate();
function gcRec(n) {
if (n < 1)
return {};
var temp = {i: "ab" + i + (i / 100000)};
temp += "foo";
gcRec(n-1);
}
for (var i = 0; i < 100000; i++)
gcRec(10);
setTimeout(() => {
document.body.innerHTML = "PASS";
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}
var channel = new MessageChannel();
channel.port1.onmessage = (event) => { };
worker.postMessage("Here is your port", [channel.port2]);
</script>
</body>
</html>