OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../../resources/js-test.js"></script> |
| 4 </head> |
| 5 <body> |
| 6 <script> |
| 7 description("Test that detaching document in window.postMessage() handler does n
ot crash."); |
| 8 |
| 9 window.jsTestIsAsync = true; |
| 10 |
| 11 if (window.testRunner) { |
| 12 testRunner.dumpAsText(); |
| 13 testRunner.waitUntilDone(); |
| 14 } |
| 15 |
| 16 function postMessageToSelf() { |
| 17 setInterval(function() { iframe.contentWindow.postMessage("msg", "*"); }, 0)
; |
| 18 } |
| 19 |
| 20 function receiveMessage(event) { |
| 21 testPassed("Received message " + event.data); |
| 22 document.body.removeChild(iframe); |
| 23 finishJSTest(); |
| 24 } |
| 25 |
| 26 var iframe = document.createElement("iframe"); |
| 27 document.body.appendChild(iframe); |
| 28 iframe.contentWindow.addEventListener("message", receiveMessage, false); |
| 29 postMessageToSelf(); |
| 30 </script> |
| 31 </body> |
| 32 </html> |
OLD | NEW |