Reviewers: Søren Gjesse,
Description:
Object.getOwnPropertyNames should return string names for indexed
properties.
Please review this at http://codereview.chromium.org/596117
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/v8natives.js
M test/mjsunit/object-get-own-property-names.js
Index: test/mjsunit/object-get-own-property-names.js
===================================================================
--- test/mjsunit/object-get-own-property-names.js (revision 3859)
+++ test/mjsunit/object-get-own-property-names.js (working copy)
@@ -57,6 +57,8 @@
assertEquals(3, propertyNames.length);
assertEquals("0", propertyNames[0]);
assertEquals("1", propertyNames[1]);
+assertEquals("string", typeof propertyNames[0]);
+assertEquals("string", typeof propertyNames[1]);
assertEquals("length", propertyNames[2]);
// Check that no proto properties are returned.
Index: src/v8natives.js
===================================================================
--- src/v8natives.js (revision 3859)
+++ src/v8natives.js (working copy)
@@ -623,9 +623,8 @@
if (%GetInterceptorInfo(obj) & 1) {
var indexedInterceptorNames =
%GetIndexedInterceptorElementNames(obj);
- if (indexedInterceptorNames) {
+ if (indexedInterceptorNames)
propertyNames = propertyNames.concat(indexedInterceptorNames);
- }
}
// Find all the named properties.
@@ -643,6 +642,10 @@
}
}
+ // Property names are expected to be strings.
+ for (var i = 0; i < propertyNames.length; ++i)
+ propertyNames[i] = ToString(propertyNames[i]);
+
return propertyNames;
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev