Changeset 196040 in webkit
- Timestamp:
- Feb 2, 2016 7:17:53 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r196038 r196040 1 2016-02-02 Caitlin Potter <caitp@igalia.com> 2 3 [JSC] Implement Object.getOwnPropertyDescriptors() proposal 4 https://bugs.webkit.org/show_bug.cgi?id=153799 5 6 Reviewed by Darin Adler. 7 8 * js/Object-getOwnPropertyNames-expected.txt: 9 * js/script-tests/Object-getOwnPropertyNames.js: 10 1 11 2016-02-02 Brady Eidson <beidson@apple.com> 2 12 -
trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt
r195460 r196040 42 42 PASS getSortedOwnPropertyNames(encodeURI) is ['length', 'name'] 43 43 PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name'] 44 PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnProperty Names', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']44 PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf'] 45 45 PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'] 46 46 PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype'] -
trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
r195460 r196040 51 51 "encodeURIComponent": "['length', 'name']", 52 52 // Built-in ECMA objects 53 "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnProperty Names', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']",53 "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']", 54 54 "Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']", 55 55 "Function": "['length', 'name', 'prototype']", -
trunk/Source/JavaScriptCore/ChangeLog
r196035 r196040 1 2016-02-02 Caitlin Potter <caitp@igalia.com> 2 3 [JSC] Implement Object.getOwnPropertyDescriptors() proposal 4 https://bugs.webkit.org/show_bug.cgi?id=153799 5 6 Reviewed by Darin Adler. 7 8 Implements the Object.getOwnPropertyDescriptors() proposal, which 9 reached Stage 3 in the TC39 process in January 2016. 10 https://github.com/tc39/proposal-object-getownpropertydescriptors 11 12 The method extracts a set of property descriptor objects, which can 13 be safely used via `Object.create()`. 14 15 * runtime/ObjectConstructor.cpp: 16 (JSC::objectConstructorGetOwnPropertyDescriptors): 17 1 18 2016-02-02 Filip Pizlo <fpizlo@apple.com> 2 19 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r195528 r196040 69 69 setPrototypeOf objectConstructorSetPrototypeOf DontEnum|Function 2 70 70 getOwnPropertyDescriptor objectConstructorGetOwnPropertyDescriptor DontEnum|Function 2 71 getOwnPropertyDescriptors objectConstructorGetOwnPropertyDescriptors DontEnum|Function 1 71 72 getOwnPropertyNames objectConstructorGetOwnPropertyNames DontEnum|Function 1 72 73 keys objectConstructorKeys DontEnum|Function 1 … … 248 249 } 249 250 251 JSValue objectConstructorGetOwnPropertyDescriptors(ExecState* exec, JSObject* object) 252 { 253 PropertyNameArray properties(exec, PropertyNameMode::StringsAndSymbols); 254 object->getOwnPropertyNames(object, exec, properties, EnumerationMode(DontEnumPropertiesMode::Include)); 255 if (exec->hadException()) 256 return jsUndefined(); 257 258 JSObject* descriptors = constructEmptyObject(exec); 259 260 for (auto& propertyName : properties) { 261 JSValue fromDescriptor = objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName); 262 if (exec->hadException()) 263 return jsUndefined(); 264 265 descriptors->putDirect(exec->vm(), propertyName, fromDescriptor, 0); 266 } 267 268 return descriptors; 269 } 270 250 271 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec) 251 272 { … … 257 278 return JSValue::encode(jsUndefined()); 258 279 return JSValue::encode(objectConstructorGetOwnPropertyDescriptor(exec, object, propertyName)); 280 } 281 282 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(ExecState* exec) 283 { 284 JSObject* object = exec->argument(0).toObject(exec); 285 if (exec->hadException()) 286 return JSValue::encode(jsUndefined()); 287 return JSValue::encode(objectConstructorGetOwnPropertyDescriptors(exec, object)); 259 288 } 260 289 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r188529 r196040 29 29 30 30 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); 31 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(ExecState*); 31 32 EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState*); 32 33 EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*); … … 94 95 JSValue objectConstructorGetPrototypeOf(ExecState*, JSObject*); 95 96 JSValue objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, const Identifier&); 97 JSValue objectConstructorGetOwnPropertyDescriptors(ExecState*, JSObject*); 96 98 JSArray* ownPropertyKeys(ExecState*, JSObject*, PropertyNameMode, DontEnumPropertiesMode); 97 99 bool toPropertyDescriptor(ExecState*, JSValue, PropertyDescriptor&); -
trunk/Source/JavaScriptCore/tests/es6.yaml
r196033 r196040 1217 1217 - path: es6/well-known_symbols_Symbol.toStringTag_misc._built-ins.js 1218 1218 cmd: runES6 :normal 1219 # Late-stage proposals for a future ECMAScript standard 1220 # FIXME: move these to a new directory? 1221 - path: es6/Object_static_methods_Object.getOwnPropertyDescriptors.js 1222 cmd: runES6 :normal 1223 - path: es6/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js 1224 cmd: runES6 :fail
Note: See TracChangeset
for help on using the changeset viewer.