blob: 966315973cbbb3df9cb66a8891bd4f8eebcaad3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<html>
<script>
function stateChange() {
document.write(this.foo + '<br>');
if (this.readyState == 4) {
if (window.testRunner)
testRunner.notifyDone();
}
}
function collectGarbage() {
if (window.GCController) {
window.GCController.collect();
} else {
for (var i = 0; i < 50000; i++)
new Object();
}
}
function runTest() {
document.write("Tests that garbage collection doesn't drop the XMLHttpRequest JS wrapper until the send command is done. You should see 'bar' four times below.<br>");
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var xhr = new XMLHttpRequest();
xhr.foo = 'bar';
xhr.onreadystatechange = stateChange;
xhr.open("GET", "xmlhttprequest-gc.html", true);
xhr.send(null);
xhr = null;
collectGarbage();
}
</script>
<body onload='runTest()'>
</body>
</html>
|