Index: LayoutTests/fast/dom/Window/post-message-detach-in-handler.html |
diff --git a/LayoutTests/fast/dom/Window/post-message-detach-in-handler.html b/LayoutTests/fast/dom/Window/post-message-detach-in-handler.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0faa5fd3ceb11fd79649675db075f9d9465422c7 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/Window/post-message-detach-in-handler.html |
@@ -0,0 +1,32 @@ |
+<html> |
+<head> |
+<script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<script> |
+description("Test that detaching document in window.postMessage() handler does not crash."); |
+ |
+window.jsTestIsAsync = true; |
+ |
+if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+function postMessageToSelf() { |
+ setInterval(function() { iframe.contentWindow.postMessage("msg", "*"); }, 0); |
+} |
+ |
+function receiveMessage(event) { |
+ testPassed("Received message " + event.data); |
+ document.body.removeChild(iframe); |
+ finishJSTest(); |
+} |
+ |
+var iframe = document.createElement("iframe"); |
+document.body.appendChild(iframe); |
+iframe.contentWindow.addEventListener("message", receiveMessage, false); |
+postMessageToSelf(); |
+</script> |
+</body> |
+</html> |