Object.getOwnPropertyNames should return string names for indexed properties

Land original change by pfeldman: http://codereview.chromium.org/596117
Review URL: http://codereview.chromium.org/596124

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3866 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2010-02-16 10:08:39 +00:00
parent 6093d0dbf5
commit 0630b1fd9f
2 changed files with 7 additions and 2 deletions

View File

@ -623,9 +623,8 @@ function ObjectGetOwnPropertyNames(obj) {
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 @@ function ObjectGetOwnPropertyNames(obj) {
}
}
// Property names are expected to be strings.
for (var i = 0; i < propertyNames.length; ++i)
propertyNames[i] = ToString(propertyNames[i]);
return propertyNames;
}

View File

@ -57,6 +57,8 @@ propertyNames.sort();
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.