blob: 05a78ef79d715944be3ae70c8398a97d4dd229c7 [file] [log] [blame]
<body>
<pre id=preOnerror>FAIL: onerror was not called.</pre>
<pre id=console></pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
}
var hadError = false;
function error(message)
{
hadError = true;
log("FAIL: " + message);
}
function checkResponse()
{
if (req.responseText.length) {
error("responseText is not empty");
if (window.testRunner)
testRunner.notifyDone()
}
}
function stealResponse()
{
document.body.removeChild(document.getElementById('preOnerror'));
req.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/zero-length.xml");
req.send();
req.onreadystatechange = checkResponse;
setTimeout(function() {
checkResponse();
if (!hadError)
log("PASS");
if (window.testRunner)
testRunner.notifyDone()
}, 100);
}
var req = new XMLHttpRequest;
req.open("GET", "http://localhost:8000/xmlhttprequest/resources/reply.xml", false);
req.onerror = stealResponse;
try {
req.send(null);
error("send did not raise an exception");
} catch (ex) {
}
</script>
</body>