3 <p>Tests the properties of XMLHttpRequest exceptions.
</p>
4 <pre id=
"console"></pre>
6 function shouldBeEqualToString(__a
, __b
)
12 _message
= "PASS " + __a
+ " is \"" + __b
+ "\"";
14 _message
= "FAIL " + __a
+ " is not \"" + __b
+ "\". Was \"" + _a
+ "\"";
16 document
.getElementById('console').appendChild(document
.createTextNode(_message
+ "\n"));
19 function shouldBe(__a
, __b
)
26 _message
= "PASS " + __a
+ " is " + __b
;
28 _message
= "FAIL " + __a
+ " is not " + __b
+ ". Was " + _a
;
30 document
.getElementById('console').appendChild(document
.createTextNode(_message
+ "\n"));
33 if (window
.testRunner
)
34 testRunner
.dumpAsText();
38 var req
= new XMLHttpRequest
;
39 req
.open('GET', 'resources/infinite-loop.php', false);
46 shouldBeEqualToString("e.toString()", "NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://127.0.0.1:8000/xmlhttprequest/resources/infinite-loop.php'.");
47 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException]");
48 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DOMExceptionPrototype]");
49 shouldBeEqualToString("e.constructor.toString()", "function DOMException() { [native code] }");
50 shouldBe("e.constructor", "window.DOMException");
51 shouldBe("e.NETWORK_ERR", "e.constructor.NETWORK_ERR");
52 shouldBe("e.NETWORK_ERR", "19");