JSBool JS_StringToValue()
Description
This function stores a string return value in a jsval structure. It allocates a new JavaScript string object.
Arguments
JSContext *cx, char *bytes, size_t sz, jsval *vp
- The
cxargument is the opaqueJSContextpointer that passes to the JavaScript function. - The
bytesargument is the string to be stored in thejsvalstructure. The string data is copied, so the caller should free the string when it is not needed. If the string size is not specified (see theszargument), the string must be null-terminated. - The
szargument is the size of the string, in bytes. Ifszis 0, the length of the null-terminated string is computed automatically. - The
vpargument is a pointer to thejsvalstructure into which the contents of the string should be copied.
Returns
A Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.