| Index: src/v8natives.js
|
| ===================================================================
|
| --- src/v8natives.js (revision 3610)
|
| +++ src/v8natives.js (working copy)
|
| @@ -276,7 +276,7 @@
|
|
|
| function ObjectKeys(obj) {
|
| if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj))
|
| - throw MakeTypeError('object_keys_non_object', [obj]);
|
| + throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
|
| return %LocalKeys(obj);
|
| }
|
|
|
| @@ -493,23 +493,59 @@
|
|
|
| // ES5 section 15.2.3.2.
|
| function ObjectGetPrototypeOf(obj) {
|
| - if (!IS_OBJECT(obj) && !IS_FUNCTION(obj)) {
|
| - throw MakeTypeError("object_get_prototype_non_object", [obj]);
|
| - }
|
| - return obj.__proto__;
|
| + if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj))
|
| + throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]);
|
| + return obj.__proto__;
|
| }
|
|
|
|
|
| // ES5 section 15.2.3.3
|
| function ObjectGetOwnPropertyDescriptor(obj, p) {
|
| - if (!IS_OBJECT(obj) && !IS_FUNCTION(obj)) {
|
| - throw MakeTypeError("object_get_prototype_non_object", [obj]);
|
| - }
|
| + if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj))
|
| + throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyDescriptor"]);
|
| var desc = GetOwnProperty(obj, p);
|
| return FromPropertyDescriptor(desc);
|
| }
|
|
|
|
|
| +// ES5 section 15.2.3.4.
|
| +function ObjectGetOwnPropertyNames(obj) {
|
| + if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj))
|
| + throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]);
|
| +
|
| + // Find all the indexed properties.
|
| +
|
| + // Get the local element names.
|
| + var propertyNames = %GetLocalElementNames(obj);
|
| +
|
| + // Get names for indexed interceptor properties.
|
| + if (%GetInterceptorInfo(obj) & 1) {
|
| + var indexedInterceptorNames =
|
| + %GetIndexedInterceptorElementNames(obj);
|
| + if (indexedInterceptorNames) {
|
| + propertyNames = propertyNames.concat(indexedInterceptorNames);
|
| + }
|
| + }
|
| +
|
| + // Find all the named properties.
|
| +
|
| + // Get the local property names.
|
| + propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj));
|
| +
|
| + // Get names for named interceptor properties if any.
|
| +
|
| + if (%GetInterceptorInfo(obj) & 2) {
|
| + var namedInterceptorNames =
|
| + %GetNamedInterceptorPropertyNames(obj);
|
| + if (namedInterceptorNames) {
|
| + propertyNames = propertyNames.concat(namedInterceptorNames);
|
| + }
|
| + }
|
| +
|
| + return propertyNames;
|
| +}
|
| +
|
| +
|
| // ES5 section 15.2.3.5.
|
| function ObjectCreate(proto, properties) {
|
| if (!IS_OBJECT(proto) && !IS_NULL(proto)) {
|
| @@ -576,7 +612,8 @@
|
| "keys", ObjectKeys,
|
| "create", ObjectCreate,
|
| "getPrototypeOf", ObjectGetPrototypeOf,
|
| - "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor
|
| + "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor,
|
| + "getOwnPropertyNames", ObjectGetOwnPropertyNames
|
| ));
|
| }
|
|
|
|
|