Chromium Code Reviews

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html

Issue 1201393003: Unflake http/tests/xmlhttprequest/event-listener-gc.html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 <html> 1 <html>
2 <head> 2 <head>
3 <script src="/js-test-resources/js-test.js"></script> 3 <script src="/js-test-resources/js-test.js"></script>
4 <script> 4 <script>
5 function write(s) 5 function write(s)
6 { 6 {
7 document.getElementById('pre').appendChild(document.createTextNode(s)); 7 document.getElementById('pre').appendChild(document.createTextNode(s));
8 } 8 }
9 9
10 var didCollect = false; 10 var didCollect = false;
11 function collect() 11 window.onmessage = function ()
12 { 12 {
13 didCollect = true; 13 didCollect = true;
14 gc(); 14 gc();
15 } 15 }
16 16
17 function processStateChange(e) 17 function processStateChange(e)
18 { 18 {
19 if (didCollect) 19 if (didCollect)
20 write("PASS: event handler fired after garbage collection.\n"); 20 write("PASS: event handler fired after garbage collection.\n");
21 if (e.target.readyState == 4) { 21 if (e.target.readyState == 4) {
22 if (window.testRunner) 22 if (window.testRunner)
23 testRunner.notifyDone(); 23 testRunner.notifyDone();
24 } 24 }
25 } 25 }
26 26
27 function test() 27 function test()
28 { 28 {
29 if (window.testRunner) { 29 if (window.testRunner) {
30 testRunner.dumpAsText(); 30 testRunner.dumpAsText();
31 testRunner.waitUntilDone(); 31 testRunner.waitUntilDone();
32 } 32 }
33 33
34 var request = new XMLHttpRequest(); 34 var request = new XMLHttpRequest();
35 request.onreadystatechange = processStateChange; 35 request.onreadystatechange = processStateChange;
36 request.open("GET", "print-content-type.cgi", true); 36 request.open("GET", "print-content-type.cgi", true);
37 request.send(null); 37 request.send(null);
38 38
39 setTimeout('collect();', 0); // timeout ensures stack references to request are cleared when we collect 39 // Indirectly GC so as to ensure that 'request' isn't stack reachable.
40 window.postMessage('gc!', '*');
40 } 41 }
41 </script> 42 </script>
42 </head> 43 </head>
43 44
44 <body onload="test();"> 45 <body onload="test();">
45 <p>This test checks whether event handlers for outstanding XMLHttpRequests survi ve garbage collection.</p> 46 <p>This test checks whether event handlers for outstanding XMLHttpRequests survi ve garbage collection.</p>
46 <p>See https://bugs.webkit.org/show_bug.cgi?id=9113 REGRESSION (14581): 47 <p>See https://bugs.webkit.org/show_bug.cgi?id=9113 REGRESSION (14581):
47 XMLHttpRequest never calls onreadystatechange with a readystate == 4</p> 48 XMLHttpRequest never calls onreadystatechange with a readystate == 4</p>
48 <p>If the test passes, you'll see a series of 'PASS' messages below.</p> 49 <p>If the test passes, you'll see a series of 'PASS' messages below.</p>
49 <hr> 50 <hr>
50 51
51 <pre id='pre'></pre> 52 <pre id='pre'></pre>
52 53
53 </body> 54 </body>
54 </html> 55 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine