Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 831dd14ef84b233764946a02aef650ac86a8ea04..df918298d0216d59cb2a1c59cab26f06085bb7ac 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -308,6 +308,13 @@ function ObjectLookupSetter(name) { |
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,7 +592,7 @@ function GetProperty(obj, p) { |
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) { |
@@ -608,7 +615,7 @@ function HasProperty(obj, p) { |
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; |
@@ -636,7 +643,7 @@ function DefineProxyProperty(obj, p, attributes, should_throw) { |
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"]); |
@@ -868,7 +875,7 @@ function ObjectGetOwnPropertyNames(obj) { |
throw MakeTypeError("handler_trap_missing", |
[handler, "getOwnPropertyNames"]); |
} |
- var names = getOwnPropertyNames.call(handler); |
+ var names = %_CallFunction(handler, getOwnPropertyNames); |
return ToStringArray(names, "getOwnPropertyNames"); |
} |