Retrieves the object for a specified function.
JSObject * JS_GetFunctionObject(JSFunction *fun);
| || ||Pointer to a JS function. |
Function object for a specified function pointer,
fun must be either a function implemented by a
JSFastNative or the result of a call to
JS_CompileUCFunctionForPrincipals. In other cases, the object returned by
JS_GetFunctionObject is not necessarily safe to call and should not be exposed to script.
JSObject is what is exposed to scripts and has properties and can be stored in variables; and the corresponding
JSFunction contains the code of a function. For certain functions, the two have a strictly one-to-one relationship, and for those functions it is safe to call
JS_GetFunctionObject to move from the
JSFunction to the
JSObjects may share the same
JSFunction. In these cases, this function should not be called. Calling the
JSObject returned by it could cause a crash or worse.
JS_GetFunctionObject always returns a pointer to an object.