blob: d8cc6227fbedd8c97cbd1fbbade15ac44adb82bb [file] [log] [blame]
youenn@apple.com495241c2018-03-14 22:20:33 +00001<html>
2<body>
3<p>Test postMessage and garbage collection.</p>
4<div id=result></div>
5<script>
6if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
9}
10
11var worker = new Worker('resources/messageport-echo-worker.js');
12
13worker.onmessage = (event) => {
14 if (event.data === "ready") {
15 worker.terminate();
16 setTimeout(() => {
17 document.body.innerHTML = "PASS";
18 if (window.testRunner)
19 testRunner.notifyDone();
20 }, 0);
21 }
22}
23
24var channel = new MessageChannel();
25channel.port1.onmessage = function(event) {
26}
27
28worker.postMessage("Here is your port", [channel.port2]);
29
30</script>
31</body>
32</html>