OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script> | 4 <script> |
5 jsTestIsAsync = true; | |
6 description("MessagePorts (and their execution contexts) should be collected by
GC once close() has been called on them"); | 5 description("MessagePorts (and their execution contexts) should be collected by
GC once close() has been called on them"); |
| 6 |
| 7 window.jsTestIsAsync = true; |
7 window.onmessage = function(evt) { | 8 window.onmessage = function(evt) { |
8 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo
cument); | 9 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo
cument); |
9 document.querySelector('iframe').remove(); | 10 document.querySelector('iframe').remove(); |
10 gc(); | 11 // The iframe is reachable via evt.source, and evt is on the |
11 shouldBeTrue("iframeDocGC.wasCollected"); | 12 // stack. asyncGC() will invoke the callback once back at |
12 finishJSTest(); | 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. |
| 16 asyncGC(function () { |
| 17 shouldBeTrue("iframeDocGC.wasCollected"); |
| 18 finishJSTest(); |
| 19 }); |
13 } | 20 } |
14 </script> | 21 </script> |
15 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe> | 22 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe> |
16 </body> | 23 </body> |
OLD | NEW |