blob: ea02b2dc9e73c62f3fe92a48fc07d0378d3a5958 [file] [log] [blame]
<html>
<script>
function stateChange() {
document.write(this.foo + '<br>');
}
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.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var xhr = new XMLHttpRequest();
xhr.foo = 'bar';
xhr.onreadystatechange = stateChange;
xhr.open("GET", "xmlhttprequest-gc.html", true);
xhr.send(null);
xhr = null;
collectGarbage();
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
<body onload='runTest()'>
</body>
</html>