<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/empty.txt", true);
    request.send();
}

function repeat() {
    var request = new XMLHttpRequest();
    request.addEventListener("progress", function() { log("progress") }, false);
    request.addEventListener("load", function() { log("load"); end(); }, false);
    request.addEventListener("error", function() { log("error"); end(); }, false);
    request.addEventListener("abort", function() { log("abort"); end(); }, false);
    request.open("GET", "resources/empty.txt", true);
    request.send();
}

function end() {
    log("DONE");
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
