Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: src/v8natives.js

Issue 7321004: Implement Object.keys for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 831dd14ef84b233764946a02aef650ac86a8ea04..2759819a5fca408128e241975eb53b2b9f66adf1 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);
Mads Ager (chromium) 2011/07/12 13:28:19 Do you want to rely on Function.prototype.call her
rossberg 2011/07/13 10:11:52 Done, here and in a few other places. (Btw, who pi
Mads Ager (chromium) 2011/07/13 10:17:25 I don't remember. I would have preferred having th
+ return ToStringArray(names);
+ }
return %LocalKeys(obj);
}
« src/proxy.js ('K') | « src/proxy.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698