<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:jfbastien@apple.com" title="JF Bastien <jfbastien@apple.com>"> <span class="fn">JF Bastien</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - Web Inspector: JSON Parse error message should include more useful details about what caused parsing to fail"
href="https://bugs.webkit.org/show_bug.cgi?id=158033">bug 158033</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>jfbastien@apple.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Web Inspector: JSON Parse error message should include more useful details about what caused parsing to fail"
href="https://bugs.webkit.org/show_bug.cgi?id=158033#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Web Inspector: JSON Parse error message should include more useful details about what caused parsing to fail"
href="https://bugs.webkit.org/show_bug.cgi?id=158033">bug 158033</a>
from <span class="vcard"><a class="email" href="mailto:jfbastien@apple.com" title="JF Bastien <jfbastien@apple.com>"> <span class="fn">JF Bastien</span></a>
</span></b>
<pre>This is pretty bad:
jsc -e 'JSON.parse("{\"a\": {},}")'
Exception: SyntaxError: JSON Parse error: Property name must be a string literal
at [Command Line]:1
parse@[native code]
global code@[Command Line]:1:11
Looks like it comes from JSC:
Source/JavaScriptCore/runtime/LiteralParser.cpp: m_parseErrorMessage = ASCIILiteral("Property name must be a string literal");
There are some tests for it:
LayoutTests/js/dom/JSON-parse-expected.txt:PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Property name must be a string literal.
LayoutTests/js/dom/JSON-parse-expected.txt:PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Property name must be a string literal.
I may un-lazy and try to improve it at some point...</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>