blob: 0aad2e4a8469b3d7f71e47a618dff3b18db2485e [file] [log] [blame]
<body onload="test();">
<p>Test that we don't hang xhr loads from cache when the resposne body was empty.<p>
<pre id=log></pre>
<script type="text/javascript">
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg) {
document.getElementById("log").innerHTML += msg + "\n";
}
function test() {
var request = new XMLHttpRequest();
request.addEventListener("progress", function() { log("progress") }, false);
request.addEventListener("load", function() { log("load"); repeat(); }, false);
request.addEventListener("error", function() { log("error"); repeat(); }, false);
request.addEventListener("abort", function() { log("abort"); repeat(); }, false);
request.open("GET", "resources/body.php", true);
request.send();
}
var secondRequest;
function secondRequestFinished() {
log("load");
log(secondRequest.response);
end();
}
function repeat() {
secondRequest = new XMLHttpRequest();
secondRequest.addEventListener("progress", function() { log("progress") }, false);
secondRequest.addEventListener("load", function() { secondRequestFinished(); }, false);
secondRequest.addEventListener("error", function() { log("error"); end(); }, false);
secondRequest.addEventListener("abort", function() { log("abort"); end(); }, false);
secondRequest.open("POST", "resources/body.php", true);
secondRequest.send("This http body should be visible");
}
function end() {
log("DONE");
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</body>