diff options
| author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-06-30 21:41:58 +0000 |
|---|---|---|
| committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-06-30 21:41:58 +0000 |
| commit | a47112149041c7511c41c6ae8c56c96b14a8a927 (patch) | |
| tree | eaa42cd54022979fd0191d3a47f2315f32610247 | |
| parent | 17dba23bcb434ce1ede310dcc856a451656bf4d5 (diff) | |
| download | chromium_src-a47112149041c7511c41c6ae8c56c96b14a8a927.zip chromium_src-a47112149041c7511c41c6ae8c56c96b14a8a927.tar.gz chromium_src-a47112149041c7511c41c6ae8c56c96b14a8a927.tar.bz2 | |
2011-06-30 Juan C. Montemayor <jmont@apple.com>
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 <jmont@apple.com>
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):
git-svn-id: svn://svn.chromium.org/blink/trunk@90159 bbb929c8-8fbe-4397-9dbb-9b2b20218538
7 files changed, 81 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog index 4d767f8..4e7a912 100644 --- a/third_party/WebKit/LayoutTests/ChangeLog +++ b/third_party/WebKit/LayoutTests/ChangeLog @@ -1,3 +1,18 @@ +2011-06-30 Juan C. Montemayor <jmont@apple.com> + + 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 <japhet@chromium.org> Unreviewed, chromium test update after r90148. diff --git a/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt b/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt new file mode 100644 index 0000000..f69eca0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error-expected.txt @@ -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 + diff --git a/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error.html b/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error.html new file mode 100644 index 0000000..af599ce8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/js/eval-contained-syntax-error.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<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 src="script-tests/eval-contained-syntax-error.js"></script> +<script src="resources/js-test-post.js"></script> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js b/third_party/WebKit/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js new file mode 100644 index 0000000..06f422a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/js/script-tests/eval-contained-syntax-error.js @@ -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 diff --git a/third_party/WebKit/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt b/third_party/WebKit/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt new file mode 100644 index 0000000..63108a1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/chromium/fast/js/eval-contained-syntax-error-expected.txt @@ -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 + diff --git a/third_party/WebKit/Source/JavaScriptCore/ChangeLog b/third_party/WebKit/Source/JavaScriptCore/ChangeLog index 9417d4c..8da2d90 100644 --- a/third_party/WebKit/Source/JavaScriptCore/ChangeLog +++ b/third_party/WebKit/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,18 @@ +2011-06-30 Juan C. Montemayor <jmont@apple.com> + + 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 <fpizlo@apple.com> Reviewed by Gavin Barraclough. diff --git a/third_party/WebKit/Source/JavaScriptCore/parser/Parser.h b/third_party/WebKit/Source/JavaScriptCore/parser/Parser.h index 58398d1..2dbd27c 100644 --- a/third_party/WebKit/Source/JavaScriptCore/parser/Parser.h +++ b/third_party/WebKit/Source/JavaScriptCore/parser/Parser.h @@ -43,6 +43,8 @@ namespace JSC { 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 @@ namespace JSC { // 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); } |
