[[Put]] should throw if prototype chain contains a readonly property.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 06:17:40 +0000 (06:17 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 06:17:40 +0000 (06:17 +0000)
commit75e6817e3e13068abb0e4af1319f791428d2916a
treef7f86e188120be23c0f7b40f1829ce8472a8f25a
parent330b493eecca3ad16ee3baf0338226efc53918c2
[[Put]] should throw if prototype chain contains a readonly property.
https://bugs.webkit.org/show_bug.cgi?id=79069

Reviewed by Oliver Hunt.

Currently we only check the base of the put, not the prototype chain.
Fold this check in with the test for accessors.

Source/JavaScriptCore:

* runtime/JSObject.cpp:
(JSC::JSObject::put):
    - Updated to test all objects in the propotype chain for readonly properties.
(JSC::JSObject::putDirectAccessor):
(JSC::putDescriptor):
    - Record the presence of readonly properties on the structure.
* runtime/Structure.cpp:
(JSC::Structure::Structure):
    - hasGetterSetterPropertiesExcludingProto expanded to hasReadOnlyOrGetterSetterPropertiesExcludingProto.
* runtime/Structure.h:
(JSC::Structure::hasReadOnlyOrGetterSetterPropertiesExcludingProto):
(JSC::Structure::setHasGetterSetterProperties):
    - hasGetterSetterPropertiesExcludingProto expanded to hasReadOnlyOrGetterSetterPropertiesExcludingProto.
(JSC::Structure::setContainsReadOnlyProperties):
    - Added.

LayoutTests:

* fast/js/Object-defineProperty-expected.txt:
* fast/js/script-tests/Object-defineProperty.js:
(get shouldBeTrue):
    - Added test case.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@108304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/js/Object-defineProperty-expected.txt
LayoutTests/fast/js/script-tests/Object-defineProperty.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/Structure.cpp
Source/JavaScriptCore/runtime/Structure.h