[Webkit-unassigned] [Bug 46057] Bad end-of-line management in JSON.parse

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 20 11:58:34 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=46057


Oliver Hunt <oliver at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Oliver Hunt <oliver at apple.com>  2010-09-20 11:58:34 PST ---
Firefox and Chrome are both incorrect -- When you do JSON.parse('"\n"') you are asking for the JSON parser to accept a new line in the middle of a string literal.

Because you have not escaped the new line character in the string that you pass to JSON, you have only escaped it in the JS parser.  The string passed to JSON.parse must include the escapes so you actually need to do

JSON.parse('"\\n"')

The \\ escapes the \ when the script is parse, so you are then passing the string "\n" to the JSON parser.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list