Reviewers: rossberg,

Message:
PTAL

Description:
Fix ToNameArray

BUG=

Please review this at https://codereview.chromium.org/1146113004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+8, -2 lines):
  M src/v8natives.js
  M test/mjsunit/harmony/proxies-for.js


Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 180c05e1ebc81c4385dba9e6a347f0863ee93d47..fb8435d91b3b6abf1aaf26e43d31705f5a0a70b2 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1079,7 +1079,7 @@ function ToNameArray(obj, trap, includeSymbols) {
     if (%HasOwnProperty(names, s)) {
       throw MakeTypeError(kProxyRepeatedPropName, trap, s);
     }
-    array[index] = s;
+    array[realLength] = s;
     ++realLength;
     names[s] = 0;
   }
Index: test/mjsunit/harmony/proxies-for.js
diff --git a/test/mjsunit/harmony/proxies-for.js b/test/mjsunit/harmony/proxies-for.js index d0f2a022fd176b1f548e69cbf8bc5edc7651a9d7..45076c8f743df8c71f0486951da2a22a5407a2d8 100644
--- a/test/mjsunit/harmony/proxies-for.js
+++ b/test/mjsunit/harmony/proxies-for.js
@@ -165,4 +165,10 @@ TestForInThrow(Proxy.create({
   get: function(pr, pk) {
     return function() { throw "myexn" }
   }
-}))
+}));
+
+(function () {
+  var p = Proxy.create({getOwnPropertyNames:
+    function() { return [1, Symbol(), 2] }});
+  assertEquals(["1","2"], Object.getOwnPropertyNames(p));
+})();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to