Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / message-port-gc-closed.html
blob4cc906ac01e6d48f7137bbe1ba35e4e19ad4ad8b
1 <!DOCTYPE html>
2 <body>
3 <script src="../../resources/js-test.js"></script>
4 <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() {
10 gc();
11 shouldBeTrue("iframeDocGC.wasCollected");
12 finishJSTest();
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
21 // be GCed.
22 setTimeout(runGCAndTest, 0);
24 </script>
25 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe>
26 </body>