2 <p>Test that destroying a frame 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();
30 frameDoc
= window
.frames
[0].document
;
31 var channel
= new MessageChannel
;
32 window
.frames
[0].postMessage("msg", [channel
.port2
], "*");
33 mainPort
= channel
.port1
;
36 mainPort
.postMessage("ping");
37 mainPort
.onmessage
= test2
;
42 var frameElement
= document
.getElementsByTagName("iframe")[0];
43 frameElement
.parentNode
.removeChild(frameElement
);
47 setTimeout(test3
, 10);
53 mainPort
.postMessage("ping");
54 mainPort
.onmessage = function(evt
) {
55 if (evt
.data
== "pong")
56 log("Unexpected response: FAIL");
58 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>