| 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 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 | 6 |
| 7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
| 8 | 8 |
| 9 function runGCAndTest() { | 9 function runGCAndTest() { |
| 10 gc(); | 10 asyncGC(function() { |
| 11 shouldBeTrue("iframeDocGC.wasCollected"); | 11 shouldBeTrue("iframeDocGC.wasCollected"); |
| 12 finishJSTest(); | 12 finishJSTest(); |
| 13 }); |
| 13 } | 14 } |
| 14 | 15 |
| 15 window.onmessage = function(evt) { | 16 window.onmessage = function(evt) { |
| 16 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo
cument); | 17 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo
cument); |
| 17 document.querySelector('iframe').remove(); | 18 document.querySelector('iframe').remove(); |
| 18 // The iframe is reachable via evt.source, and evt is on the | 19 // 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 // 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 // that it no longer will be in scope and the iframe can |
| 21 // be GCed. | 22 // be GCed. |
| 22 setTimeout(runGCAndTest, 0); | 23 setTimeout(runGCAndTest, 0); |
| 23 } | 24 } |
| 24 </script> | 25 </script> |
| 25 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe> | 26 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe> |
| 26 </body> | 27 </body> |
| OLD | NEW |