Open Bug 643368 Opened 14 years ago Updated 2 years ago

Need JSAPI to enumerate non-enumerable properties

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: robarnold, Unassigned)

References

(Blocks 1 open bug)

Details

To implement v8::Object::Clone, I think we need to include the non-enumerable properties of an object. Currently there is no API to get us these. JS_NewPropertyIterator and JS_Enumerate claim to only show properties with the JSPROP_ENUMERATE bit.
I have a patch for that. Search for JS_Enumerate2 in the title.
(In reply to comment #0) > Currently there is no API to get us these. JS_NewPropertyIterator and > JS_Enumerate claim to only show properties with the JSPROP_ENUMERATE bit. Lies! Call JS_Enumerate with JSENUMERATE_INIT_ALL. One caveat: enumeration hooks don't uniformly implement all the correct stuff for this to work fully. Global objects in the browser are one case where things fall apart. There might be others, but that's the biggest instance I'm aware of. (...and not to say I'm opposed to JS_Enumerate2 or anything, just to say that it's not needed to serve the particular use case in this bug.)
(In reply to comment #2) > Lies! Call JS_Enumerate with JSENUMERATE_INIT_ALL. Could someone possibly add some docs for that then, by chance?
(In reply to comment #2) > (In reply to comment #0) > > Currently there is no API to get us these. JS_NewPropertyIterator and > > JS_Enumerate claim to only show properties with the JSPROP_ENUMERATE bit. > > Lies! Call JS_Enumerate with JSENUMERATE_INIT_ALL. I still do not see how this is exposed via the API. JS_Enumerate takes a JSContext* and a JSObject* but not a JSIterateOp.
Andreas is referring to bug 638347 in encouraging you to search for JS_Enumerate2. /be
(In reply to comment #4) > I still do not see how this is exposed via the API. Hum, you're right. Yes, we should fix that. (And are, it seems.) And what's this yolky-colored stuff on my face right now?
Waldo, feel free to steal 638347, in particular if you have a better idea for naming then JS_Enumerate2.
Assignee: general → nobody
Blocks: jsapi
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.