2 <p>Test that MessagePort close event gets delivered (without crashing) even if the channel object is garbage collected.
</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
.layoutTestController
) {
21 layoutTestController
.dumpAsText();
22 layoutTestController
.waitUntilDone();
25 var channel
= new MessageChannel
;
27 channel
.port1
.onclose = function() { log("onclose"); setTimeout(function() { if (window
.layoutTestController
) layoutTestController
.notifyDone(); gc(); }, 0) }
28 channel
.port1
.addEventListener("close", function() { log("close listener"); gc(); }, false);
31 channel
.port1
.start();
32 channel
.port2
.postMessage("msg");
35 channel
.port1
.close();
36 channel
.port2
.close();
38 channel
= new MessageChannel
;