blob: 0cd3b2eb29b1afec3329bf7446508cf4028aa3fa [file] [log] [blame]
<p>This test checks that no exception is raised when getting a 404 HTTP response - that's success from XHR point of view.</p>
<hr>
<pre id="console"></pre>
<script>
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
function logProperty(object, propertyName)
{
var property;
try {
property = object[propertyName];
if (propertyName == "responseText")
property = (property && property.length) ? "Non-empty" : property;
} catch(e) {
property = e;
}
log(propertyName + ": " + property + " (" + typeof property + ")");
}
function sendRequest()
{
var request = new XMLHttpRequest();
request.open("GET", "resources/doesnotexist", false);
request.send(null);
return request;
}
if (window.testRunner)
testRunner.dumpAsText();
try {
var request = sendRequest();
var properties = [
"readyState",
"responseText",
"responseXML",
"status",
"statusText",
];
log("PASS: No exception.");
for (var i = 0; i < properties.length; i++) //>
logProperty(request, properties[i]);
} catch(e) {
log("FAIL: Caught exception " + e + ".");
}
</script>