Closed Bug 939410 Opened 11 years ago Closed 11 years ago

JSON.parse() return incorrect error position

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: isk, Assigned: isk)

References

Details

Attachments

(1 file)

I make JSONParser::getTextPosition in bug507998 and I found JSON.parse() return incorrect error position such as below.
> js> JSON.parse("[,7,6]")
> typein:1:0 SyntaxError: JSON.parse: unexpected character at line 1 column 3 of the JSON data

Expected value is "line 1 column 2".
Attached patch bug939410.patchSplinter Review
The reason which failed test was simple.
JSON::advance() advance "current" pointer in spite of the error.
So I reverse "current" pointer when it has error.
Attachment #833323 - Flags: review?(jorendorff)
Attachment #833323 - Flags: review?(jorendorff) → review?(n.nethercote)
Status: NEW → ASSIGNED
Comment on attachment 833323 [details] [diff] [review]
bug939410.patch

Is this patch a modification to another patch that hasn't yet landed?  It should just be merged into the other patch and the combined patch posted in Bugzilla.  Or am I misunderstanding.
Attachment #833323 - Flags: review?(n.nethercote)
This patch is related to bug507998.
This patch should be merge into  bug507998's patch?
Yes please.
I think you've merged it.  So can we close this bug report?
(In reply to Nicholas Nethercote [:njn] from comment #5)
> I think you've merged it.  So can we close this bug report?

Yes.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 507998
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: