Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: LayoutTests/fast/events/message-port-gc-closed.html

Issue 635473002: Fix when fast/events/message-port-gc-closed.html forces a GC. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0be397f62a154a78942ab169725bd02f38ad1935..4cc906ac01e6d48f7137bbe1ba35e4e19ad4ad8b 100644
--- a/LayoutTests/fast/events/message-port-gc-closed.html
+++ b/LayoutTests/fast/events/message-port-gc-closed.html
@@ -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>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698