Index: LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html b/LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html |
index c8a665217d93c4ce75ad976af7e5486c2e626237..ea8c5aae96c2c49676c8d0bc1f2333369e5fb2d4 100644 |
--- a/LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html |
+++ b/LayoutTests/http/tests/xmlhttprequest/event-listener-gc.html |
@@ -8,7 +8,7 @@ function write(s) |
} |
var didCollect = false; |
-function collect() |
+window.onmessage = function () |
{ |
didCollect = true; |
gc(); |
@@ -24,26 +24,27 @@ function processStateChange(e) |
} |
} |
-function test() |
+function test() |
{ |
if (window.testRunner) { |
testRunner.dumpAsText(); |
testRunner.waitUntilDone(); |
} |
- |
+ |
var request = new XMLHttpRequest(); |
request.onreadystatechange = processStateChange; |
request.open("GET", "print-content-type.cgi", true); |
request.send(null); |
- |
- setTimeout('collect();', 0); // timeout ensures stack references to request are cleared when we collect |
+ |
+ // Indirectly GC so as to ensure that 'request' isn't stack reachable. |
+ window.postMessage('gc!', '*'); |
} |
</script> |
</head> |
<body onload="test();"> |
<p>This test checks whether event handlers for outstanding XMLHttpRequests survive garbage collection.</p> |
-<p>See https://bugs.webkit.org/show_bug.cgi?id=9113 REGRESSION (14581): |
+<p>See https://bugs.webkit.org/show_bug.cgi?id=9113 REGRESSION (14581): |
XMLHttpRequest never calls onreadystatechange with a readystate == 4</p> |
<p>If the test passes, you'll see a series of 'PASS' messages below.</p> |
<hr> |