Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 831dd14ef84b233764946a02aef650ac86a8ea04..f5b5ab8fa2c29f85ea73d5a091a3ed3730618e6f 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 = keys.call(handler); |
+ return ToStringArray(names); |
+ } |
return %LocalKeys(obj); |
} |
@@ -588,7 +595,7 @@ function GetProperty(obj, p) { |
var descriptor = getProperty.call(handler, p); |
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]); |
} |
@@ -617,6 +624,23 @@ function HasProperty(obj, p) { |
// 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 = getOwnProperty.call(handler, p); |
Mads Ager (chromium)
2011/07/12 13:45:42
Want to rely on Function.prototype.call which can
rossberg
2011/07/15 08:48:38
Done.
|
+ 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. |
@@ -829,7 +853,8 @@ function ObjectGetPrototypeOf(obj) { |
// 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); |
} |