The default bug view has changed. See this FAQ.

Need JSAPI to enumerate non-enumerable properties

NEW
Unassigned

Status

()

Core
JavaScript Engine
6 years ago
3 years ago

People

(Reporter: robarnold, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
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.

Comment 1

6 years ago
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?
(Reporter)

Comment 4

6 years ago
(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?

Comment 7

6 years ago
Waldo, feel free to steal 638347, in particular if you have a better idea for naming then JS_Enumerate2.
(Assignee)

Updated

3 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.