Re: C++ API getOwnPropertyNames?
Miles Thornton <[email protected]> Wed, 24 Aug 2016 06:58:59 +0000
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <BB8166180148134BB65AE0E8ED14E89E49BE0BAB@EURXMBS04.global.arup.com> |
I'm still using 1.8.5 too so I can answer this...
I think you want to use JS_Enumerate(). Something like:
JSIdArray *IdArray;
jsval val;
JSString *str;
IdArray = JS_Enumerate(cx, obj);
for (i=0; i<IdArray->length; i++)
{
JS_IdToValue(cx, IdArray->vector[i], &val);
str = JS_ValueToString(cx, val);
// Then use JS_GetStringLength and JS_EncodeStringToBuffer to get property name as C char *.
// You can then use JS_GetProperty
}
Miles
Miles Thornton
Advanced Technology + Research
Arup
The Arup Campus Blythe Valley Business Park Solihull W. Midlands B90 8AE
d: +44 121 213 3308
www.arup.com <http://www.arup.com/>
____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses