blob: 2766ecee98cc08f9c530a7f03729a3871999b0bf [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.php?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.php?test=xmlhttprequest-state-after-network-error&path=/', true);
xhr.send(null);
</script>
</head>
</body>