Revision: 11676
Author:   [email protected]
Date:     Tue May 29 06:57:55 2012
Log: Proxies: Fix ToStringArray function so that it does not reject some keys.

[email protected]
BUG=v8:1543
TEST=

Review URL: https://chromiumcodereview.appspot.com/10453053
http://code.google.com/p/v8/source/detail?r=11676

Modified:
 /branches/bleeding_edge/src/v8natives.js
 /branches/bleeding_edge/test/mjsunit/harmony/proxies.js

=======================================
--- /branches/bleeding_edge/src/v8natives.js    Thu Mar  8 08:38:44 2012
+++ /branches/bleeding_edge/src/v8natives.js    Tue May 29 06:57:55 2012
@@ -337,7 +337,7 @@
   if (%IsJSProxy(obj)) {
     var handler = %GetHandler(obj);
     var names = CallTrap0(handler, "keys", DerivedKeysTrap);
-    return ToStringArray(names);
+    return ToStringArray(names, "keys");
   }
   return %LocalKeys(obj);
 }
@@ -963,7 +963,7 @@
   var names = {};  // TODO(rossberg): use sets once they are ready.
   for (var index = 0; index < n; index++) {
     var s = ToString(obj[index]);
-    if (s in names) {
+    if (%HasLocalProperty(names, s)) {
       throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
     }
     array[index] = s;
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Fri Mar 23 03:25:14 2012 +++ /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Tue May 29 06:57:55 2012
@@ -1630,8 +1630,8 @@
   getOwnPropertyNames: function() { return [] }
 })

-TestPropertyNames(["a", "zz", " ", "0"], {
-  getOwnPropertyNames: function() { return ["a", "zz", " ", 0] }
+TestPropertyNames(["a", "zz", " ", "0", "toString"], {
+ getOwnPropertyNames: function() { return ["a", "zz", " ", 0, "toString"] }
 })

 TestPropertyNames(["throw", "function "], {
@@ -1678,8 +1678,8 @@
   keys: function() { return [] }
 })

-TestKeys(["a", "zz", " ", "0"], {
-  keys: function() { return ["a", "zz", " ", 0] }
+TestKeys(["a", "zz", " ", "0", "toString"], {
+  keys: function() { return ["a", "zz", " ", 0, "toString"] }
 })

 TestKeys(["throw", "function "], {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to