Bug 898263 (part 4) - Move |JSTrapStatus| and related function typedefs out of jsprvtd.h. r=jorendorff.

--HG--
extra : rebase_source : 68c1d3aaaa40763e073ee791c1d0078c5d5cf87e
This commit is contained in:
Nicholas Nethercote 2013-08-08 21:30:15 -07:00
parent c1774030e8
commit 1399d1419a
8 changed files with 77 additions and 77 deletions

View File

@ -43,7 +43,7 @@
#include "xpcpublic.h"
#include "jsdbgapi.h" // for JS_ClearWatchPointsForObject
#include "jsdbgapi.h"
#include "jswrapper.h"
#include "nsIArray.h"
#include "nsIObjectInputStream.h"
@ -57,7 +57,6 @@
#include "mozilla/dom/ImageDataBinding.h"
#include "nsJSPrincipals.h"
#include "jsdbgapi.h"
#ifdef XP_MACOSX
// AssertMacros.h defines 'check' and conflicts with AccessCheck.h

View File

@ -929,6 +929,22 @@ JS_DumpCompartmentPCCounts(JSContext *cx)
#endif
}
JS_FRIEND_API(bool)
js::CanCallContextDebugHandler(JSContext *cx)
{
return !!cx->runtime()->debugHooks.debuggerHandler;
}
static JSTrapStatus
CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *rval)
{
if (!cx->runtime()->debugHooks.debuggerHandler)
return JSTRAP_RETURN;
return cx->runtime()->debugHooks.debuggerHandler(cx, script, bc, rval,
cx->runtime()->debugHooks.debuggerHandlerData);
}
JS_FRIEND_API(bool)
js_CallContextDebugHandler(JSContext *cx)
{
@ -937,7 +953,7 @@ js_CallContextDebugHandler(JSContext *cx)
RootedValue rval(cx);
RootedScript script(cx, iter.script());
switch (js::CallContextDebugHandler(cx, script, iter.pc(), rval.address())) {
switch (CallContextDebugHandler(cx, script, iter.pc(), rval.address())) {
case JSTRAP_ERROR:
JS_ClearPendingException(cx);
return false;

View File

@ -6,6 +6,7 @@
#ifndef jsdbgapi_h
#define jsdbgapi_h
/*
* JS debugger API.
*/
@ -49,6 +50,55 @@ JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NUL
JS_FRIEND_API(void)
js_DumpBacktrace(JSContext *cx);
typedef enum JSTrapStatus {
JSTRAP_ERROR,
JSTRAP_CONTINUE,
JSTRAP_RETURN,
JSTRAP_THROW,
JSTRAP_LIMIT
} JSTrapStatus;
typedef JSTrapStatus
(* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
jsval closure);
typedef JSTrapStatus
(* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef JSTrapStatus
(* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef JSTrapStatus
(* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef bool
(* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, jsval old,
jsval *newp, void *closure);
/* called just after script creation */
typedef void
(* JSNewScriptHook)(JSContext *cx,
const char *filename, /* URL of script */
unsigned lineno, /* first line */
JSScript *script,
JSFunction *fun,
void *callerdata);
/* called just before script destruction */
typedef void
(* JSDestroyScriptHook)(JSFreeOp *fop,
JSScript *script,
void *callerdata);
typedef void
(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str,
size_t length, void **listenerTSData, void *closure);
extern JS_PUBLIC_API(JSCompartment *)
JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target);
@ -230,9 +280,8 @@ JS_GetScriptIsSelfHosted(JSScript *script);
/************************************************************************/
/*
* Hook setters for script creation and destruction, see jsprvtd.h for the
* typedefs. These macros provide binary compatibility and newer, shorter
* synonyms.
* Hook setters for script creation and destruction. These macros provide
* binary compatibility and newer, shorter synonyms.
*/
#define JS_SetNewScriptHook JS_SetNewScriptHookProc
#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
@ -452,6 +501,11 @@ JS_DumpPCCounts(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(void)
JS_DumpCompartmentPCCounts(JSContext *cx);
namespace js {
extern JS_FRIEND_API(bool)
CanCallContextDebugHandler(JSContext *cx);
}
/* Call the context debug handler on the topmost scripted frame. */
extern JS_FRIEND_API(bool)
js_CallContextDebugHandler(JSContext *cx);

View File

@ -762,22 +762,6 @@ js::GetContextStructuredCloneCallbacks(JSContext *cx)
return cx->runtime()->structuredCloneCallbacks;
}
JS_FRIEND_API(bool)
js::CanCallContextDebugHandler(JSContext *cx)
{
return !!cx->runtime()->debugHooks.debuggerHandler;
}
JS_FRIEND_API(JSTrapStatus)
js::CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *rval)
{
if (!cx->runtime()->debugHooks.debuggerHandler)
return JSTRAP_RETURN;
return cx->runtime()->debugHooks.debuggerHandler(cx, script, bc, rval,
cx->runtime()->debugHooks.debuggerHandlerData);
}
#ifdef JS_THREADSAFE
JS_FRIEND_API(bool)
js::ContextHasOutstandingRequests(const JSContext *cx)

View File

@ -778,12 +778,6 @@ SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg);
extern JS_FRIEND_API(const JSStructuredCloneCallbacks *)
GetContextStructuredCloneCallbacks(JSContext *cx);
extern JS_FRIEND_API(bool)
CanCallContextDebugHandler(JSContext *cx);
extern JS_FRIEND_API(JSTrapStatus)
CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *rval);
extern JS_FRIEND_API(bool)
IsContextRunningJS(JSContext *cx);

View File

@ -66,54 +66,6 @@ struct IdValuePair
} /* namespace js */
/* "Friend" types used by jscntxt.h and jsdbgapi.h. */
typedef enum JSTrapStatus {
JSTRAP_ERROR,
JSTRAP_CONTINUE,
JSTRAP_RETURN,
JSTRAP_THROW,
JSTRAP_LIMIT
} JSTrapStatus;
typedef JSTrapStatus
(* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
jsval closure);
typedef JSTrapStatus
(* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef JSTrapStatus
(* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef JSTrapStatus
(* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
void *closure);
typedef bool
(* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, jsval old,
jsval *newp, void *closure);
/* called just after script creation */
typedef void
(* JSNewScriptHook)(JSContext *cx,
const char *filename, /* URL of script */
unsigned lineno, /* first line */
JSScript *script,
JSFunction *fun,
void *callerdata);
/* called just before script destruction */
typedef void
(* JSDestroyScriptHook)(JSFreeOp *fop,
JSScript *script,
void *callerdata);
typedef void
(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str,
size_t length, void **listenerTSData, void *closure);
/* js::ObjectOps function pointer typedefs. */
/*

View File

@ -9,6 +9,7 @@
#include "jsalloc.h"
#include "jsapi.h"
#include "jsdbgapi.h"
#include "jsfriendapi.h"
#include "jsprvtd.h"

View File

@ -1263,7 +1263,7 @@ struct JSRuntime : public JS::shadow::Runtime,
JS_SourceHook sourceHook;
/* Per runtime debug hooks -- see jsprvtd.h and jsdbgapi.h. */
/* Per runtime debug hooks -- see jsdbgapi.h. */
JSDebugHooks debugHooks;
/* If true, new compartments are initially in debug mode. */