Bug 163495
Summary: | JSON.parse should modify configurable non-writable properties. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mark Lam <mark.lam> |
Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> |
Status: | ASSIGNED | ||
Severity: | Normal | CC: | fpizlo, ggaren, jfbastien, keith_miller, msaboff, saam, ysuzuki |
Priority: | P2 | ||
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 163446 | ||
Bug Blocks: |
Mark Lam
This is because the JSON.parse spec (see https://tc39.github.io/ecma262/#sec-json.parse and https://tc39.github.io/ecma262/#sec-internalizejsonproperty) uses CreateDataProperty to set properties that the reviver wants to set. The CreateDataProperty spec (see https://tc39.github.io/ecma262/#sec-createdataproperty) says that it uses [[DefineOwnProperty]] to perform this set. As a result, if the property was configurable to begin with, it's [[Writable]] will be overridden to be true, and the new value should be applied.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Lam
We can't do this currently achieve this for array like objects, because the existing code path that does the "put" operation does not allow us to indicate that the put with a DefineOwnProperty mode.
Mark Lam
A test case in JSTests/stress/json-parse-on-non-configurable-non-writable-property.js (which should land with https://bugs.webkit.org/show_bug.cgi?id=163446) is commented out due to this bug. Please uncomment that test when this is fixed.