Summary: | JSON.parse should not modify frozen objects | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Lam <mark.lam> | ||||
Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | andre.bargull, fpizlo, ggaren, jfbastien, keith_miller, msaboff, oliver, saam | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Local Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Mark Lam
2016-10-13 23:43:33 PDT
Created attachment 291578 [details]
proposed patch.
Comment on attachment 291578 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=291578&action=review > JSTests/stress/json-parse-on-frozen-object.js:11 > + this.b = Object.freeze(["unmodifiable"]); This is a nice test file. Can you also add a test for making the property at 0 non-configurable and non-writable? > JSTests/stress/json-parse-on-frozen-object.js:38 > + return undefined; The behavior here is to indicate that property 0 should be deleted? (In reply to comment #2) > Comment on attachment 291578 [details] > proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=291578&action=review > > > JSTests/stress/json-parse-on-frozen-object.js:11 > > + this.b = Object.freeze(["unmodifiable"]); > > This is a nice test file. > Can you also add a test for making the property at 0 non-configurable and > non-writable? I'll work on that. > > JSTests/stress/json-parse-on-frozen-object.js:38 > > + return undefined; > > The behavior here is to indicate that property 0 should be deleted? Yes. It's in the spec. If the reviver returns undefined, JSON.parse deletes the property. (In reply to comment #3) > (In reply to comment #2) > > Can you also add a test for making the property at 0 non-configurable and > > non-writable? > > I'll work on that. Interesting. This uncovered a bug in a different area. I'll land this patch first, and fix that in a separate bug and add the non-configurable non-writable test there. I'll address the bug with non-configurable properties in https://bugs.webkit.org/show_bug.cgi?id=163446. Landed in r207341: <http://trac.webkit.org/r207341>. *** Bug 122759 has been marked as a duplicate of this bug. *** |