Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2005 18:02:57 +0000 (18:02 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2005 18:02:57 +0000 (18:02 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/fast/js/exception-linenums-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/exception-linenums.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23

diff --git a/LayoutTests/fast/js/exception-linenums-expected.txt b/LayoutTests/fast/js/exception-linenums-expected.txt
new file mode 100644 (file)
index 0000000..f440b05
--- /dev/null
@@ -0,0 +1,10 @@
+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
+
diff --git a/LayoutTests/fast/js/exception-linenums.html b/LayoutTests/fast/js/exception-linenums.html
new file mode 100644 (file)
index 0000000..4561f5e
--- /dev/null
@@ -0,0 +1,84 @@
+<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>
index 87719c60b5a84ca3fa27fa1b7e5daf60737d25d3..d55e86d671c64911735d086f0ce1bf7293a5e9fe 100644 (file)
@@ -1,3 +1,14 @@
+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.