Changeset 109240 in webkit
- Timestamp:
- Feb 29, 2012 11:59:43 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109238 r109240 1 2012-02-29 Gavin Barraclough <barraclough@apple.com> 2 3 Writable attribute not set correctly when redefining an accessor to a data descriptor 4 https://bugs.webkit.org/show_bug.cgi?id=79931 5 6 Reviewed by Oliver Hunt. 7 8 * fast/js/Object-defineProperty-expected.txt: 9 * fast/js/script-tests/Object-defineProperty.js: 10 - Added tests. 11 1 12 2012-02-29 Max Feil <mfeil@rim.com> 2 13 -
trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt
r108427 r109240 117 117 PASS var o = {}; o.readOnly = false; o.readOnly is true 118 118 PASS 'use strict'; var o = {}; o.readOnly = false; o.readOnly threw exception TypeError: Attempted to assign to readonly property.. 119 PASS Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false}), 'foo').writable is false 120 PASS Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: false}), 'foo').writable is false 121 PASS Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: true}), 'foo').writable is true 119 122 PASS successfullyParsed is true 120 123 -
trunk/LayoutTests/fast/js/script-tests/Object-defineProperty.js
r108427 r109240 168 168 delete Object.prototype.readOnly; 169 169 170 170 // Check the writable attribute is set correctly when redefining an accessor as a data descriptor. 171 shouldBeFalse("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false}), 'foo').writable"); 172 shouldBeFalse("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: false}), 'foo').writable"); 173 shouldBeTrue("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: true}), 'foo').writable"); -
trunk/Source/JavaScriptCore/ChangeLog
r109224 r109240 1 2012-02-29 Gavin Barraclough <barraclough@apple.com> 2 3 Writable attribute not set correctly when redefining an accessor to a data descriptor 4 https://bugs.webkit.org/show_bug.cgi?id=79931 5 6 Reviewed by Oliver Hunt. 7 8 * runtime/JSObject.cpp: 9 (JSC::JSObject::defineOwnProperty): 10 - use attributesOverridingCurrent instead of attributesWithOverride. 11 * runtime/PropertyDescriptor.cpp: 12 * runtime/PropertyDescriptor.h: 13 - remove attributesWithOverride - attributesOverridingCurrent does the same thing. 14 1 15 2012-02-29 Kevin Ollivier <kevino@theolliviers.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r109177 r109240 703 703 if (!current.attributesEqual(descriptor)) { 704 704 object->methodTable()->deleteProperty(object, exec, propertyName); 705 return putDescriptor(exec, object, propertyName, descriptor, current.attributesWithOverride(descriptor), current);705 return putDescriptor(exec, object, propertyName, descriptor, descriptor.attributesOverridingCurrent(current), current); 706 706 } 707 707 return true; … … 716 716 } 717 717 object->methodTable()->deleteProperty(object, exec, propertyName); 718 return putDescriptor(exec, object, propertyName, descriptor, current.attributesWithOverride(descriptor), current);718 return putDescriptor(exec, object, propertyName, descriptor, descriptor.attributesOverridingCurrent(current), current); 719 719 } 720 720 … … 738 738 return true; 739 739 object->methodTable()->deleteProperty(object, exec, propertyName); 740 return putDescriptor(exec, object, propertyName, descriptor, current.attributesWithOverride(descriptor), current);740 return putDescriptor(exec, object, propertyName, descriptor, descriptor.attributesOverridingCurrent(current), current); 741 741 } 742 742 -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
r107956 r109240 207 207 } 208 208 209 unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const210 {211 unsigned mismatch = other.m_attributes ^ m_attributes;212 unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;213 unsigned newAttributes = m_attributes & defaultAttributes;214 if (sharedSeen & WritablePresent && mismatch & ReadOnly)215 newAttributes ^= ReadOnly;216 if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)217 newAttributes ^= DontDelete;218 if (sharedSeen & EnumerablePresent && mismatch & DontEnum)219 newAttributes ^= DontEnum;220 if (isAccessorDescriptor() && other.isDataDescriptor())221 newAttributes |= ReadOnly;222 return newAttributes;223 }224 225 209 unsigned PropertyDescriptor::attributesOverridingCurrent(const PropertyDescriptor& current) const 226 210 { -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.h
r104900 r109240 71 71 bool equalTo(ExecState* exec, const PropertyDescriptor& other) const; 72 72 bool attributesEqual(const PropertyDescriptor& other) const; 73 unsigned attributesWithOverride(const PropertyDescriptor& other) const;74 73 unsigned attributesOverridingCurrent(const PropertyDescriptor& current) const; 75 74
Note: See TracChangeset
for help on using the changeset viewer.