Commit 0630b1fd authored by yurys@chromium.org's avatar yurys@chromium.org

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
parent 6093d0db
......@@ -623,10 +623,9 @@ 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;
}
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment