Title: [90159] trunk
Revision
90159
Author
[email protected]
Date
2011-06-30 14:41:58 -0700 (Thu, 30 Jun 2011)

Log Message

2011-06-30  Juan C. Montemayor  <[email protected]>

        Reviewed by Geoffrey Garen.

        Web Inspector fails to display source for eval with syntax error
        https://bugs.webkit.org/show_bug.cgi?id=63583

        Added new LayoutTest to check that the correct line number is added to a
        syntax error inside an eval statement.

        * fast/js/eval-contained-syntax-error-expected.txt: Added.
        * fast/js/eval-contained-syntax-error.html: Added.
        * fast/js/script-tests/eval-contained-syntax-error.js: Added.
        * platform/chromium/fast/js/eval-contained-syntax-error-expected.txt: Added.
2011-06-30  Juan C. Montemayor  <[email protected]>

        Reviewed by Geoffrey Garen.

        Web Inspector fails to display source for eval with syntax error
        https://bugs.webkit.org/show_bug.cgi?id=63583

        Web Inspector now displays a link to an eval statement that contains
        a syntax error.

        * parser/Parser.h:
        (JSC::isEvalNode):
        (JSC::EvalNode):
        (JSC::Parser::parse):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90158 => 90159)


--- trunk/LayoutTests/ChangeLog	2011-06-30 21:37:56 UTC (rev 90158)
+++ trunk/LayoutTests/ChangeLog	2011-06-30 21:41:58 UTC (rev 90159)
@@ -1,3 +1,18 @@
+2011-06-30  Juan C. Montemayor  <[email protected]>
+
+        Reviewed by Geoffrey Garen.
+
+        Web Inspector fails to display source for eval with syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=63583
+
+        Added new LayoutTest to check that the correct line number is added to a
+        syntax error inside an eval statement.
+
+        * fast/js/eval-contained-syntax-error-expected.txt: Added.
+        * fast/js/eval-contained-syntax-error.html: Added.
+        * fast/js/script-tests/eval-contained-syntax-error.js: Added.
+        * platform/chromium/fast/js/eval-contained-syntax-error-expected.txt: Added.
+
 2011-06-30  Nate Chapin  <[email protected]>
 
         Unreviewed, chromium test update after r90148.

Added: trunk/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt (0 => 90159)


--- trunk/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt	2011-06-30 21:41:58 UTC (rev 90159)
@@ -0,0 +1,10 @@
+This file tests whether a syntax error inside an eval() has the correct line number. That line number should not be the offset of an error within an eval, but rather the line of an eval itself.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS: e.line should be 6 and is.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/eval-contained-syntax-error.html (0 => 90159)


--- trunk/LayoutTests/fast/js/eval-contained-syntax-error.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/eval-contained-syntax-error.html	2011-06-30 21:41:58 UTC (rev 90159)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js (0 => 90159)


--- trunk/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js	2011-06-30 21:41:58 UTC (rev 90159)
@@ -0,0 +1,14 @@
+description(
+"This file tests whether a syntax error inside an eval() has the correct line number. That line number should not be the offset of an error within an eval, but rather the line of an eval itself. "
+);
+
+try {
+    eval("a[0]]"); //line 6: error should come from here
+} catch (e) {
+    if (e.line == 6)
+        debug("PASS: e.line should be 6 and is.");
+    else
+        debug("FAIL: e.line should be 6 but instead is " + e.line + ".");
+}
+
+var successfullyParsed = true;
\ No newline at end of file

Added: trunk/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt (0 => 90159)


--- trunk/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt	2011-06-30 21:41:58 UTC (rev 90159)
@@ -0,0 +1,10 @@
+This file tests whether a syntax error inside an eval() has the correct line number. That line number should not be the offset of an error within an eval, but rather the line of an eval itself.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL: e.line should be 6 but instead is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/_javascript_Core/ChangeLog (90158 => 90159)


--- trunk/Source/_javascript_Core/ChangeLog	2011-06-30 21:37:56 UTC (rev 90158)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-06-30 21:41:58 UTC (rev 90159)
@@ -1,3 +1,18 @@
+2011-06-30  Juan C. Montemayor  <[email protected]>
+
+        Reviewed by Geoffrey Garen.
+
+        Web Inspector fails to display source for eval with syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=63583
+
+        Web Inspector now displays a link to an eval statement that contains
+        a syntax error.
+
+        * parser/Parser.h:
+        (JSC::isEvalNode):
+        (JSC::EvalNode):
+        (JSC::Parser::parse):
+
 2011-06-30  Filip Pizlo  <[email protected]>
 
         Reviewed by Gavin Barraclough.

Modified: trunk/Source/_javascript_Core/parser/Parser.h (90158 => 90159)


--- trunk/Source/_javascript_Core/parser/Parser.h	2011-06-30 21:37:56 UTC (rev 90158)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2011-06-30 21:41:58 UTC (rev 90159)
@@ -43,6 +43,8 @@
     class ProgramNode;
     class UString;
 
+    template <typename T> inline bool isEvalNode() { return false; }
+    template <> inline bool isEvalNode<EvalNode>() { return true; }
     template <typename T> struct ParserArenaData : ParserArenaDeletable { T data; };
 
     class Parser {
@@ -109,6 +111,8 @@
             // likely, and we are currently unable to distinguish between the two cases.
             if (isFunctionBodyNode(static_cast<ParsedNode*>(0)))
                 *exception = createStackOverflowError(lexicalGlobalObject);
+            else if (isEvalNode<ParsedNode>())
+                *exception = createSyntaxError(lexicalGlobalObject, errMsg);
             else
                 *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to