blob: 53f3e8f27afec1ee8bf3b4f5816f4e5f334d92c2 [file] [log] [blame]
<html>
<head><title>title
<link rel="stylesheet" href="resources/js-test-style.css">
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console. It differs from <span style="font-family: monospace;">exception-linenums-in-html-1.html</span> in that it only works if <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3905">Bugzilla Bug 3905</a> has been fixed.');
function exceptionInFunction()
{
throw Exception();
}
var e = undefined;
try {
// Raises an exception that gets picked up by KJS_CHECKEXCEPTION
document.documentElement.innerHTML(foo);
} catch (exception) {
e = exception;
}
shouldBe("typeof e.sourceURL", '"string"');
shouldBe("e.line", '21');
e = undefined;
try {
// Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE
document.documentElement.appendChild('').prefix = '';
} catch (exception) {
e = exception;
}
shouldBe("typeof e.sourceURL", '"string"');
shouldBe("e.line", '31');
e = undefined;
try {
// Raises an exception that gets picked up by KJS_CHECKEXCEPTIONREFERENCE
document.documentElement.appendChild('').innerHTML = '';
} catch (exception) {
e = exception;
}
shouldBe("typeof e.sourceURL", '"string"');
shouldBe("e.line", '41');
e = undefined;
try {
// Raises an exception that gets picked up by KJS_CHECKEXCEPTIONLIST
document.getElementById(1());
} catch (exception) {
e = exception;
}
shouldBe("typeof e.sourceURL", '"string"');
shouldBe("e.line", '51');
e = undefined;
// Raises an exception inside a function to check that its line number
// isn't overwritten in the assignment node.
try {
var a = exceptionInFunction();
} catch (exception) {
e = exception;
}
shouldBe("typeof e.sourceURL", '"string"');
shouldBe("e.line", '14');
var successfullyParsed = true;
</script>
<script src="resources/js-test-post.js"></script>
</body>
</html>