blob: 0faa5fd3ceb11fd79649675db075f9d9465422c7 [file] [log] [blame]
<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>