2011-02-03 05:06:21 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2010-06-10 10:48:59 -07:00
|
|
|
* vim: set ts=8 sw=4 et tw=99:
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef jsdbgapi_h___
|
|
|
|
#define jsdbgapi_h___
|
|
|
|
/*
|
|
|
|
* JS debugger API.
|
|
|
|
*/
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "jsprvtd.h"
|
|
|
|
|
|
|
|
JS_BEGIN_EXTERN_C
|
|
|
|
|
2011-02-03 05:06:21 -08:00
|
|
|
extern JS_PUBLIC_API(JSCrossCompartmentCall *)
|
|
|
|
JS_EnterCrossCompartmentCallScript(JSContext *cx, JSScript *target);
|
|
|
|
|
2011-07-27 12:33:33 -07:00
|
|
|
extern JS_PUBLIC_API(JSCrossCompartmentCall *)
|
|
|
|
JS_EnterCrossCompartmentCallStackFrame(JSContext *cx, JSStackFrame *target);
|
|
|
|
|
2011-02-03 05:06:21 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
JS_END_EXTERN_C
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class JS_PUBLIC_API(AutoEnterScriptCompartment)
|
|
|
|
{
|
2011-07-27 12:33:33 -07:00
|
|
|
protected:
|
2011-02-03 05:06:21 -08:00
|
|
|
JSCrossCompartmentCall *call;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AutoEnterScriptCompartment() : call(NULL) {}
|
|
|
|
|
|
|
|
bool enter(JSContext *cx, JSScript *target);
|
|
|
|
|
|
|
|
bool entered() const { return call != NULL; }
|
|
|
|
|
|
|
|
~AutoEnterScriptCompartment() {
|
|
|
|
if (call && call != reinterpret_cast<JSCrossCompartmentCall*>(1))
|
|
|
|
JS_LeaveCrossCompartmentCall(call);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-07-27 12:33:33 -07:00
|
|
|
class JS_PUBLIC_API(AutoEnterFrameCompartment) : public AutoEnterScriptCompartment
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool enter(JSContext *cx, JSStackFrame *target);
|
|
|
|
};
|
|
|
|
|
2011-02-03 05:06:21 -08:00
|
|
|
} /* namespace JS */
|
|
|
|
|
2011-10-04 07:06:54 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
JS_FRIEND_API(void) js_DumpValue(const js::Value &val);
|
|
|
|
JS_FRIEND_API(void) js_DumpId(jsid id);
|
|
|
|
JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NULL);
|
|
|
|
#endif
|
2012-04-13 13:45:01 -07:00
|
|
|
JS_FRIEND_API(void) js_DumpBacktrace(JSContext *cx);
|
2011-10-04 07:06:54 -07:00
|
|
|
|
2011-02-03 05:06:21 -08:00
|
|
|
JS_BEGIN_EXTERN_C
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSString *)
|
2012-02-28 15:11:11 -08:00
|
|
|
JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsigned indent);
|
2011-02-03 05:06:21 -08:00
|
|
|
|
2010-10-30 09:13:02 -07:00
|
|
|
/*
|
|
|
|
* Currently, we only support runtime-wide debugging. In the future, we should
|
|
|
|
* be able to support compartment-wide debugging.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetRuntimeDebugMode(JSRuntime *rt, JSBool debug);
|
|
|
|
|
2010-08-05 17:15:49 -07:00
|
|
|
/*
|
|
|
|
* Debug mode is a compartment-wide mode that enables a debugger to attach
|
|
|
|
* to and interact with running methodjit-ed frames. In particular, it causes
|
|
|
|
* every function to be compiled as if an eval was present (so eval-in-frame)
|
|
|
|
* can work, and it ensures that functions can be re-JITed for other debug
|
|
|
|
* features. In general, it is not safe to interact with frames that were live
|
|
|
|
* before debug mode was enabled. For this reason, it is also not safe to
|
|
|
|
* enable debug mode while frames are live.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Get current state of debugging mode. */
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_GetDebugMode(JSContext *cx);
|
|
|
|
|
2012-05-14 16:46:51 -07:00
|
|
|
/*
|
|
|
|
* Turn on/off debugging mode for all compartments. This returns false if any code
|
|
|
|
* from any of the runtime's compartments is running or on the stack.
|
|
|
|
*/
|
|
|
|
JS_FRIEND_API(JSBool)
|
|
|
|
JS_SetDebugModeForAllCompartments(JSContext *cx, JSBool debug);
|
|
|
|
|
2011-01-20 22:10:54 -08:00
|
|
|
/*
|
2011-05-20 15:08:23 -07:00
|
|
|
* Turn on/off debugging mode for a single compartment. This should only be
|
|
|
|
* used when no code from this compartment is running or on the stack in any
|
|
|
|
* thread.
|
2011-01-20 22:10:54 -08:00
|
|
|
*/
|
|
|
|
JS_FRIEND_API(JSBool)
|
|
|
|
JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, JSBool debug);
|
2010-08-05 17:15:49 -07:00
|
|
|
|
2011-01-20 22:10:54 -08:00
|
|
|
/*
|
|
|
|
* Turn on/off debugging mode for a context's compartment.
|
|
|
|
*/
|
|
|
|
JS_FRIEND_API(JSBool)
|
2010-08-05 17:15:49 -07:00
|
|
|
JS_SetDebugMode(JSContext *cx, JSBool debug);
|
|
|
|
|
2010-11-16 15:18:35 -08:00
|
|
|
/* Turn on single step mode. */
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetSingleStepMode(JSContext *cx, JSScript *script, JSBool singleStep);
|
|
|
|
|
2010-04-30 17:34:54 -07:00
|
|
|
/* The closure argument will be marked. */
|
2007-03-22 10:30:00 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
|
2010-04-30 17:34:54 -07:00
|
|
|
JSTrapHandler handler, jsval closure);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
|
2010-04-30 17:34:54 -07:00
|
|
|
JSTrapHandler *handlerp, jsval *closurep);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_ClearScriptTraps(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
2011-06-28 14:06:34 -07:00
|
|
|
JS_ClearAllTrapsForCompartment(JSContext *cx);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-04-30 17:34:54 -07:00
|
|
|
JS_SetInterrupt(JSRuntime *rt, JSInterruptHook handler, void *closure);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-04-30 17:34:54 -07:00
|
|
|
JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *handlerp, void **closurep);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-07-14 23:19:36 -07:00
|
|
|
JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsid id,
|
2010-08-19 18:02:17 -07:00
|
|
|
JSWatchPointHandler handler, JSObject *closure);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-07-14 23:19:36 -07:00
|
|
|
JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsid id,
|
2010-08-19 18:02:17 -07:00
|
|
|
JSWatchPointHandler *handlerp, JSObject **closurep);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_ClearAllWatchPoints(JSContext *cx);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
2012-02-28 15:11:11 -08:00
|
|
|
extern JS_PUBLIC_API(unsigned)
|
2007-03-22 10:30:00 -07:00
|
|
|
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(jsbytecode *)
|
2012-02-28 15:11:11 -08:00
|
|
|
JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-10-15 15:21:51 -07:00
|
|
|
extern JS_PUBLIC_API(jsbytecode *)
|
|
|
|
JS_EndPC(JSContext *cx, JSScript *script);
|
|
|
|
|
2011-03-03 10:11:54 -08:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_GetLinePCs(JSContext *cx, JSScript *script,
|
2012-02-28 15:11:11 -08:00
|
|
|
unsigned startLine, unsigned maxLines,
|
|
|
|
unsigned* count, unsigned** lines, jsbytecode*** pcs);
|
2011-03-03 10:11:54 -08:00
|
|
|
|
2012-02-28 15:11:11 -08:00
|
|
|
extern JS_PUBLIC_API(unsigned)
|
2010-07-14 23:19:36 -07:00
|
|
|
JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* N.B. The mark is in the context temp pool and thus the caller must take care
|
|
|
|
* to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other
|
|
|
|
* call that may use the temp pool.
|
|
|
|
*/
|
2012-01-11 00:23:05 -08:00
|
|
|
extern JS_PUBLIC_API(uintptr_t *)
|
2010-07-14 23:19:36 -07:00
|
|
|
JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSAtom *)
|
2012-01-11 00:23:05 -08:00
|
|
|
JS_LocalNameToAtom(uintptr_t w);
|
2010-07-14 23:19:36 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSString *)
|
|
|
|
JS_AtomKey(JSAtom *atom);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
extern JS_PUBLIC_API(JSScript *)
|
|
|
|
JS_GetFunctionScript(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSNative)
|
|
|
|
JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSPrincipals *)
|
2012-02-13 05:10:04 -08:00
|
|
|
JS_GetScriptPrincipals(JSScript *script);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-27 17:42:53 -07:00
|
|
|
extern JS_PUBLIC_API(JSPrincipals *)
|
2012-02-13 05:10:04 -08:00
|
|
|
JS_GetScriptOriginPrincipals(JSScript *script);
|
2011-06-27 17:42:53 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/*
|
|
|
|
* Stack Frame Iterator
|
|
|
|
*
|
|
|
|
* Used to iterate through the JS stack frames to extract
|
|
|
|
* information from the frames.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSStackFrame *)
|
|
|
|
JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSScript *)
|
|
|
|
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(jsbytecode *)
|
|
|
|
JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void *)
|
|
|
|
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2010-10-12 11:50:03 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSFunction *)
|
|
|
|
JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2011-12-07 13:41:27 -08:00
|
|
|
JS_PUBLIC_API(JSFunction *)
|
|
|
|
JS_GetScriptFunction(JSContext *cx, JSScript *script);
|
|
|
|
|
2011-11-28 07:43:31 -08:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* XXXrginda Initially published with typo */
|
|
|
|
#define JS_IsContructorFrame JS_IsConstructorFrame
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2011-05-11 09:11:40 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_IsGlobalFrame(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
extern JS_PUBLIC_API(jsval)
|
|
|
|
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval);
|
|
|
|
|
|
|
|
/**
|
2010-08-01 09:58:03 -07:00
|
|
|
* 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.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp);
|
|
|
|
|
|
|
|
/************************************************************************/
|
2011-12-20 17:42:45 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is almost JS_GetClass(obj)->name except that certain debug-only
|
|
|
|
* proxies are made transparent. In particular, this function turns the class
|
|
|
|
* of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObject)
|
|
|
|
* from "Proxy" to "Call", "Block", "With" etc.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(const char *)
|
|
|
|
JS_GetDebugClassName(JSObject *obj);
|
|
|
|
|
|
|
|
/************************************************************************/
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(const char *)
|
|
|
|
JS_GetScriptFilename(JSContext *cx, JSScript *script);
|
|
|
|
|
2011-07-29 08:44:45 -07:00
|
|
|
extern JS_PUBLIC_API(const jschar *)
|
|
|
|
JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
|
|
|
|
|
2012-02-28 15:11:11 -08:00
|
|
|
extern JS_PUBLIC_API(unsigned)
|
2007-03-22 10:30:00 -07:00
|
|
|
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
|
|
|
|
|
2012-02-28 15:11:11 -08:00
|
|
|
extern JS_PUBLIC_API(unsigned)
|
2007-03-22 10:30:00 -07:00
|
|
|
JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSVersion)
|
|
|
|
JS_GetScriptVersion(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook setters for script creation and destruction, see jsprvtd.h for the
|
|
|
|
* typedefs. These macros provide binary compatibility and newer, shorter
|
|
|
|
* synonyms.
|
|
|
|
*/
|
|
|
|
#define JS_SetNewScriptHook JS_SetNewScriptHookProc
|
|
|
|
#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
|
|
|
|
void *callerdata);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
|
2012-02-28 15:11:11 -08:00
|
|
|
const jschar *chars, unsigned length,
|
|
|
|
const char *filename, unsigned lineno,
|
2007-03-22 10:30:00 -07:00
|
|
|
jsval *rval);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
|
2012-02-28 15:11:11 -08:00
|
|
|
const char *bytes, unsigned length,
|
|
|
|
const char *filename, unsigned lineno,
|
2007-03-22 10:30:00 -07:00
|
|
|
jsval *rval);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
typedef struct JSPropertyDesc {
|
2010-07-14 23:19:36 -07:00
|
|
|
jsval id; /* primary id, atomized string, or int */
|
2007-03-22 10:30:00 -07:00
|
|
|
jsval value; /* property value */
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-08 19:54:10 -08:00
|
|
|
uint8_t flags; /* flags, see below */
|
|
|
|
uint8_t spare; /* unused */
|
2007-03-22 10:30:00 -07:00
|
|
|
jsval alias; /* alias id if JSPD_ALIAS flag */
|
|
|
|
} JSPropertyDesc;
|
|
|
|
|
|
|
|
#define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
|
|
|
|
#define JSPD_READONLY 0x02 /* assignment is error */
|
|
|
|
#define JSPD_PERMANENT 0x04 /* property cannot be deleted */
|
|
|
|
#define JSPD_ALIAS 0x08 /* property has an alias id */
|
|
|
|
#define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */
|
|
|
|
/* value is exception */
|
|
|
|
#define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */
|
|
|
|
/* throwing an exception */
|
|
|
|
|
|
|
|
typedef struct JSPropertyDescArray {
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-08 19:54:10 -08:00
|
|
|
uint32_t length; /* number of elements in array */
|
2007-03-22 10:30:00 -07:00
|
|
|
JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
|
|
|
|
} JSPropertyDescArray;
|
|
|
|
|
2010-08-29 11:57:08 -07:00
|
|
|
typedef struct JSScopeProperty JSScopeProperty;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-04-30 17:34:54 -07:00
|
|
|
JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2010-04-30 17:34:54 -07:00
|
|
|
JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetObjectTotalSize(JSContext *cx, JSObject *obj);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(size_t)
|
|
|
|
JS_GetScriptTotalSize(JSContext *cx, JSScript *script);
|
|
|
|
|
2012-08-23 21:34:27 -07:00
|
|
|
/*
|
|
|
|
* Return true if obj is a "system" object, that is, one created by
|
|
|
|
* JS_NewSystemObject with the system flag set and not JS_NewObject.
|
|
|
|
*
|
|
|
|
* What "system" means is up to the API client.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_IsSystemObject(JSContext *cx, JSObject *obj);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark an object as being a system object. This should be called immediately
|
|
|
|
* after allocating the object. A system object is an object for which
|
|
|
|
* JS_IsSystemObject returns true.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_MakeSystemObject(JSContext *cx, JSObject *obj);
|
|
|
|
|
2007-06-14 23:44:18 -07:00
|
|
|
/************************************************************************/
|
|
|
|
|
2010-09-13 09:38:22 -07:00
|
|
|
extern JS_FRIEND_API(void)
|
|
|
|
js_RevertVersion(JSContext *cx);
|
|
|
|
|
2009-11-13 09:04:23 -08:00
|
|
|
extern JS_PUBLIC_API(const JSDebugHooks *)
|
2007-06-14 23:44:18 -07:00
|
|
|
JS_GetGlobalDebugHooks(JSRuntime *rt);
|
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
/**
|
|
|
|
* Start any profilers that are available and have been configured on for this
|
|
|
|
* platform. This is NOT thread safe.
|
|
|
|
*
|
|
|
|
* The profileName is used by some profilers to describe the current profiling
|
|
|
|
* run. It may be used for part of the filename of the output, but the
|
|
|
|
* specifics depend on the profiler. Many profilers will ignore it. Passing in
|
|
|
|
* NULL is legal; some profilers may use it to output to stdout or similar.
|
|
|
|
*
|
|
|
|
* Returns true if no profilers fail to start.
|
|
|
|
*/
|
2008-03-24 01:06:39 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2011-07-26 15:56:09 -07:00
|
|
|
JS_StartProfiling(const char *profileName);
|
2008-03-24 01:06:39 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
/**
|
|
|
|
* Stop any profilers that were previously started with JS_StartProfiling.
|
|
|
|
* Returns true if no profilers fail to stop.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_StopProfiling(const char *profileName);
|
2008-03-24 01:06:39 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
/**
|
|
|
|
* Write the current profile data to the given file, if applicable to whatever
|
|
|
|
* profiler is being used.
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_DumpProfile(const char *outfile, const char *profileName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pause currently active profilers (only supported by some profilers). Returns
|
|
|
|
* whether any profilers failed to pause. (Profilers that do not support
|
|
|
|
* pause/resume do not count.)
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_PauseProfilers(const char *profileName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resume suspended profilers
|
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API(JSBool)
|
|
|
|
JS_ResumeProfilers(const char *profileName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add various profiling-related functions as properties of the given object.
|
|
|
|
*/
|
2008-03-24 01:06:39 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2011-01-14 17:58:40 -08:00
|
|
|
JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj);
|
2008-01-16 12:42:50 -08:00
|
|
|
|
2011-07-27 16:03:34 -07:00
|
|
|
/* Defined in vm/Debugger.cpp. */
|
2011-04-14 13:41:31 -07:00
|
|
|
extern JS_PUBLIC_API(JSBool)
|
2011-07-05 05:48:26 -07:00
|
|
|
JS_DefineDebuggerObject(JSContext *cx, JSObject *obj);
|
2011-04-14 13:41:31 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
/**
|
|
|
|
* The profiling API calls are not able to report errors, so they use a
|
|
|
|
* thread-unsafe global memory buffer to hold the last error encountered. This
|
|
|
|
* should only be called after something returns false.
|
|
|
|
*/
|
|
|
|
JS_PUBLIC_API(const char *)
|
|
|
|
JS_UnsafeGetLastProfilingError();
|
|
|
|
|
2008-07-08 15:58:08 -07:00
|
|
|
#ifdef MOZ_CALLGRIND
|
|
|
|
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
2011-07-26 15:56:09 -07:00
|
|
|
js_StopCallgrind();
|
2008-07-08 15:58:08 -07:00
|
|
|
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
2011-07-26 15:56:09 -07:00
|
|
|
js_StartCallgrind();
|
2008-07-08 15:58:08 -07:00
|
|
|
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
2011-07-26 15:56:09 -07:00
|
|
|
js_DumpCallgrind(const char *outfile);
|
2008-07-08 15:58:08 -07:00
|
|
|
|
|
|
|
#endif /* MOZ_CALLGRIND */
|
|
|
|
|
2008-07-29 15:19:26 -07:00
|
|
|
#ifdef MOZ_VTUNE
|
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
extern JS_FRIEND_API(bool)
|
|
|
|
js_StartVtune(const char *profileName);
|
2008-07-29 15:19:26 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
extern JS_FRIEND_API(bool)
|
|
|
|
js_StopVtune();
|
2008-07-29 15:19:26 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
extern JS_FRIEND_API(bool)
|
|
|
|
js_PauseVtune();
|
2008-07-29 15:19:26 -07:00
|
|
|
|
2011-07-26 15:56:09 -07:00
|
|
|
extern JS_FRIEND_API(bool)
|
|
|
|
js_ResumeVtune();
|
2008-07-29 15:19:26 -07:00
|
|
|
|
|
|
|
#endif /* MOZ_VTUNE */
|
|
|
|
|
2012-04-24 10:12:32 -07:00
|
|
|
#ifdef __linux__
|
|
|
|
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
|
|
|
js_StartPerf();
|
|
|
|
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
|
|
|
js_StopPerf();
|
|
|
|
|
|
|
|
#endif /* __linux__ */
|
|
|
|
|
2011-05-10 11:26:39 -07:00
|
|
|
extern JS_PUBLIC_API(void)
|
2011-07-26 15:56:09 -07:00
|
|
|
JS_DumpBytecode(JSContext *cx, JSScript *script);
|
2011-05-10 11:26:39 -07:00
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
2011-07-26 15:56:09 -07:00
|
|
|
JS_DumpCompartmentBytecode(JSContext *cx);
|
2011-05-10 11:26:39 -07:00
|
|
|
|
2011-11-10 12:34:24 -08:00
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_DumpPCCounts(JSContext *cx, JSScript *script);
|
|
|
|
|
|
|
|
extern JS_PUBLIC_API(void)
|
|
|
|
JS_DumpCompartmentPCCounts(JSContext *cx);
|
|
|
|
|
2011-10-04 07:06:54 -07:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_UnwrapObject(JSObject *obj);
|
|
|
|
|
2012-05-01 08:17:32 -07:00
|
|
|
extern JS_PUBLIC_API(JSObject *)
|
|
|
|
JS_UnwrapObjectAndInnerize(JSObject *obj);
|
|
|
|
|
2012-03-06 15:33:12 -08:00
|
|
|
/* Call the context debug handler on the topmost scripted frame. */
|
|
|
|
extern JS_FRIEND_API(JSBool)
|
|
|
|
js_CallContextDebugHandler(JSContext *cx);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
JS_END_EXTERN_C
|
|
|
|
|
|
|
|
#endif /* jsdbgapi_h___ */
|