Get an array of the enumerable properties of a given object.
JSIdArray * JS_Enumerate(JSContext *cx, JS::HandleObject obj);
||The context in which to enumerate object properties. Requires request. In a
||The object whose properties are to be enumerated.|
JS_Enumerate gets the ids of all own properties of the specified object,
obj, that have the
in loop, which converts all property ids to strings and also enumerates inherited properties.
JS_Enumerate returns a pointer to the first element of an array of property IDs. The application must free this array using
JS_DestroyIdArray. On error or exception,
JSIdArrayare subject to garbage collection. As long as
JSIdArray, the script could delete properties from
obj. The property ids would then become unreachable and could be collected. Therefore a program that loops over the property ids must either root them all, ensure that the properties are not deleted (in a multithreaded program this requires even greater care), or ensure that garbage collection does not occur.