3 <script src=
"../../resources/js-test.js"></script>
5 description("MessagePorts (and their execution contexts) should be collected by GC once close() has been called on them");
7 window
.jsTestIsAsync
= true;
9 function runGCAndTest() {
11 shouldBeTrue("iframeDocGC.wasCollected");
15 window
.onmessage = function(evt
) {
16 iframeDocGC
= internals
.observeGC(document
.querySelector('iframe').contentDocument
);
17 document
.querySelector('iframe').remove();
18 // The iframe is reachable via evt.source, and evt is on the
19 // stack. Force a GC upon return from the event handler, so
20 // that it no longer will be in scope and the iframe can
22 setTimeout(runGCAndTest
, 0);
25 <iframe src=
"resources/message-port-gc-closed-iframe.html"></iframe>