blob: 9f01bbc588788337a8a4b6495ec05a717e884843 [file] [log] [blame]
<body>
<p>Test that request state reaches DONE even if a network error occurs.</p>
<p>Should say SUCCESS:</p>
<div id=result></div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(message)
{
document.getElementById("result").innerHTML += message + "<br>";
}
function setNetworkEnabled(state)
{
var req = new XMLHttpRequest;
req.open("GET", "/resources/network-simulator.py?test=xmlhttprequest-state-after-network-error&command=" + (state ? "connect" : "disconnect"), false);
req.send("");
}
function onReadyStateChange()
{
if (xhr.readyState == 4) {
setNetworkEnabled(true);
log("SUCCESS");
if (window.testRunner)
testRunner.notifyDone();
}
}
setNetworkEnabled(false);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = onReadyStateChange;
xhr.open('GET', '/resources/network-simulator.py?test=xmlhttprequest-state-after-network-error&path=/', true);
xhr.send(null);
</script>
</head>
</body>