youenn@apple.com | 495241c | 2018-03-14 22:20:33 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <body> |
| 3 | <p>Test postMessage and garbage collection.</p> |
| 4 | <div id=result></div> |
| 5 | <script> |
| 6 | if (window.testRunner) { |
| 7 | testRunner.dumpAsText(); |
| 8 | testRunner.waitUntilDone(); |
| 9 | } |
| 10 | |
| 11 | var worker = new Worker('resources/messageport-echo-worker.js'); |
| 12 | |
| 13 | worker.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 | |
| 24 | var channel = new MessageChannel(); |
| 25 | channel.port1.onmessage = function(event) { |
| 26 | } |
| 27 | |
| 28 | worker.postMessage("Here is your port", [channel.port2]); |
| 29 | |
| 30 | </script> |
| 31 | </body> |
| 32 | </html> |