blob: e3f9279f3edfe7e2cf928e63d2da8128fec57d22 [file] [log] [blame]
<html>
<body>
<p>Tests the properties of the exceptions related to XMLHttpRequest.</p>
<pre id="console"></pre>
<script>
function shouldBeEqualToString(__a, __b)
{
var _a = eval(__a);
var _message;
if (_a == __b) {
_message = "PASS " + __a + " is \"" + __b + "\"";
} else {
_message = "FAIL " + __a + " is not \"" + __b + "\". Was \"" + _a + "\"";
}
document.getElementById('console').appendChild(document.createTextNode(_message + "\n"));
}
function shouldBe(__a, __b)
{
var _a = eval(__a);
var _b = eval(__b);
var _message;
if (_a == _b) {
_message = "PASS " + __a + " is " + __b;
} else {
_message = "FAIL " + __a + " is not " + __b + ". Was " + _a;
}
document.getElementById('console').appendChild(document.createTextNode(_message + "\n"));
}
if (window.testRunner)
testRunner.dumpAsText();
var e;
try {
var req = new XMLHttpRequest;
req.open('GET', 'resources/infinite-loop.py', false);
req.send(null);
// raises NETWORK_ERR
} catch (err) {
e = err;
}
shouldBeEqualToString("e.toString()", "NetworkError: A network error occurred.");
shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException]");
shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DOMException]");
shouldBeEqualToString("e.constructor.toString()", "function DOMException() {\n [native code]\n}");
shouldBe("e.constructor", "window.DOMException");
shouldBe("e.NETWORK_ERR", "e.constructor.NETWORK_ERR");
shouldBe("e.NETWORK_ERR", "19");
</script>
</body>
</html>