Chromium Code Reviews

Side by Side 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.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
9 function runGCAndTest() {
10 gc();
11 shouldBeTrue("iframeDocGC.wasCollected");
12 finishJSTest();
13 }
14
8 window.onmessage = function(evt) { 15 window.onmessage = function(evt) {
9 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo cument); 16 iframeDocGC = internals.observeGC(document.querySelector('iframe').contentDo cument);
10 document.querySelector('iframe').remove(); 17 document.querySelector('iframe').remove();
11 // The iframe is reachable via evt.source, and evt is on the 18 // The iframe is reachable via evt.source, and evt is on the
12 // stack. asyncGC() will invoke the callback once back at 19 // stack. Force a GC upon return from the event handler, so
13 // the event loop (and after having forced a GC); evt 20 // that it no longer will be in scope and the iframe can
14 // will consequently no longer be in scope and the iframe 21 // be GCed.
15 // will have been GCed. 22 setTimeout(runGCAndTest, 0);
16 asyncGC(function () {
17 shouldBeTrue("iframeDocGC.wasCollected");
18 finishJSTest();
19 });
20 } 23 }
21 </script> 24 </script>
22 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe> 25 <iframe src="resources/message-port-gc-closed-iframe.html"></iframe>
23 </body> 26 </body>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine