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;
8 window.onmessage = function(evt) {
9 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDocument);
10 document.querySelector('iframe').remove();
11 // The iframe is reachable via evt.source, and evt is on the
12 // stack. asyncGC() will invoke the callback once back at
13 // the event loop (and after having forced a GC); evt
14 // will consequently no longer be in scope and the iframe
15 // will have been GCed.
17 shouldBeTrue("iframeDocGC.wasCollected");
22 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe>