Specifications

Chapter 21258
char *JS_ObjectType()
Description
Given an object reference, JS_ObjectType() returns the class name of the object. For example, if
the object is a DOM object, the function would return "
Document". If the object is a node in the
document, the function would return "
Element". For an array object, the function would
return "
Array".
Note: Do not modify the returned buffer pointer or you might corrupt the data structures of the JavaScript
interpreter.
Arguments
JSObject *obj
Typically, this argument is passed in and converted using JS_ValueToObject().
Returns
A pointer to a null-terminated string. The caller should not free this string when it finishes.
JSObject *JS_NewArrayObject()
Description
Creates a new object that contains an array of jsvals.
Arguments
JSContext *cx, unsigned int length, jsval *v
cx is the opaque JSContext pointer that passed to the JavaScript function.
length is the number of elements that the array can hold.
v is an optional pointer to the jsvals to be stored in the array. If the return value is not null,
v is an array containing length elements. If the return value is null, the initial content of the
array object is undefined (and can be set using
JS_SetElement()).
Returns
A pointer to a new array object, or null upon failure.
long JS_GetArrayLength()
Description
Given a pointer to an array object, gets the number of elements in the array.
Arguments
JSContext *cx, JSObject *obj
cx is the opaque JSContext pointer that passed to the JavaScript function.
obj is a pointer to an array object.
Returns
The number of elements in the array or -1 upon failure.