WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
Bug 163495
JSON.parse should modify configurable non-writable properties.
https://bugs.webkit.org/show_bug.cgi?id=163495
Summary
JSON.parse should modify configurable non-writable properties.
Mark Lam
Reported
2016-10-15 17:15:19 PDT
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
Comment 1
2016-10-15 17:17:34 PDT
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
Comment 2
2016-10-15 17:19:35 PDT
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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug