2 <p>Test that destroying a document doesn't cause a crash when posting a message to a MessagePort it owned.</p>
7 if (window.GCController)
8 return GCController.collect();
10 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
11 var s = new String("abc");
17 document.getElementById("log").innerHTML += message + "<br>";
20 if (window.testRunner) {
21 testRunner.dumpAsText();
22 testRunner.waitUntilDone();
29 var channel = new MessageChannel;
30 window.frames[0].postMessage("msg", [channel.port2], "*");
31 mainPort = channel.port1;
34 mainPort.postMessage("ping");
35 mainPort.onmessage = test2;
40 var frameElement = document.getElementsByTagName("iframe")[0];
41 frameElement.parentNode.removeChild(frameElement);
45 setTimeout(test3, 10);
51 mainPort.postMessage("ping");
52 mainPort.onmessage = function(evt) {
53 if (evt.data == "pong")
54 log("Unexpected response: FAIL");
56 setTimeout(test4, 10);
63 log("Didn't crash: SUCCESS");
65 if (window.testRunner)
66 testRunner.notifyDone();
70 <iframe src="resources/message-port-iframe.html" onload="test()"></iframe>