Status: New
Owner: ----
New issue 2363 by [email protected]: Object.keys() is not returning
property that is enumerable and on object
http://code.google.com/p/v8/issues/detail?id=2363
Chrome: 24.0.1294.0 (Official Build 161699) canary
V8: 3.14.3
I have an object: GS.Views.SongGrid.prototype.defaults and for some reason
the property "columns" is not being enumerated in a for...in loop. I
investigated further and possibly discovered a bug.
Object.keys(GS.Views.SongGrid.prototype.defaults)
["axis", "itemHeight", "bufferBefore", "bufferAfter", "itemsPerRow", "header", "allowMultiSelect", "pageEl", "canDragFrom",
"canDragTo", "dropIndicatorType", "dropIsValid", "acceptDrop", "itemRenderer", "showCount"]
Object.getOwnPropertyNames(GS.Views.SongGrid.prototype.defaults)
["axis", "itemHeight", "bufferBefore", "bufferAfter", "itemsPerRow", "header", "allowMultiSelect", "pageEl", "canDragFrom",
"canDragTo", "dropIndicatorType", "dropIsValid", "acceptDrop", "itemRenderer", "columns"]
Information about the "columns" property and how it is enumerable.
Object.getOwnPropertyDescriptor(GS.Views.SongGrid.prototype.defaults, 'columns')
{
configurable: true
enumerable: true
value: Array[6]
writable: true
}
Object.constructor.hasOwnProperty.call(GS.Views.SongGrid.prototype.defaults,
'columns')
true
Object.constructor.propertyIsEnumerable.call(GS.Views.SongGrid.prototype.defaults,
'columns')
true
The issue is that "showCount" is being returned at the end of keys()
instead of "columns". You'll notice that "showCount" is not enumerable and
not on the object:
Object.constructor.propertyIsEnumerable.call(GS.Views.SongGrid.prototype.defaults,
'showCount')
false
Object.constructor.hasOwnProperty.call(GS.Views.SongGrid.prototype.defaults,
'showCount')
false
Object.getOwnPropertyDescriptor(GS.Views.SongGrid.prototype.defaults,
'showCount')
undefined
If I modify the object at all, for instance:
delete GS.Views.SongGrid.prototype.defaults.axis
true
keys() will now return the correct array (including columns):
Object.keys(GS.Views.SongGrid.prototype.defaults)
["itemHeight", "bufferBefore", "bufferAfter", "itemsPerRow", "header", "allowMultiSelect", "pageEl", "canDragFrom", "canDragTo",
"dropIndicatorType", "dropIsValid", "acceptDrop", "itemRenderer", "columns"]
We define GS.Views.SongGrid to be:
http://cl.ly/image/3X2k3P1k3V0q
GS.Views.SongGridTall contains the showCount property in it's defaults a
few lines later in the file (next defined grid object in file):
http://cl.ly/image/3t3s3a1F1Q2f
Let me know if you need any more information. I have a heap snapshot if
that will help.
Thanks,
James Hartig
Software Engineer @ Grooveshark.com
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev