Changeset 154630 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Aug 26, 2013, 1:01:55 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r154629 r154630 1 2013-08-26 Mark Hahnenberg <[email protected]> 2 3 Object.defineProperty should be able to create a PropertyDescriptor where m_attributes == 0 4 https://bugs.webkit.org/show_bug.cgi?id=120314 5 6 Reviewed by Darin Adler. 7 8 Currently with the way that defineProperty works, we leave a stray low bit set in 9 PropertyDescriptor::m_attributes in the following code: 10 11 var o = {}; 12 Object.defineProperty(o, 100, {writable:true, enumerable:true, configurable:true, value:"foo"}); 13 14 This is due to the fact that the lowest non-zero attribute (ReadOnly) is represented as 1 << 1 15 instead of 1 << 0. We then calculate the default attributes as (DontDelete << 1) - 1, which is 0xF, 16 but only the top three bits mean anything. Even in the case above, the top three bits are set 17 to 0 but the bottom bit remains set, which causes us to think m_attributes is non-zero. 18 19 Since some of these attributes and their corresponding values are exposed in the JavaScriptCore 20 framework's public C API, it's safer to just change how we calculate the default value, which is 21 where the weirdness was originating from in the first place. 22 23 * runtime/PropertyDescriptor.cpp: 24 1 25 2013-08-24 Sam Weinig <[email protected]> 2 26 -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
r142810 r154630 34 34 35 35 namespace JSC { 36 unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1;36 unsigned PropertyDescriptor::defaultAttributes = DontDelete | DontEnum | ReadOnly; 37 37 38 38 bool PropertyDescriptor::writable() const
Note:
See TracChangeset
for help on using the changeset viewer.