Bug 42181

Summary: JSC parse errors don't show enough detail
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: abarth, barraclough, dglazkov, fishd, ggaren, joepeck, oliver, zherczeg
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   

Description Eric Seidel (no email) 2010-07-13 11:30:16 PDT
== JSC ==

CONSOLE MESSAGE: line 1: SyntaxError: Parse error

== V8 ==

CONSOLE MESSAGE: line 1: Uncaught SyntaxError: Unexpected token <

Arguably V8 is in the wrong here, since JSC is the standard engine for WebKit.  However, I think it's nice that V8 shows the token which is unexpected.  Would be even better if both error messages told the column number (since clearly V8 has it and JSC should be able to get it).
Comment 1 Eric Seidel (no email) 2010-07-13 11:33:47 PDT
This bug came up because we were asking the V8 team to change their errors to match JSC (to minimize chromium layout test differences).  They noted that in this case their error is "better".  I agree, that at least the "unexpected token" part is nice.

In then end, I don't personally care which engine's messages they both converge on, but it would unfork about a zillion layout test results if they were made identical.

In the case of this bug, v8 can change to be identical to JSC here, however I think JSC should probably also consider adding information about exact location of the syntax error.
Comment 2 Zoltan Herczeg 2010-07-13 11:53:28 PDT
You talk only about parse errors, or something in general? If it related only for parse error, I suggest to change the bug title.

Anyway, I think the recursive descent parser should be able handle it, the last token is still kept in the lexer after an error. If the others like the idea, I volunteer to implement the patch.
Comment 3 Adam Barth 2010-07-13 12:00:26 PDT
Let's start with parse errors, since those are pretty useful to web devs.
Comment 4 Zoltan Herczeg 2010-07-22 06:32:33 PDT
Any decision here? (It is not worth to start working on it before I hear the opinion of JSC developers. We need to decide the full format of syntax error as well)
Comment 5 Gavin Barraclough 2011-08-12 01:10:36 PDT

*** This bug has been marked as a duplicate of bug 62613 ***