Ignore:
Timestamp:
Jul 26, 2011, 10:53:40 AM (14 years ago)
Author:
[email protected]
Message:

JSON errors should be informative
https://bugs.webkit.org/show_bug.cgi?id=63339

Source/JavaScriptCore:

Added error messages to the JSON Parser.

Patch by Juan C. Montemayor <[email protected]> on 2011-07-26
Reviewed by Oliver Hunt.

  • runtime/JSONObject.cpp:

(JSC::JSONProtoFuncParse):

  • runtime/LiteralParser.cpp:

(JSC::LiteralParser::Lexer::lex):
(JSC::LiteralParser::Lexer::lexString):
(JSC::LiteralParser::Lexer::lexNumber):
(JSC::LiteralParser::parse):

  • runtime/LiteralParser.h:

(JSC::LiteralParser::getErrorMessage):
(JSC::LiteralParser::Lexer::sawError):
(JSC::LiteralParser::Lexer::getErrorMessage):

LayoutTests:

Updated expected test results.

Patch by Juan C. Montemayor <[email protected]> on 2011-07-26
Reviewed by Oliver Hunt.

  • fast/js/JSON-parse-expected.txt:
  • platform/chromium/fast/js/JSON-parse-expected.txt: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r91715 r91765  
    820820    JSValue unfiltered = jsonParser.tryLiteralParse();
    821821    if (!unfiltered)
    822         return throwVMError(exec, createSyntaxError(exec, "Unable to parse JSON string"));
     822        return throwVMError(exec, createSyntaxError(exec, jsonParser.getErrorMessage()));
    823823   
    824824    if (exec->argumentCount() < 2)
Note: See TracChangeset for help on using the changeset viewer.