Closed Bug 493586 Opened 16 years ago Closed 16 years ago

JSON.parse's replacer function can't return undefined

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: zeniko, Assigned: sayrer)

References

()

Details

(Keywords: fixed1.9.1, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Returning undefined is supposed to be used for filtering out specific keys. Filtering out the "key" key from { key: value } correctly results in "{}" in IE8 but the invalid "{key:}" in Shiretoko (stringify can thus return a string which parse can't handle).
Flags: blocking1.9.1?
Flags: blocking1.9.1? → blocking1.9.1+
Assignee: general → sayrer
ugh, embarassing. patch soon.
Attached patch fixSplinter Review
insidious. source-line test coverage metrics wouldn't catch this.
Attachment #378132 - Flags: review?(brendan)
Attachment #378132 - Flags: review?(brendan) → review+
Comment on attachment 378132 [details] [diff] [review] fix So JO and Str are from ES5 draft, but life's simpler there it seems. >+static JSBool CallReplacerFunction(JSContext *cx, jsid id, JSObject *holder, >+ StringifyContext *scx, jsval *vp); >+static JSBool Str(JSContext *cx, jsid id, JSObject *holder, >+ StringifyContext *scx, jsval *vp, bool callReplacer=true); Space on both sides of = in house style. r=me with that, thanks. /be
(In reply to comment #3) > (From update of attachment 378132 [details] [diff] [review]) > So JO and Str are from ES5 draft, but life's simpler there it seems. The spec is written as if implemented in JS. Everything buffers output, rather than streaming when ready.
Keywords: 4xp
Whiteboard: fixed-in-tracemonkey
Keywords: 4xp
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Depends on: 509184
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: