| Index: src/v8natives.js
|
| ===================================================================
|
| --- src/v8natives.js (revision 8632)
|
| +++ src/v8natives.js (working copy)
|
| @@ -308,6 +308,13 @@
|
| function ObjectKeys(obj) {
|
| if (!IS_SPEC_OBJECT(obj))
|
| throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
|
| + if (%IsJSProxy(obj)) {
|
| + var handler = %GetHandler(obj);
|
| + var keys = handler.keys;
|
| + if (IS_UNDEFINED(keys)) keys = DerivedKeysTrap;
|
| + var names = %_CallFunction(handler, keys);
|
| + return ToStringArray(names);
|
| + }
|
| return %LocalKeys(obj);
|
| }
|
|
|
| @@ -585,10 +592,10 @@
|
| throw MakeTypeError("handler_trap_missing",
|
| [handler, "getPropertyDescriptor"]);
|
| }
|
| - var descriptor = getProperty.call(handler, p);
|
| + var descriptor = %_CallFunction(handler, p, getProperty);
|
| if (IS_UNDEFINED(descriptor)) return descriptor;
|
| var desc = ToCompletePropertyDescriptor(descriptor);
|
| - if (!desc.configurable) {
|
| + if (!desc.isConfigurable()) {
|
| throw MakeTypeError("proxy_prop_not_configurable",
|
| [handler, "getPropertyDescriptor", p, descriptor]);
|
| }
|
| @@ -608,7 +615,7 @@
|
| var handler = %GetHandler(obj);
|
| var has = handler.has;
|
| if (IS_UNDEFINED(has)) has = DerivedHasTrap;
|
| - return ToBoolean(has.call(handler, obj, p));
|
| + return ToBoolean(%_CallFunction(handler, obj, p, has));
|
| }
|
| var desc = GetProperty(obj, p);
|
| return IS_UNDEFINED(desc) ? false : true;
|
| @@ -617,6 +624,23 @@
|
|
|
| // ES5 section 8.12.1.
|
| function GetOwnProperty(obj, p) {
|
| + if (%IsJSProxy(obj)) {
|
| + var handler = %GetHandler(obj);
|
| + var getOwnProperty = handler.getOwnPropertyDescriptor;
|
| + if (IS_UNDEFINED(getOwnProperty)) {
|
| + throw MakeTypeError("handler_trap_missing",
|
| + [handler, "getOwnPropertyDescriptor"]);
|
| + }
|
| + var descriptor = %_CallFunction(handler, p, getOwnProperty);
|
| + if (IS_UNDEFINED(descriptor)) return descriptor;
|
| + var desc = ToCompletePropertyDescriptor(descriptor);
|
| + if (!desc.isConfigurable()) {
|
| + throw MakeTypeError("proxy_prop_not_configurable",
|
| + [handler, "getOwnPropertyDescriptor", p, descriptor]);
|
| + }
|
| + return desc;
|
| + }
|
| +
|
| // GetOwnProperty returns an array indexed by the constants
|
| // defined in macros.py.
|
| // If p is not a property on obj undefined is returned.
|
| @@ -636,7 +660,7 @@
|
| if (IS_UNDEFINED(defineProperty)) {
|
| throw MakeTypeError("handler_trap_missing", [handler, "defineProperty"]);
|
| }
|
| - var result = defineProperty.call(handler, p, attributes);
|
| + var result = %_CallFunction(handler, p, attributes, defineProperty);
|
| if (!ToBoolean(result)) {
|
| if (should_throw) {
|
| throw MakeTypeError("handler_failed", [handler, "defineProperty"]);
|
| @@ -829,7 +853,8 @@
|
| // ES5 section 15.2.3.3
|
| function ObjectGetOwnPropertyDescriptor(obj, p) {
|
| if (!IS_SPEC_OBJECT(obj))
|
| - throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyDescriptor"]);
|
| + throw MakeTypeError("obj_ctor_property_non_object",
|
| + ["getOwnPropertyDescriptor"]);
|
| var desc = GetOwnProperty(obj, p);
|
| return FromPropertyDescriptor(desc);
|
| }
|
| @@ -868,7 +893,7 @@
|
| throw MakeTypeError("handler_trap_missing",
|
| [handler, "getOwnPropertyNames"]);
|
| }
|
| - var names = getOwnPropertyNames.call(handler);
|
| + var names = %_CallFunction(handler, getOwnPropertyNames);
|
| return ToStringArray(names, "getOwnPropertyNames");
|
| }
|
|
|
|
|