--- /dev/null
+This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console.
+
+If the test passes, you should see five exceptions caught below, with the appropriate line number for each (increasing except for the last one).
+
+Exception at line 37 with sourceURL set
+Exception at line 45 with sourceURL set
+Exception at line 53 with sourceURL set
+Exception at line 61 with sourceURL set
+Exception at line 13 with sourceURL set
+
--- /dev/null
+<html>
+ <head>
+ <script type="text/javascript">
+ function print(message)
+ {
+ var paragraph = document.createElement("li");
+ paragraph.appendChild(document.createTextNode(message));
+ document.getElementById("console").appendChild(paragraph);
+ }
+
+ function exceptionInFunction()
+ {
+ throw Exception();
+ }
+
+ function writeException(e)
+ {
+ var type = 'unset';
+ if (e.sourceURL)
+ type = 'set';
+
+ print('Exception at line ' + e.line + ' with sourceURL ' + type);
+ }
+
+ function expectedException()
+ {
+ print('An exception was expected but not thrown.');
+ }
+
+ function test() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ }
+
+ try {
+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTION
+ document.documentElement.innerHTML(foo);
+ expectedException();
+ } catch (e) {
+ writeException(e);
+ }
+
+ try {
+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE
+ document.documentElement.style.backgroundColor = 'as';
+ expectedException();
+ } catch (e) {
+ writeException(e);
+ }
+
+ try {
+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONREFERENCE
+ document.documentElement.appendChild('').innerHTML = '';
+ expectedException();
+ } catch (e) {
+ writeException(e);
+ }
+
+ try {
+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONLIST
+ document.getElementById(1());
+ expectedException();
+ } catch (e) {
+ writeException(e);
+ }
+
+ try {
+ // Raises an exception inside a function to check that its line number
+ // isn't overwritten in the assignment node.
+ var a = exceptionInFunction();
+ expectedException();
+ } catch (e) {
+ writeException(e);
+ }
+ }
+ </script>
+ </head>
+ <body onload="test()">
+ <p>This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console.</p>
+ <p>If the test passes, you should see five exceptions caught below, with the appropriate line number for each (increasing except for the last one).</p>
+ <hr>
+ <p><ol id=console></ol></p>
+ </body>
+</html>
+2005-06-10 Darin Adler <darin@apple.com>
+
+ Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
+ Refined and reviewed by me.
+
+ - test for exception file/line number fix
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=3327
+
+ * layout-tests/fast/js/exception-linenums-expected.txt: Added.
+ * layout-tests/fast/js/exception-linenums.html: Added.
+
2005-06-09 David Hyatt <hyatt@apple.com>
Fix from Carston Guenther for bugzilla bug 3236.