Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / xmlhttprequest-missing-file-exception.html
blob0cd3b2eb29b1afec3329bf7446508cf4028aa3fa
1 <p>This test checks that no exception is raised when getting a 404 HTTP response - that's success from XHR point of view.</p>
2 <hr>
4 <pre id="console"></pre>
6 <script>
7 function log(s)
9 document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
12 function logProperty(object, propertyName)
14 var property;
15 try {
16 property = object[propertyName];
17 if (propertyName == "responseText")
18 property = (property && property.length) ? "Non-empty" : property;
19 } catch(e) {
20 property = e;
22 log(propertyName + ": " + property + " (" + typeof property + ")");
25 function sendRequest()
27 var request = new XMLHttpRequest();
28 request.open("GET", "resources/doesnotexist", false);
29 request.send(null);
30 return request;
33 if (window.testRunner)
34 testRunner.dumpAsText();
36 try {
37 var request = sendRequest();
39 var properties = [
40 "readyState",
41 "responseText",
42 "responseXML",
43 "status",
44 "statusText",
47 log("PASS: No exception.");
48 for (var i = 0; i < properties.length; i++) //>
49 logProperty(request, properties[i]);
50 } catch(e) {
51 log("FAIL: Caught exception " + e + ".");
53 </script>