Index: LayoutTests/fast/events/message-port-gc-closed.html |
diff --git a/LayoutTests/fast/events/message-port-gc-closed.html b/LayoutTests/fast/events/message-port-gc-closed.html |
index 4dba52da1a27ae633a9d72d6f1fc2a8b59fb1f41..0be397f62a154a78942ab169725bd02f38ad1935 100644 |
--- a/LayoutTests/fast/events/message-port-gc-closed.html |
+++ b/LayoutTests/fast/events/message-port-gc-closed.html |
@@ -2,14 +2,21 @@ |
<body> |
<script src="../../resources/js-test.js"></script> |
<script> |
-jsTestIsAsync = true; |
description("MessagePorts (and their execution contexts) should be collected by GC once close() has been called on them"); |
+ |
+window.jsTestIsAsync = true; |
window.onmessage = function(evt) { |
iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDocument); |
document.querySelector('iframe').remove(); |
- gc(); |
- shouldBeTrue("iframeDocGC.wasCollected"); |
- finishJSTest(); |
+ // The iframe is reachable via evt.source, and evt is on the |
+ // stack. asyncGC() will invoke the callback once back at |
+ // the event loop (and after having forced a GC); evt |
+ // will consequently no longer be in scope and the iframe |
+ // will have been GCed. |
+ asyncGC(function () { |
+ shouldBeTrue("iframeDocGC.wasCollected"); |
+ finishJSTest(); |
+ }); |
} |
</script> |
<iframe src="resources/message-port-gc-closed-iframe.html"></iframe> |