Classes |
| struct | JSPropertyDesc |
| struct | JSPropertyDescArray |
Defines |
| #define | JS_IsContructorFrame JS_IsConstructorFrame |
| #define | JS_SetNewScriptHook JS_SetNewScriptHookProc |
| #define | JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc |
| #define | JSPD_ENUMERATE 0x01 |
| #define | JSPD_READONLY 0x02 |
| #define | JSPD_PERMANENT 0x04 |
| #define | JSPD_ALIAS 0x08 |
| #define | JSPD_ARGUMENT 0x10 |
| #define | JSPD_VARIABLE 0x20 |
| #define | JSPD_EXCEPTION 0x40 |
| #define | JSPD_ERROR 0x80 |
| #define | JSFILENAME_NULL 0xffffffff |
| #define | JSFILENAME_SYSTEM 0x00000001 |
| #define | JSFILENAME_PROTECTED 0x00000002 |
Typedefs |
| typedef struct JSPropertyDesc | JSPropertyDesc |
| typedef struct JSPropertyDescArray | JSPropertyDescArray |
| typedef struct JSScopeProperty | JSScopeProperty |
Functions |
| void | JS_SetRuntimeDebugMode (JSRuntime *rt, JSBool debug) |
| JSBool | JS_GetDebugMode (JSContext *cx) |
| JSBool | js_SetDebugMode (JSContext *cx, JSBool debug) |
| JSBool | JS_SetDebugMode (JSContext *cx, JSBool debug) |
| JSBool | js_SetSingleStepMode (JSContext *cx, JSScript *script, JSBool singleStep) |
| JSBool | JS_SetSingleStepMode (JSContext *cx, JSScript *script, JSBool singleStep) |
| jsbytecode * | js_UntrapScriptCode (JSContext *cx, JSScript *script) |
| JSBool | JS_SetTrap (JSContext *cx, JSScript *script, jsbytecode *pc, JSTrapHandler handler, jsval closure) |
| JSOp | JS_GetTrapOpcode (JSContext *cx, JSScript *script, jsbytecode *pc) |
| void | JS_ClearTrap (JSContext *cx, JSScript *script, jsbytecode *pc, JSTrapHandler *handlerp, jsval *closurep) |
| void | JS_ClearScriptTraps (JSContext *cx, JSScript *script) |
| void | JS_ClearAllTraps (JSContext *cx) |
| JSTrapStatus | JS_HandleTrap (JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval) |
| JSBool | JS_SetInterrupt (JSRuntime *rt, JSInterruptHook handler, void *closure) |
| JSBool | JS_ClearInterrupt (JSRuntime *rt, JSInterruptHook *handlerp, void **closurep) |
| JSBool | JS_SetWatchPoint (JSContext *cx, JSObject *obj, jsid id, JSWatchPointHandler handler, JSObject *closure) |
| JSBool | JS_ClearWatchPoint (JSContext *cx, JSObject *obj, jsid id, JSWatchPointHandler *handlerp, JSObject **closurep) |
| JSBool | JS_ClearWatchPointsForObject (JSContext *cx, JSObject *obj) |
| JSBool | JS_ClearAllWatchPoints (JSContext *cx) |
| uintN | JS_PCToLineNumber (JSContext *cx, JSScript *script, jsbytecode *pc) |
| jsbytecode * | JS_LineNumberToPC (JSContext *cx, JSScript *script, uintN lineno) |
| jsbytecode * | JS_EndPC (JSContext *cx, JSScript *script) |
| uintN | JS_GetFunctionArgumentCount (JSContext *cx, JSFunction *fun) |
| JSBool | JS_FunctionHasLocalNames (JSContext *cx, JSFunction *fun) |
| jsuword * | JS_GetFunctionLocalNameArray (JSContext *cx, JSFunction *fun, void **markp) |
| JSAtom * | JS_LocalNameToAtom (jsuword w) |
| JSString * | JS_AtomKey (JSAtom *atom) |
| void | JS_ReleaseFunctionLocalNameArray (JSContext *cx, void *mark) |
| JSScript * | JS_GetFunctionScript (JSContext *cx, JSFunction *fun) |
| JSNative | JS_GetFunctionNative (JSContext *cx, JSFunction *fun) |
| JSPrincipals * | JS_GetScriptPrincipals (JSContext *cx, JSScript *script) |
| JSStackFrame * | JS_FrameIterator (JSContext *cx, JSStackFrame **iteratorp) |
| JSScript * | JS_GetFrameScript (JSContext *cx, JSStackFrame *fp) |
| jsbytecode * | JS_GetFramePC (JSContext *cx, JSStackFrame *fp) |
| JSStackFrame * | JS_GetScriptedCaller (JSContext *cx, JSStackFrame *fp) |
| JSPrincipals * | js_StackFramePrincipals (JSContext *cx, JSStackFrame *fp) |
| JSPrincipals * | js_EvalFramePrincipals (JSContext *cx, JSObject *callee, JSStackFrame *caller) |
| void * | JS_GetFrameAnnotation (JSContext *cx, JSStackFrame *fp) |
| void | JS_SetFrameAnnotation (JSContext *cx, JSStackFrame *fp, void *annotation) |
| void * | JS_GetFramePrincipalArray (JSContext *cx, JSStackFrame *fp) |
| JSBool | JS_IsScriptFrame (JSContext *cx, JSStackFrame *fp) |
| JSObject * | JS_GetFrameObject (JSContext *cx, JSStackFrame *fp) |
| JSObject * | JS_GetFrameScopeChain (JSContext *cx, JSStackFrame *fp) |
| JSObject * | JS_GetFrameCallObject (JSContext *cx, JSStackFrame *fp) |
| JSBool | JS_GetFrameThis (JSContext *cx, JSStackFrame *fp, jsval *thisv) |
| JSFunction * | JS_GetFrameFunction (JSContext *cx, JSStackFrame *fp) |
| JSObject * | JS_GetFrameFunctionObject (JSContext *cx, JSStackFrame *fp) |
| JSBool | JS_IsConstructorFrame (JSContext *cx, JSStackFrame *fp) |
| JSBool | JS_IsDebuggerFrame (JSContext *cx, JSStackFrame *fp) |
| jsval | JS_GetFrameReturnValue (JSContext *cx, JSStackFrame *fp) |
| void | JS_SetFrameReturnValue (JSContext *cx, JSStackFrame *fp, jsval rval) |
| JSObject * | JS_GetFrameCalleeObject (JSContext *cx, JSStackFrame *fp) |
| | Return fp's callee function object (fp->callee) if it has one.
|
| JSBool | JS_GetValidFrameCalleeObject (JSContext *cx, JSStackFrame *fp, jsval *vp) |
| | Return fp's callee function object after running the deferred closure cloning "method read barrier".
|
| const char * | JS_GetScriptFilename (JSContext *cx, JSScript *script) |
| uintN | JS_GetScriptBaseLineNumber (JSContext *cx, JSScript *script) |
| uintN | JS_GetScriptLineExtent (JSContext *cx, JSScript *script) |
| JSVersion | JS_GetScriptVersion (JSContext *cx, JSScript *script) |
| void | JS_SetNewScriptHookProc (JSRuntime *rt, JSNewScriptHook hook, void *callerdata) |
| void | JS_SetDestroyScriptHookProc (JSRuntime *rt, JSDestroyScriptHook hook, void *callerdata) |
| JSBool | JS_EvaluateUCInStackFrame (JSContext *cx, JSStackFrame *fp, const jschar *chars, uintN length, const char *filename, uintN lineno, jsval *rval) |
| JSBool | JS_EvaluateInStackFrame (JSContext *cx, JSStackFrame *fp, const char *bytes, uintN length, const char *filename, uintN lineno, jsval *rval) |
| JSScopeProperty * | JS_PropertyIterator (JSObject *obj, JSScopeProperty **iteratorp) |
| JSBool | JS_GetPropertyDesc (JSContext *cx, JSObject *obj, JSScopeProperty *shape, JSPropertyDesc *pd) |
| JSBool | JS_GetPropertyDescArray (JSContext *cx, JSObject *obj, JSPropertyDescArray *pda) |
| void | JS_PutPropertyDescArray (JSContext *cx, JSPropertyDescArray *pda) |
| JSBool | JS_SetDebuggerHandler (JSRuntime *rt, JSDebuggerHandler hook, void *closure) |
| JSBool | JS_SetSourceHandler (JSRuntime *rt, JSSourceHandler handler, void *closure) |
| JSBool | JS_SetExecuteHook (JSRuntime *rt, JSInterpreterHook hook, void *closure) |
| JSBool | JS_SetCallHook (JSRuntime *rt, JSInterpreterHook hook, void *closure) |
| JSBool | JS_SetThrowHook (JSRuntime *rt, JSThrowHook hook, void *closure) |
| JSBool | JS_SetDebugErrorHook (JSRuntime *rt, JSDebugErrorHook hook, void *closure) |
| size_t | JS_GetObjectTotalSize (JSContext *cx, JSObject *obj) |
| size_t | JS_GetFunctionTotalSize (JSContext *cx, JSFunction *fun) |
| size_t | JS_GetScriptTotalSize (JSContext *cx, JSScript *script) |
| uint32 | JS_GetTopScriptFilenameFlags (JSContext *cx, JSStackFrame *fp) |
| uint32 | JS_GetScriptFilenameFlags (JSScript *script) |
| JSBool | JS_FlagScriptFilenamePrefix (JSRuntime *rt, const char *prefix, uint32 flags) |
| JSBool | JS_IsSystemObject (JSContext *cx, JSObject *obj) |
| JSBool | JS_MakeSystemObject (JSContext *cx, JSObject *obj) |
| JSObject * | JS_UnwrapObject (JSContext *cx, JSObject *obj) |
| void | js_RevertVersion (JSContext *cx) |
| const JSDebugHooks * | JS_GetGlobalDebugHooks (JSRuntime *rt) |
| JSDebugHooks * | JS_SetContextDebugHooks (JSContext *cx, const JSDebugHooks *hooks) |
| JSDebugHooks * | JS_ClearContextDebugHooks (JSContext *cx) |
| JSBool | JS_StartProfiling () |
| void | JS_StopProfiling () |
| JSBool | JS_DefineProfilingFunctions (JSContext *cx, JSObject *obj) |
Return fp's callee function object (fp->callee) if it has one.
Note that this API cannot fail. A null return means "no callee": fp is a global or eval-from-global frame, not a call frame.
This API began life as an infallible getter, but now it can return either:
1. An optimized closure that was compiled assuming the function could not escape and be called from sites the compiler could not see.
2. A "joined function object", an optimization whereby SpiderMonkey avoids creating fresh function objects for every evaluation of a function expression that is used only once by a consumer that either promises to clone later when asked for the value or that cannot leak the value.
Because Mozilla's Gecko embedding of SpiderMonkey (and no doubt other embeddings) calls this API in potentially performance-sensitive ways (e.g. in nsContentUtils::GetDocumentFromCaller), we are leaving this API alone. It may now return an unwrapped non-escaping optimized closure, or a joined function object. Such optimized objects may work well if called from the correct context, never mutated or compared for identity, etc.
However, if you really need to get the same callee object that JS code would see, which means undoing the optimizations, where an undo attempt can fail, then use JS_GetValidFrameCalleeObject.