blob: df239bdd15f570668df6ff9bd625d93ce43aa4f5 [file] [log] [blame]
<html>
<body>
<p>Tests the properties of the XMLHttpRequestException object.</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.php', false);
req.send(null);
// raises NETWORK_ERR
} catch (err) {
e = err;
}
shouldBeEqualToString("e.toString()", "Error: NETWORK_ERR: XMLHttpRequest Exception 101");
shouldBeEqualToString("Object.prototype.toString.call(e)", "[object XMLHttpRequestException]");
shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object XMLHttpRequestException]");
shouldBeEqualToString("e.constructor.toString()", "[object XMLHttpRequestExceptionConstructor]");
shouldBe("e.constructor", "window.XMLHttpRequestException");
shouldBe("e.NETWORK_ERR", "e.constructor.NETWORK_ERR");
shouldBe("e.NETWORK_ERR", "101");
</script>
</body>
</html>