blob: 8af93c35c74e87bf9f94dd55043fc6ca5d94f594 [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()
{
try {
document.body.removeChild(document.getElementById('preOnerror'));
if (req.responseText.length)
error("responseText is not empty");
if (req.responseXML)
error("responseXML is not null");
try {
if (req.status)
error("status is not zero: " + req.status);
} catch (ex) {
}
try {
if (req.statusText)
error("statusText is not empty: " + req.statusText);
} catch (ex) {
}
try {
if (req.getAllResponseHeaders().length)
error("getAllResponseHeaders() result is not empty: " + req.getAllResponseHeaders());
} catch (ex) {
}
if (!hadError)
log("PASS");
} catch (ex) {
log(ex);
}
if (window.testRunner)
testRunner.notifyDone();
}
var req = new XMLHttpRequest;
req.open("GET", "http://localhost:8000/xmlhttprequest/resources/reply.xml")
req.onerror = function() { setTimeout(checkResponse, 100); } // Giving the time for load to continue.
req.send(null);
</script>
</body>