Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / events / message-port-gc-closed.html
index 0be397f..4cc906a 100644 (file)
@@ -5,18 +5,21 @@
 description("MessagePorts (and their execution contexts) should be collected by GC once close() has been called on them");
 
 window.jsTestIsAsync = true;
+
+function runGCAndTest() {
+    gc();
+    shouldBeTrue("iframeDocGC.wasCollected");
+    finishJSTest();
+}
+
 window.onmessage = function(evt) {
     iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDocument);
     document.querySelector('iframe').remove();
     // 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();
-    });
+    // stack. Force a GC upon return from the event handler, so
+    // that it no longer will be in scope and the iframe can
+    // be GCed.
+    setTimeout(runGCAndTest, 0);
 }
 </script>
 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe>