Closed
Bug 653847
Opened 14 years ago
Closed 14 years ago
JSON.parse() should throw a SyntaxError, not a TypeError
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla6
People
(Reporter: Waldo, Assigned: Waldo)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
3.33 KB,
patch
|
paul.biggar
:
review+
|
Details | Diff | Splinter Review |
JSON.parse doesn't care how many arguments it's called with, because it just assumes they're there (and gets undefined for any arguments that aren't, as with all spec methods). So JSON.parse() is JSON.parse(undefined) which throws a SyntaxError, not a TypeError for not enough arguments.
This is the last spec incompatibility in JSON.parse that I'm aware of. (Walk has some cruft to it, but I don't think any of it is spec-incompatible cruft, although it's possible I'm mistaken on the point.)
Assignee | ||
Comment 1•14 years ago
|
||
Attachment #529216 -
Flags: review?(pbiggar)
Comment 2•14 years ago
|
||
Comment on attachment 529216 [details] [diff] [review]
Patch and test
Review of attachment 529216 [details] [diff] [review]:
+1 for the spec step comments.
Attachment #529216 -
Flags: review?(pbiggar) → review+
Assignee | ||
Comment 3•14 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 4•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/c35425fb6956
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•