Bug 784739 - Switch from NULL to nullptr in js/jsd/; r=ehsan
This commit is contained in:
10
js/jsd/jsd.h
10
js/jsd/jsd.h
@@ -746,11 +746,11 @@ extern JSDStaticLock* _jsd_global_lock;
|
|||||||
|
|
||||||
/* locks for the subsystems of a given context */
|
/* locks for the subsystems of a given context */
|
||||||
#define JSD_INIT_LOCKS(jsdc) \
|
#define JSD_INIT_LOCKS(jsdc) \
|
||||||
( (NULL != (jsdc->scriptsLock = jsd_CreateLock())) && \
|
( (nullptr != (jsdc->scriptsLock = jsd_CreateLock())) && \
|
||||||
(NULL != (jsdc->sourceTextLock = jsd_CreateLock())) && \
|
(nullptr != (jsdc->sourceTextLock = jsd_CreateLock())) && \
|
||||||
(NULL != (jsdc->atomsLock = jsd_CreateLock())) && \
|
(nullptr != (jsdc->atomsLock = jsd_CreateLock())) && \
|
||||||
(NULL != (jsdc->objectsLock = jsd_CreateLock())) && \
|
(nullptr != (jsdc->objectsLock = jsd_CreateLock())) && \
|
||||||
(NULL != (jsdc->threadStatesLock = jsd_CreateLock())) )
|
(nullptr != (jsdc->threadStatesLock = jsd_CreateLock())) )
|
||||||
|
|
||||||
#define JSD_LOCK_SCRIPTS(jsdc) jsd_Lock(jsdc->scriptsLock)
|
#define JSD_LOCK_SCRIPTS(jsdc) jsd_Lock(jsdc->scriptsLock)
|
||||||
#define JSD_UNLOCK_SCRIPTS(jsdc) jsd_Unlock(jsdc->scriptsLock)
|
#define JSD_UNLOCK_SCRIPTS(jsdc) jsd_Unlock(jsdc->scriptsLock)
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ _atom_smasher(JSHashEntry *he, int i, void *arg)
|
|||||||
|
|
||||||
free(((JSDAtom*)(he->value))->str);
|
free(((JSDAtom*)(he->value))->str);
|
||||||
free(he->value);
|
free(he->value);
|
||||||
he->value = NULL;
|
he->value = nullptr;
|
||||||
he->key = NULL;
|
he->key = nullptr;
|
||||||
return HT_ENUMERATE_NEXT;
|
return HT_ENUMERATE_NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ jsd_CreateAtomTable(JSDContext* jsdc)
|
|||||||
{
|
{
|
||||||
jsdc->atoms = JS_NewHashTable(256, JS_HashString,
|
jsdc->atoms = JS_NewHashTable(256, JS_HashString,
|
||||||
_compareAtomKeys, _compareAtoms,
|
_compareAtomKeys, _compareAtoms,
|
||||||
NULL, NULL);
|
nullptr, nullptr);
|
||||||
#ifdef TEST_ATOMS
|
#ifdef TEST_ATOMS
|
||||||
_testAtoms(jsdc);
|
_testAtoms(jsdc);
|
||||||
#endif
|
#endif
|
||||||
@@ -80,9 +80,9 @@ jsd_DestroyAtomTable(JSDContext* jsdc)
|
|||||||
{
|
{
|
||||||
if( jsdc->atoms )
|
if( jsdc->atoms )
|
||||||
{
|
{
|
||||||
JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, NULL);
|
JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, nullptr);
|
||||||
JS_HashTableDestroy(jsdc->atoms);
|
JS_HashTableDestroy(jsdc->atoms);
|
||||||
jsdc->atoms = NULL;
|
jsdc->atoms = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ jsd_AddAtom(JSDContext* jsdc, const char* str)
|
|||||||
if(!str)
|
if(!str)
|
||||||
{
|
{
|
||||||
JS_ASSERT(0);
|
JS_ASSERT(0);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSD_LOCK_ATOMS(jsdc);
|
JSD_LOCK_ATOMS(jsdc);
|
||||||
@@ -114,7 +114,7 @@ jsd_AddAtom(JSDContext* jsdc, const char* str)
|
|||||||
{
|
{
|
||||||
free(atom->str);
|
free(atom->str);
|
||||||
free(atom);
|
free(atom);
|
||||||
atom = NULL;
|
atom = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ JSCList _jsd_context_list = JS_INIT_STATIC_CLIST(&_jsd_context_list);
|
|||||||
|
|
||||||
/* these are used to connect JSD_SetUserCallbacks() with JSD_DebuggerOn() */
|
/* these are used to connect JSD_SetUserCallbacks() with JSD_DebuggerOn() */
|
||||||
static JSD_UserCallbacks _callbacks;
|
static JSD_UserCallbacks _callbacks;
|
||||||
static void* _user = NULL;
|
static void* _user = nullptr;
|
||||||
static JSRuntime* _jsrt = NULL;
|
static JSRuntime* _jsrt = nullptr;
|
||||||
|
|
||||||
#ifdef JSD_HAS_DANGEROUS_THREAD
|
#ifdef JSD_HAS_DANGEROUS_THREAD
|
||||||
static void* _dangerousThread = NULL;
|
static void* _dangerousThread = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JSD_THREADSAFE
|
#ifdef JSD_THREADSAFE
|
||||||
JSDStaticLock* _jsd_global_lock = NULL;
|
JSDStaticLock* _jsd_global_lock = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -72,15 +72,15 @@ _newJSDContext(JSRuntime* jsrt,
|
|||||||
void* user,
|
void* user,
|
||||||
JSObject* scopeobj)
|
JSObject* scopeobj)
|
||||||
{
|
{
|
||||||
JSDContext* jsdc = NULL;
|
JSDContext* jsdc = nullptr;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
|
|
||||||
if( ! jsrt )
|
if( ! jsrt )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( ! _validateUserCallbacks(callbacks) )
|
if( ! _validateUserCallbacks(callbacks) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdc = (JSDContext*) calloc(1, sizeof(JSDContext));
|
jsdc = (JSDContext*) calloc(1, sizeof(JSDContext));
|
||||||
if( ! jsdc )
|
if( ! jsdc )
|
||||||
@@ -131,7 +131,7 @@ _newJSDContext(JSRuntime* jsrt,
|
|||||||
if( ! ok )
|
if( ! ok )
|
||||||
goto label_newJSDContext_failure;
|
goto label_newJSDContext_failure;
|
||||||
|
|
||||||
jsdc->data = NULL;
|
jsdc->data = nullptr;
|
||||||
jsdc->inited = true;
|
jsdc->inited = true;
|
||||||
|
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
@@ -148,7 +148,7 @@ label_newJSDContext_failure:
|
|||||||
jsd_DestroyAtomTable(jsdc);
|
jsd_DestroyAtomTable(jsdc);
|
||||||
free(jsdc);
|
free(jsdc);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -188,7 +188,7 @@ jsd_DebuggerOnForUser(JSRuntime* jsrt,
|
|||||||
|
|
||||||
jsdc = _newJSDContext(jsrt, callbacks, user, scopeobj);
|
jsdc = _newJSDContext(jsrt, callbacks, user, scopeobj);
|
||||||
if( ! jsdc )
|
if( ! jsdc )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set hooks here. The new/destroy script hooks are on even when
|
* Set hooks here. The new/destroy script hooks are on even when
|
||||||
@@ -211,7 +211,7 @@ jsd_DebuggerOn(void)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(_jsrt);
|
JS_ASSERT(_jsrt);
|
||||||
JS_ASSERT(_validateUserCallbacks(&_callbacks));
|
JS_ASSERT(_validateUserCallbacks(&_callbacks));
|
||||||
return jsd_DebuggerOnForUser(_jsrt, &_callbacks, _user, NULL);
|
return jsd_DebuggerOnForUser(_jsrt, &_callbacks, _user, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -219,8 +219,8 @@ jsd_DebuggerOff(JSDContext* jsdc)
|
|||||||
{
|
{
|
||||||
jsd_DebuggerPause(jsdc, true);
|
jsd_DebuggerPause(jsdc, true);
|
||||||
/* clear hooks here */
|
/* clear hooks here */
|
||||||
JS_SetNewScriptHookProc(jsdc->jsrt, NULL, NULL);
|
JS_SetNewScriptHookProc(jsdc->jsrt, nullptr, nullptr);
|
||||||
JS_SetDestroyScriptHookProc(jsdc->jsrt, NULL, NULL);
|
JS_SetDestroyScriptHookProc(jsdc->jsrt, nullptr, nullptr);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
JSD_LockScriptSubsystem(jsdc);
|
JSD_LockScriptSubsystem(jsdc);
|
||||||
@@ -231,19 +231,19 @@ jsd_DebuggerOff(JSDContext* jsdc)
|
|||||||
_destroyJSDContext(jsdc);
|
_destroyJSDContext(jsdc);
|
||||||
|
|
||||||
if( jsdc->userCallbacks.setContext )
|
if( jsdc->userCallbacks.setContext )
|
||||||
jsdc->userCallbacks.setContext(NULL, jsdc->user);
|
jsdc->userCallbacks.setContext(nullptr, jsdc->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff)
|
jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff)
|
||||||
{
|
{
|
||||||
JS_SetDebuggerHandler(jsdc->jsrt, NULL, NULL);
|
JS_SetDebuggerHandler(jsdc->jsrt, nullptr, nullptr);
|
||||||
if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) {
|
if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) {
|
||||||
JS_SetExecuteHook(jsdc->jsrt, NULL, NULL);
|
JS_SetExecuteHook(jsdc->jsrt, nullptr, nullptr);
|
||||||
JS_SetCallHook(jsdc->jsrt, NULL, NULL);
|
JS_SetCallHook(jsdc->jsrt, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
JS_SetThrowHook(jsdc->jsrt, NULL, NULL);
|
JS_SetThrowHook(jsdc->jsrt, nullptr, nullptr);
|
||||||
JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL);
|
JS_SetDebugErrorHook(jsdc->jsrt, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -309,7 +309,7 @@ JSDContext*
|
|||||||
jsd_JSDContextForJSContext(JSContext* context)
|
jsd_JSDContextForJSContext(JSContext* context)
|
||||||
{
|
{
|
||||||
JSDContext* iter;
|
JSDContext* iter;
|
||||||
JSDContext* jsdc = NULL;
|
JSDContext* jsdc = nullptr;
|
||||||
JSRuntime* runtime = JS_GetRuntime(context);
|
JSRuntime* runtime = JS_GetRuntime(context);
|
||||||
|
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ jsd_CallExecutionHook(JSDContext* jsdc,
|
|||||||
JSD_HOOK_RETURN_CONTINUE;
|
JSD_HOOK_RETURN_CONTINUE;
|
||||||
JSDThreadState* jsdthreadstate;
|
JSDThreadState* jsdthreadstate;
|
||||||
|
|
||||||
if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc,cx)))
|
if(hook && nullptr != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
||||||
{
|
{
|
||||||
if ((type != JSD_HOOK_THROW && type != JSD_HOOK_INTERRUPTED) ||
|
if ((type != JSD_HOOK_THROW && type != JSD_HOOK_INTERRUPTED) ||
|
||||||
jsdc->flags & JSD_MASK_TOP_FRAME_ONLY ||
|
jsdc->flags & JSD_MASK_TOP_FRAME_ONLY ||
|
||||||
@@ -179,7 +179,7 @@ jsd_CallCallHook (JSDContext* jsdc,
|
|||||||
JSDThreadState* jsdthreadstate;
|
JSDThreadState* jsdthreadstate;
|
||||||
|
|
||||||
hookanswer = false;
|
hookanswer = false;
|
||||||
if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
if(hook && nullptr != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
||||||
{
|
{
|
||||||
hookanswer = hook(jsdc, jsdthreadstate, type, hookData);
|
hookanswer = hook(jsdc, jsdthreadstate, type, hookData);
|
||||||
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
||||||
@@ -206,8 +206,8 @@ bool
|
|||||||
jsd_ClearInterruptHook(JSDContext* jsdc)
|
jsd_ClearInterruptHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
JS_ClearInterrupt(jsdc->jsrt, NULL, NULL );
|
JS_ClearInterrupt(jsdc->jsrt, nullptr, nullptr);
|
||||||
jsdc->interruptHook = NULL;
|
jsdc->interruptHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -230,7 +230,7 @@ bool
|
|||||||
jsd_ClearDebugBreakHook(JSDContext* jsdc)
|
jsd_ClearDebugBreakHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
jsdc->debugBreakHook = NULL;
|
jsdc->debugBreakHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -253,7 +253,7 @@ bool
|
|||||||
jsd_ClearDebuggerHook(JSDContext* jsdc)
|
jsd_ClearDebuggerHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
jsdc->debuggerHook = NULL;
|
jsdc->debuggerHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -276,7 +276,7 @@ bool
|
|||||||
jsd_ClearThrowHook(JSDContext* jsdc)
|
jsd_ClearThrowHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
jsdc->throwHook = NULL;
|
jsdc->throwHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -299,7 +299,7 @@ bool
|
|||||||
jsd_ClearFunctionHook(JSDContext* jsdc)
|
jsd_ClearFunctionHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
jsdc->functionHook = NULL;
|
jsdc->functionHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -322,7 +322,7 @@ bool
|
|||||||
jsd_ClearTopLevelHook(JSDContext* jsdc)
|
jsd_ClearTopLevelHook(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
jsdc->toplevelHook = NULL;
|
jsdc->toplevelHook = nullptr;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ _constructJSStackFrameInfo( ExecEnv* ee, JSDStackFrameInfo* jsdframe,
|
|||||||
"(Lnetscape/jsdebug/JSThreadState;)",
|
"(Lnetscape/jsdebug/JSThreadState;)",
|
||||||
threadState );
|
threadState );
|
||||||
if( ! frame )
|
if( ! frame )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* XXX fill in additional fields */
|
/* XXX fill in additional fields */
|
||||||
unhand(frame)->_nativePtr = (long) jsdframe;
|
unhand(frame)->_nativePtr = (long) jsdframe;
|
||||||
@@ -91,7 +91,7 @@ _constructJSPC( ExecEnv* ee, struct Hnetscape_jsdebug_Script* script, long pc )
|
|||||||
"(Lnetscape/jsdebug/Script;I)",
|
"(Lnetscape/jsdebug/Script;I)",
|
||||||
script, pc );
|
script, pc );
|
||||||
if( ! pcOb )
|
if( ! pcOb )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* XXX fill in additional fields */
|
/* XXX fill in additional fields */
|
||||||
|
|
||||||
@@ -317,10 +317,10 @@ _errorReporter( JSDContext* jsdc,
|
|||||||
void* callerdata )
|
void* callerdata )
|
||||||
{
|
{
|
||||||
JHandle* reporter;
|
JHandle* reporter;
|
||||||
JHandle* msg = NULL;
|
JHandle* msg = nullptr;
|
||||||
JHandle* filename = NULL;
|
JHandle* filename = nullptr;
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
JHandle* linebuf = NULL;
|
JHandle* linebuf = nullptr;
|
||||||
int tokenOffset = 0;
|
int tokenOffset = 0;
|
||||||
ExecEnv* ee = EE();
|
ExecEnv* ee = EE();
|
||||||
|
|
||||||
@@ -380,9 +380,9 @@ void netscape_jsdebug_DebugController__setController(struct Hnetscape_jsdebug_De
|
|||||||
{
|
{
|
||||||
/* XXX stop somehow... */
|
/* XXX stop somehow... */
|
||||||
/* kill context */
|
/* kill context */
|
||||||
JSD_SetDebugBreakHook(context, NULL, NULL );
|
JSD_SetDebugBreakHook(context, nullptr, nullptr);
|
||||||
JSD_SetErrorReporter(context, NULL, NULL);
|
JSD_SetErrorReporter(context, nullptr, nullptr);
|
||||||
JSD_SetScriptHook(context, NULL, NULL);
|
JSD_SetScriptHook(context, nullptr, nullptr);
|
||||||
context = 0;
|
context = 0;
|
||||||
controller = 0;
|
controller = 0;
|
||||||
}
|
}
|
||||||
@@ -439,16 +439,16 @@ struct Hjava_lang_String *netscape_jsdebug_DebugController_executeScriptInStackF
|
|||||||
jsdframe = (JSDStackFrameInfo*) unhand(frame)->_nativePtr;
|
jsdframe = (JSDStackFrameInfo*) unhand(frame)->_nativePtr;
|
||||||
|
|
||||||
if( ! context || ! controller || ! jsdframe )
|
if( ! context || ! controller || ! jsdframe )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
filenameC = allocCString(filename);
|
filenameC = allocCString(filename);
|
||||||
if( ! filenameC )
|
if( ! filenameC )
|
||||||
return NULL;
|
return nullptr;
|
||||||
srcC = allocCString(src);
|
srcC = allocCString(src);
|
||||||
if( ! srcC )
|
if( ! srcC )
|
||||||
{
|
{
|
||||||
free(filenameC);
|
free(filenameC);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
srclen = strlen(srcC);
|
srclen = strlen(srcC);
|
||||||
@@ -464,14 +464,14 @@ struct Hjava_lang_String *netscape_jsdebug_DebugController_executeScriptInStackF
|
|||||||
|
|
||||||
|
|
||||||
if( ! success )
|
if( ! success )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval) )
|
if( JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsstr = JSD_ValToStringInStackFrame(context,jsdthreadstate,jsdframe,rval);
|
jsstr = JSD_ValToStringInStackFrame(context,jsdthreadstate,jsdframe,rval);
|
||||||
if( ! jsstr )
|
if( ! jsstr )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* XXXbe should use JS_GetStringChars and preserve Unicode. */
|
/* XXXbe should use JS_GetStringChars and preserve Unicode. */
|
||||||
return makeJavaString((char*)JS_GetStringBytes(jsstr), JS_GetStringLength(jsstr));
|
return makeJavaString((char*)JS_GetStringBytes(jsstr), JS_GetStringLength(jsstr));
|
||||||
@@ -533,16 +533,16 @@ struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSThreadState_getCurre
|
|||||||
JSDStackFrameInfo* jsdframe;
|
JSDStackFrameInfo* jsdframe;
|
||||||
|
|
||||||
if( ! context || ! controller )
|
if( ! context || ! controller )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdstate = (JSDThreadState*) unhand(self)->nativeThreadState;
|
jsdstate = (JSDThreadState*) unhand(self)->nativeThreadState;
|
||||||
|
|
||||||
if( ! jsdstate )
|
if( ! jsdstate )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdframe = JSD_GetStackFrame(context, jsdstate);
|
jsdframe = JSD_GetStackFrame(context, jsdstate);
|
||||||
if( ! jsdframe )
|
if( ! jsdframe )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
||||||
_constructJSStackFrameInfo( 0, jsdframe, self );
|
_constructJSStackFrameInfo( 0, jsdframe, self );
|
||||||
@@ -560,23 +560,23 @@ struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSStackFrameInfo_getCa
|
|||||||
JSDThreadState* jsdthreadstate;
|
JSDThreadState* jsdthreadstate;
|
||||||
|
|
||||||
if( ! context || ! controller )
|
if( ! context || ! controller )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdframeCur = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
jsdframeCur = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
||||||
if( ! jsdframeCur )
|
if( ! jsdframeCur )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
||||||
if( ! threadState )
|
if( ! threadState )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
||||||
if( ! jsdthreadstate )
|
if( ! jsdthreadstate )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdframeCaller = JSD_GetCallingStackFrame(context, jsdthreadstate, jsdframeCur);
|
jsdframeCaller = JSD_GetCallingStackFrame(context, jsdthreadstate, jsdframeCur);
|
||||||
if( ! jsdframeCaller )
|
if( ! jsdframeCaller )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
||||||
_constructJSStackFrameInfo( 0, jsdframeCaller, threadState );
|
_constructJSStackFrameInfo( 0, jsdframeCaller, threadState );
|
||||||
@@ -592,31 +592,31 @@ struct Hnetscape_jsdebug_PC *netscape_jsdebug_JSStackFrameInfo_getPC(struct Hnet
|
|||||||
ExecEnv* ee = EE();
|
ExecEnv* ee = EE();
|
||||||
|
|
||||||
if( ! context || ! controller || ! ee )
|
if( ! context || ! controller || ! ee )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdframe = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
jsdframe = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
||||||
if( ! jsdframe )
|
if( ! jsdframe )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
||||||
if( ! threadState )
|
if( ! threadState )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
||||||
if( ! jsdthreadstate )
|
if( ! jsdthreadstate )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdscript = JSD_GetScriptForStackFrame(context, jsdthreadstate, jsdframe );
|
jsdscript = JSD_GetScriptForStackFrame(context, jsdthreadstate, jsdframe );
|
||||||
if( ! jsdscript )
|
if( ! jsdscript )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
script = _scriptObFromJSDScriptPtr(ee, jsdscript);
|
script = _scriptObFromJSDScriptPtr(ee, jsdscript);
|
||||||
if( ! script )
|
if( ! script )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
pc = JSD_GetPCForStackFrame(context, jsdthreadstate, jsdframe);
|
pc = JSD_GetPCForStackFrame(context, jsdthreadstate, jsdframe);
|
||||||
if( ! pc )
|
if( ! pc )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return (struct Hnetscape_jsdebug_PC*) _constructJSPC(ee, script, pc);
|
return (struct Hnetscape_jsdebug_PC*) _constructJSPC(ee, script, pc);
|
||||||
}
|
}
|
||||||
@@ -635,16 +635,16 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
|||||||
ExecEnv* ee = EE();
|
ExecEnv* ee = EE();
|
||||||
|
|
||||||
if( ! context || ! controller || ! ee )
|
if( ! context || ! controller || ! ee )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
script = unhand(self)->script;
|
script = unhand(self)->script;
|
||||||
|
|
||||||
if( ! script )
|
if( ! script )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdscript = (JSDScript*) unhand(script)->_nativePtr;
|
jsdscript = (JSDScript*) unhand(script)->_nativePtr;
|
||||||
if( ! jsdscript )
|
if( ! jsdscript )
|
||||||
return NULL;
|
return nullptr;
|
||||||
pc = unhand(self)->pc;
|
pc = unhand(self)->pc;
|
||||||
|
|
||||||
line = JSD_GetClosestLine(context, jsdscript, pc);
|
line = JSD_GetClosestLine(context, jsdscript, pc);
|
||||||
@@ -652,7 +652,7 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
|||||||
|
|
||||||
newPCOb = _constructJSPC(ee, script, newpc );
|
newPCOb = _constructJSPC(ee, script, newpc );
|
||||||
if( ! newPCOb )
|
if( ! newPCOb )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return (struct Hnetscape_jsdebug_SourceLocation *)
|
return (struct Hnetscape_jsdebug_SourceLocation *)
|
||||||
execute_java_constructor( ee, "netscape/jsdebug/JSSourceLocation", 0,
|
execute_java_constructor( ee, "netscape/jsdebug/JSSourceLocation", 0,
|
||||||
@@ -666,7 +666,7 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
|||||||
struct Hnetscape_jsdebug_SourceTextItem *netscape_jsdebug_JSSourceTextProvider_loadSourceTextItem0(struct Hnetscape_jsdebug_JSSourceTextProvider * self,struct Hjava_lang_String * url)
|
struct Hnetscape_jsdebug_SourceTextItem *netscape_jsdebug_JSSourceTextProvider_loadSourceTextItem0(struct Hnetscape_jsdebug_JSSourceTextProvider * self,struct Hjava_lang_String * url)
|
||||||
{
|
{
|
||||||
/* this should attempt to load the source for the indicated URL */
|
/* this should attempt to load the source for the indicated URL */
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void netscape_jsdebug_JSSourceTextProvider_refreshSourceTextVector(struct Hnetscape_jsdebug_JSSourceTextProvider * self)
|
void netscape_jsdebug_JSSourceTextProvider_refreshSourceTextVector(struct Hnetscape_jsdebug_JSSourceTextProvider * self)
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ struct JSDStaticLock
|
|||||||
JS_BEGIN_MACRO \
|
JS_BEGIN_MACRO \
|
||||||
out = (void*) PR_GetCurrentThread(); \
|
out = (void*) PR_GetCurrentThread(); \
|
||||||
if(!out) \
|
if(!out) \
|
||||||
out = (void*) JS_AttachThread(PR_USER_THREAD,PR_PRIORITY_NORMAL,NULL);\
|
out = (void*) JS_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, \
|
||||||
|
nullptr); \
|
||||||
JS_ASSERT(out); \
|
JS_ASSERT(out); \
|
||||||
JS_END_MACRO
|
JS_END_MACRO
|
||||||
#else
|
#else
|
||||||
@@ -91,7 +92,7 @@ jsd_CreateLock()
|
|||||||
if(lock)
|
if(lock)
|
||||||
{
|
{
|
||||||
free(lock);
|
free(lock);
|
||||||
lock = NULL;
|
lock = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -136,7 +137,7 @@ jsd_Unlock(JSDStaticLock* lock)
|
|||||||
|
|
||||||
if(--lock->count == 0)
|
if(--lock->count == 0)
|
||||||
{
|
{
|
||||||
lock->owner = NULL;
|
lock->owner = nullptr;
|
||||||
PR_Unlock(lock->lock);
|
PR_Unlock(lock->lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ jsd_InitObjectManager(JSDContext* jsdc)
|
|||||||
JS_INIT_CLIST(&jsdc->objectsList);
|
JS_INIT_CLIST(&jsdc->objectsList);
|
||||||
jsdc->objectsTable = JS_NewHashTable(256, _hash_root,
|
jsdc->objectsTable = JS_NewHashTable(256, _hash_root,
|
||||||
JS_CompareValues, JS_CompareValues,
|
JS_CompareValues, JS_CompareValues,
|
||||||
NULL, NULL);
|
nullptr, nullptr);
|
||||||
return !!jsdc->objectsTable;
|
return !!jsdc->objectsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp)
|
|||||||
if( !jsdobj )
|
if( !jsdobj )
|
||||||
jsdobj = (JSDObject *)jsdc->objectsList.next;
|
jsdobj = (JSDObject *)jsdc->objectsList.next;
|
||||||
if( jsdobj == (JSDObject *)&jsdc->objectsList )
|
if( jsdobj == (JSDObject *)&jsdc->objectsList )
|
||||||
return NULL;
|
return nullptr;
|
||||||
*iterp = (JSDObject*) jsdobj->links.next;
|
*iterp = (JSDObject*) jsdobj->links.next;
|
||||||
return jsdobj;
|
return jsdobj;
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj)
|
|||||||
{
|
{
|
||||||
if( jsdobj->newURL )
|
if( jsdobj->newURL )
|
||||||
return JSD_ATOM_TO_STRING(jsdobj->newURL);
|
return JSD_ATOM_TO_STRING(jsdobj->newURL);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
@@ -191,7 +191,7 @@ jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj)
|
|||||||
{
|
{
|
||||||
if( jsdobj->ctorURL )
|
if( jsdobj->ctorURL )
|
||||||
return JSD_ATOM_TO_STRING(jsdobj->ctorURL);
|
return JSD_ATOM_TO_STRING(jsdobj->ctorURL);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
@@ -205,7 +205,7 @@ jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj)
|
|||||||
{
|
{
|
||||||
if( jsdobj->ctorName )
|
if( jsdobj->ctorName )
|
||||||
return JSD_ATOM_TO_STRING(jsdobj->ctorName);
|
return JSD_ATOM_TO_STRING(jsdobj->ctorName);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSDObject*
|
JSDObject*
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ _newJSDScript(JSDContext* jsdc,
|
|||||||
{
|
{
|
||||||
JS::RootedScript script(cx, script_);
|
JS::RootedScript script(cx, script_);
|
||||||
if ( JS_GetScriptIsSelfHosted(script) )
|
if ( JS_GetScriptIsSelfHosted(script) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
JSDScript* jsdscript;
|
JSDScript* jsdscript;
|
||||||
unsigned lineno;
|
unsigned lineno;
|
||||||
@@ -56,11 +56,11 @@ _newJSDScript(JSDContext* jsdc,
|
|||||||
/* these are inlined javascript: urls and we can't handle them now */
|
/* these are inlined javascript: urls and we can't handle them now */
|
||||||
lineno = (unsigned) JS_GetScriptBaseLineNumber(cx, script);
|
lineno = (unsigned) JS_GetScriptBaseLineNumber(cx, script);
|
||||||
if( lineno == 0 )
|
if( lineno == 0 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdscript = (JSDScript*) calloc(1, sizeof(JSDScript));
|
jsdscript = (JSDScript*) calloc(1, sizeof(JSDScript));
|
||||||
if( ! jsdscript )
|
if( ! jsdscript )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
raw_filename = JS_GetScriptFilename(cx,script);
|
raw_filename = JS_GetScriptFilename(cx,script);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ _newJSDScript(JSDContext* jsdc,
|
|||||||
jsdscript->script = script;
|
jsdscript->script = script;
|
||||||
jsdscript->lineBase = lineno;
|
jsdscript->lineBase = lineno;
|
||||||
jsdscript->lineExtent = (unsigned)NOT_SET_YET;
|
jsdscript->lineExtent = (unsigned)NOT_SET_YET;
|
||||||
jsdscript->data = NULL;
|
jsdscript->data = nullptr;
|
||||||
jsdscript->url = (char*) jsd_BuildNormalizedURL(raw_filename);
|
jsdscript->url = (char*) jsd_BuildNormalizedURL(raw_filename);
|
||||||
|
|
||||||
JS_INIT_CLIST(&jsdscript->hooks);
|
JS_INIT_CLIST(&jsdscript->hooks);
|
||||||
@@ -142,11 +142,11 @@ _dumpJSDScript(JSDContext* jsdc, JSDScript* jsdscript, const char* leadingtext)
|
|||||||
static void
|
static void
|
||||||
_dumpJSDScriptList( JSDContext* jsdc )
|
_dumpJSDScriptList( JSDContext* jsdc )
|
||||||
{
|
{
|
||||||
JSDScript* iterp = NULL;
|
JSDScript* iterp = nullptr;
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
|
|
||||||
OutputDebugString( "*** JSDScriptDump\n" );
|
OutputDebugString( "*** JSDScriptDump\n" );
|
||||||
while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
while( nullptr != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||||
_dumpJSDScript( jsdc, jsdscript, " script: " );
|
_dumpJSDScript( jsdc, jsdscript, " script: " );
|
||||||
}
|
}
|
||||||
#endif /* JSD_DUMP */
|
#endif /* JSD_DUMP */
|
||||||
@@ -347,7 +347,7 @@ jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script)
|
|||||||
if (script->profileData)
|
if (script->profileData)
|
||||||
{
|
{
|
||||||
free(script->profileData);
|
free(script->profileData);
|
||||||
script->profileData = NULL;
|
script->profileData = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp)
|
|||||||
if( !jsdscript )
|
if( !jsdscript )
|
||||||
jsdscript = (JSDScript *)jsdc->scripts.next;
|
jsdscript = (JSDScript *)jsdc->scripts.next;
|
||||||
if( jsdscript == (JSDScript *)&jsdc->scripts )
|
if( jsdscript == (JSDScript *)&jsdc->scripts )
|
||||||
return NULL;
|
return nullptr;
|
||||||
*iterp = (JSDScript*) jsdscript->links.next;
|
*iterp = (JSDScript*) jsdscript->links.next;
|
||||||
return jsdscript;
|
return jsdscript;
|
||||||
}
|
}
|
||||||
@@ -423,7 +423,7 @@ jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript)
|
|||||||
JSFunction *fun = jsd_GetJSFunction(jsdc, jsdscript);
|
JSFunction *fun = jsd_GetJSFunction(jsdc, jsdscript);
|
||||||
|
|
||||||
if( ! fun )
|
if( ! fun )
|
||||||
return NULL;
|
return nullptr;
|
||||||
str = JS_GetFunctionId(fun);
|
str = JS_GetFunctionId(fun);
|
||||||
|
|
||||||
/* For compatibility we return "anonymous", not an empty string here. */
|
/* For compatibility we return "anonymous", not an empty string here. */
|
||||||
@@ -561,7 +561,7 @@ jsd_NewScriptHookProc(
|
|||||||
JSFunction *fun,
|
JSFunction *fun,
|
||||||
void* callerdata )
|
void* callerdata )
|
||||||
{
|
{
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
JSDContext* jsdc = (JSDContext*) callerdata;
|
JSDContext* jsdc = (JSDContext*) callerdata;
|
||||||
JSD_ScriptHookProc hook;
|
JSD_ScriptHookProc hook;
|
||||||
void* hookData;
|
void* hookData;
|
||||||
@@ -602,7 +602,7 @@ jsd_DestroyScriptHookProc(
|
|||||||
JSScript *script_,
|
JSScript *script_,
|
||||||
void* callerdata )
|
void* callerdata )
|
||||||
{
|
{
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
JSDContext* jsdc = (JSDContext*) callerdata;
|
JSDContext* jsdc = (JSDContext*) callerdata;
|
||||||
// NB: We're called during GC, so we can't push a cx. Root directly with
|
// NB: We're called during GC, so we can't push a cx. Root directly with
|
||||||
// the runtime.
|
// the runtime.
|
||||||
@@ -630,7 +630,8 @@ jsd_DestroyScriptHookProc(
|
|||||||
|
|
||||||
/* local in case hook gets cleared on another thread */
|
/* local in case hook gets cleared on another thread */
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook : NULL;
|
hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook
|
||||||
|
: nullptr;
|
||||||
hookData = jsdc->scriptHookData;
|
hookData = jsdc->scriptHookData;
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
|
|
||||||
@@ -664,7 +665,7 @@ _findHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc)
|
|||||||
if (jsdhook->pc == pc)
|
if (jsdhook->pc == pc)
|
||||||
return jsdhook;
|
return jsdhook;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -711,7 +712,7 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
|
|||||||
|
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
|
|
||||||
if( NULL == (jsdc = jsd_JSDContextForJSContext(cx)) ||
|
if( nullptr == (jsdc = jsd_JSDContextForJSContext(cx)) ||
|
||||||
! _isActiveHook(jsdc, script, jsdhook) )
|
! _isActiveHook(jsdc, script, jsdhook) )
|
||||||
{
|
{
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
@@ -819,7 +820,7 @@ jsd_ClearExecutionHook(JSDContext* jsdc,
|
|||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
JSAutoCompartment ac(cx, jsdscript->script);
|
JSAutoCompartment ac(cx, jsdscript->script);
|
||||||
JS_ClearTrap(cx, jsdscript->script,
|
JS_ClearTrap(cx, jsdscript->script,
|
||||||
(jsbytecode*)pc, NULL, NULL );
|
(jsbytecode*)pc, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_REMOVE_LINK(&jsdhook->links);
|
JS_REMOVE_LINK(&jsdhook->links);
|
||||||
@@ -852,10 +853,10 @@ bool
|
|||||||
jsd_ClearAllExecutionHooks(JSDContext* jsdc)
|
jsd_ClearAllExecutionHooks(JSDContext* jsdc)
|
||||||
{
|
{
|
||||||
JSDScript* jsdscript;
|
JSDScript* jsdscript;
|
||||||
JSDScript* iterp = NULL;
|
JSDScript* iterp = nullptr;
|
||||||
|
|
||||||
JSD_LOCK();
|
JSD_LOCK();
|
||||||
while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
while( nullptr != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||||
jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript);
|
jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript);
|
||||||
JSD_UNLOCK();
|
JSD_UNLOCK();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ _addNewFrame(JSDContext* jsdc,
|
|||||||
JSAbstractFramePtr frame)
|
JSAbstractFramePtr frame)
|
||||||
{
|
{
|
||||||
JSDStackFrameInfo* jsdframe;
|
JSDStackFrameInfo* jsdframe;
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_SCRIPTS(jsdc);
|
JSD_LOCK_SCRIPTS(jsdc);
|
||||||
jsdscript = jsd_FindJSDScript(jsdc, script);
|
jsdscript = jsd_FindJSDScript(jsdc, script);
|
||||||
@@ -45,7 +45,7 @@ _addNewFrame(JSDContext* jsdc,
|
|||||||
if (!jsdscript || (jsdc->flags & JSD_HIDE_DISABLED_FRAMES &&
|
if (!jsdscript || (jsdc->flags & JSD_HIDE_DISABLED_FRAMES &&
|
||||||
!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript)))
|
!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript)))
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript))
|
if (!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript))
|
||||||
@@ -53,7 +53,7 @@ _addNewFrame(JSDContext* jsdc,
|
|||||||
|
|
||||||
jsdframe = (JSDStackFrameInfo*) calloc(1, sizeof(JSDStackFrameInfo));
|
jsdframe = (JSDStackFrameInfo*) calloc(1, sizeof(JSDStackFrameInfo));
|
||||||
if( ! jsdframe )
|
if( ! jsdframe )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdframe->jsdthreadstate = jsdthreadstate;
|
jsdframe->jsdthreadstate = jsdthreadstate;
|
||||||
jsdframe->jsdscript = jsdscript;
|
jsdframe->jsdscript = jsdscript;
|
||||||
@@ -83,7 +83,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
|||||||
|
|
||||||
jsdthreadstate = (JSDThreadState*)calloc(1, sizeof(JSDThreadState));
|
jsdthreadstate = (JSDThreadState*)calloc(1, sizeof(JSDThreadState));
|
||||||
if( ! jsdthreadstate )
|
if( ! jsdthreadstate )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdthreadstate->context = cx;
|
jsdthreadstate->context = cx;
|
||||||
jsdthreadstate->thread = JSD_CURRENT_THREAD();
|
jsdthreadstate->thread = JSD_CURRENT_THREAD();
|
||||||
@@ -121,7 +121,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
|||||||
JS_INIT_CLIST(&jsdthreadstate->links);
|
JS_INIT_CLIST(&jsdthreadstate->links);
|
||||||
JS_EndRequest(jsdthreadstate->context);
|
JS_EndRequest(jsdthreadstate->context);
|
||||||
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
|||||||
if (jsdthreadstate->stackDepth == 0)
|
if (jsdthreadstate->stackDepth == 0)
|
||||||
{
|
{
|
||||||
free(jsdthreadstate);
|
free(jsdthreadstate);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
@@ -182,7 +182,7 @@ jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
|||||||
JSDStackFrameInfo*
|
JSDStackFrameInfo*
|
||||||
jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||||
{
|
{
|
||||||
JSDStackFrameInfo* jsdframe = NULL;
|
JSDStackFrameInfo* jsdframe = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
|||||||
JSContext *
|
JSContext *
|
||||||
jsd_GetJSContext (JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
jsd_GetJSContext (JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||||
{
|
{
|
||||||
JSContext* cx = NULL;
|
JSContext* cx = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
if( jsd_IsValidThreadState(jsdc, jsdthreadstate) )
|
if( jsd_IsValidThreadState(jsdc, jsdthreadstate) )
|
||||||
@@ -211,7 +211,7 @@ jsd_GetCallingStackFrame(JSDContext* jsdc,
|
|||||||
JSDThreadState* jsdthreadstate,
|
JSDThreadState* jsdthreadstate,
|
||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JSDStackFrameInfo* nextjsdframe = NULL;
|
JSDStackFrameInfo* nextjsdframe = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ jsd_GetScriptForStackFrame(JSDContext* jsdc,
|
|||||||
JSDThreadState* jsdthreadstate,
|
JSDThreadState* jsdthreadstate,
|
||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ jsd_GetCallObjectForStackFrame(JSDContext* jsdc,
|
|||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JSObject* obj;
|
JSObject* obj;
|
||||||
JSDValue* jsdval = NULL;
|
JSDValue* jsdval = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ jsd_GetScopeChainForStackFrame(JSDContext* jsdc,
|
|||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JS::RootedObject obj(jsdthreadstate->context);
|
JS::RootedObject obj(jsdthreadstate->context);
|
||||||
JSDValue* jsdval = NULL;
|
JSDValue* jsdval = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ jsd_GetThisForStackFrame(JSDContext* jsdc,
|
|||||||
JSDThreadState* jsdthreadstate,
|
JSDThreadState* jsdthreadstate,
|
||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JSDValue* jsdval = NULL;
|
JSDValue* jsdval = nullptr;
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
|
if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
|
||||||
@@ -332,7 +332,7 @@ jsd_GetIdForStackFrame(JSDContext* jsdc,
|
|||||||
JSDThreadState* jsdthreadstate,
|
JSDThreadState* jsdthreadstate,
|
||||||
JSDStackFrameInfo* jsdframe)
|
JSDStackFrameInfo* jsdframe)
|
||||||
{
|
{
|
||||||
JSString *rv = NULL;
|
JSString *rv = nullptr;
|
||||||
|
|
||||||
JSD_LOCK_THREADSTATES(jsdc);
|
JSD_LOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
|
|||||||
{
|
{
|
||||||
bool retval;
|
bool retval;
|
||||||
bool valid;
|
bool valid;
|
||||||
JSExceptionState* exceptionState = NULL;
|
JSExceptionState* exceptionState = nullptr;
|
||||||
|
|
||||||
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ jsd_EvaluateScriptInStackFrame(JSDContext* jsdc,
|
|||||||
{
|
{
|
||||||
bool retval;
|
bool retval;
|
||||||
bool valid;
|
bool valid;
|
||||||
JSExceptionState* exceptionState = NULL;
|
JSExceptionState* exceptionState = nullptr;
|
||||||
|
|
||||||
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ jsd_ValToStringInStackFrame(JSDContext* jsdc,
|
|||||||
JSD_UNLOCK_THREADSTATES(jsdc);
|
JSD_UNLOCK_THREADSTATES(jsdc);
|
||||||
|
|
||||||
if( ! valid )
|
if( ! valid )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
cx = jsdthreadstate->context;
|
cx = jsdthreadstate->context;
|
||||||
JS_ASSERT(cx);
|
JS_ASSERT(cx);
|
||||||
@@ -537,7 +537,7 @@ _getContextForThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
|||||||
JSD_UNLOCK_THREADSTATES(jsdc);
|
JSD_UNLOCK_THREADSTATES(jsdc);
|
||||||
if( valid )
|
if( valid )
|
||||||
return jsdthreadstate->context;
|
return jsdthreadstate->context;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSDValue*
|
JSDValue*
|
||||||
@@ -547,11 +547,11 @@ jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
|||||||
JS::RootedValue val(cx);
|
JS::RootedValue val(cx);
|
||||||
|
|
||||||
if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate)))
|
if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate)))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if(JS_GetPendingException(cx, &val))
|
if(JS_GetPendingException(cx, &val))
|
||||||
return jsd_NewValue(jsdc, val);
|
return jsd_NewValue(jsdc, val);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ static char*
|
|||||||
_indentSpaces(int i)
|
_indentSpaces(int i)
|
||||||
{
|
{
|
||||||
#define MAX_INDENT 63
|
#define MAX_INDENT 63
|
||||||
static char* p = NULL;
|
static char* p = nullptr;
|
||||||
if(!p)
|
if(!p)
|
||||||
{
|
{
|
||||||
p = calloc(1, MAX_INDENT+1);
|
p = calloc(1, MAX_INDENT+1);
|
||||||
@@ -35,10 +35,10 @@ static void
|
|||||||
_interpreterTrace(JSDContext* jsdc, JSContext *cx, JSAbstractFramePtr frame,
|
_interpreterTrace(JSDContext* jsdc, JSContext *cx, JSAbstractFramePtr frame,
|
||||||
bool isConstructing, bool before)
|
bool isConstructing, bool before)
|
||||||
{
|
{
|
||||||
JSDScript* jsdscript = NULL;
|
JSDScript* jsdscript = nullptr;
|
||||||
JSScript * script;
|
JSScript * script;
|
||||||
static indent = 0;
|
static indent = 0;
|
||||||
JSString* funName = NULL;
|
JSString* funName = nullptr;
|
||||||
|
|
||||||
script = frame.script();
|
script = frame.script();
|
||||||
if(script)
|
if(script)
|
||||||
@@ -200,7 +200,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons
|
|||||||
/* Current function is now our caller. */
|
/* Current function is now our caller. */
|
||||||
jsdc->callingFunctionPData = pdata->caller;
|
jsdc->callingFunctionPData = pdata->caller;
|
||||||
/* No hanging pointers, please. */
|
/* No hanging pointers, please. */
|
||||||
pdata->caller = NULL;
|
pdata->caller = nullptr;
|
||||||
/* Mark the time we returned, and indicate this
|
/* Mark the time we returned, and indicate this
|
||||||
* function is no longer running. */
|
* function is no longer running. */
|
||||||
jsdc->lastReturnTime = now;
|
jsdc->lastReturnTime = now;
|
||||||
@@ -255,7 +255,7 @@ jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructin
|
|||||||
return closure;
|
return closure;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
@@ -281,6 +281,6 @@ jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructin
|
|||||||
return closure;
|
return closure;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ _clearText(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
|||||||
{
|
{
|
||||||
if( jsdsrc->text )
|
if( jsdsrc->text )
|
||||||
free(jsdsrc->text);
|
free(jsdsrc->text);
|
||||||
jsdsrc->text = NULL;
|
jsdsrc->text = nullptr;
|
||||||
jsdsrc->textLength = 0;
|
jsdsrc->textLength = 0;
|
||||||
jsdsrc->textSpace = 0;
|
jsdsrc->textSpace = 0;
|
||||||
jsdsrc->status = JSD_SOURCE_CLEARED;
|
jsdsrc->status = JSD_SOURCE_CLEARED;
|
||||||
@@ -85,7 +85,7 @@ _newSource(JSDContext* jsdc, char* url)
|
|||||||
{
|
{
|
||||||
JSDSourceText* jsdsrc = (JSDSourceText*)calloc(1,sizeof(JSDSourceText));
|
JSDSourceText* jsdsrc = (JSDSourceText*)calloc(1,sizeof(JSDSourceText));
|
||||||
if( ! jsdsrc )
|
if( ! jsdsrc )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdsrc->url = url;
|
jsdsrc->url = url;
|
||||||
jsdsrc->status = JSD_SOURCE_INITED;
|
jsdsrc->status = JSD_SOURCE_INITED;
|
||||||
@@ -98,7 +98,7 @@ _newSource(JSDContext* jsdc, char* url)
|
|||||||
static void
|
static void
|
||||||
_destroySource(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
_destroySource(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
||||||
{
|
{
|
||||||
JS_ASSERT(NULL == jsdsrc->text); /* must _clearText() first */
|
JS_ASSERT(nullptr == jsdsrc->text); /* must _clearText() first */
|
||||||
free(jsdsrc->url);
|
free(jsdsrc->url);
|
||||||
free(jsdsrc);
|
free(jsdsrc);
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ _addSource(JSDContext* jsdc, char* url)
|
|||||||
{
|
{
|
||||||
JSDSourceText* jsdsrc = _newSource(jsdc, url);
|
JSDSourceText* jsdsrc = _newSource(jsdc, url);
|
||||||
if( ! jsdsrc )
|
if( ! jsdsrc )
|
||||||
return NULL;
|
return nullptr;
|
||||||
JS_INSERT_LINK(&jsdsrc->links, &jsdc->sources);
|
JS_INSERT_LINK(&jsdsrc->links, &jsdc->sources);
|
||||||
return jsdsrc;
|
return jsdsrc;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ jsd_BuildNormalizedURL( const char* url_string )
|
|||||||
char *new_url_string;
|
char *new_url_string;
|
||||||
|
|
||||||
if( ! url_string )
|
if( ! url_string )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if (!strncasecomp(url_string, file_url_prefix, FILE_URL_PREFIX_LEN) &&
|
if (!strncasecomp(url_string, file_url_prefix, FILE_URL_PREFIX_LEN) &&
|
||||||
url_string[FILE_URL_PREFIX_LEN + 0] == '/' &&
|
url_string[FILE_URL_PREFIX_LEN + 0] == '/' &&
|
||||||
@@ -230,7 +230,7 @@ jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp)
|
|||||||
if( !jsdsrc )
|
if( !jsdsrc )
|
||||||
jsdsrc = (JSDSourceText *)jsdc->sources.next;
|
jsdsrc = (JSDSourceText *)jsdc->sources.next;
|
||||||
if( jsdsrc == (JSDSourceText *)&jsdc->sources )
|
if( jsdsrc == (JSDSourceText *)&jsdc->sources )
|
||||||
return NULL;
|
return nullptr;
|
||||||
*iterp = (JSDSourceText *)jsdsrc->links.next;
|
*iterp = (JSDSourceText *)jsdsrc->links.next;
|
||||||
return jsdsrc;
|
return jsdsrc;
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ jsd_FindSourceForURL(JSDContext* jsdc, const char* url)
|
|||||||
if( 0 == strcmp(jsdsrc->url, url) )
|
if( 0 == strcmp(jsdsrc->url, url) )
|
||||||
return jsdsrc;
|
return jsdsrc;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
@@ -310,11 +310,11 @@ jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
|||||||
#if defined(DEBUG) && 0
|
#if defined(DEBUG) && 0
|
||||||
void DEBUG_ITERATE_SOURCES( JSDContext* jsdc )
|
void DEBUG_ITERATE_SOURCES( JSDContext* jsdc )
|
||||||
{
|
{
|
||||||
JSDSourceText* iterp = NULL;
|
JSDSourceText* iterp = nullptr;
|
||||||
JSDSourceText* jsdsrc = NULL;
|
JSDSourceText* jsdsrc = nullptr;
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|
||||||
while( NULL != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) )
|
while( nullptr != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) )
|
||||||
{
|
{
|
||||||
const char* url;
|
const char* url;
|
||||||
const char* text;
|
const char* text;
|
||||||
@@ -348,7 +348,7 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url)
|
|||||||
new_url_string = jsd_BuildNormalizedURL(url);
|
new_url_string = jsd_BuildNormalizedURL(url);
|
||||||
|
|
||||||
if( ! new_url_string )
|
if( ! new_url_string )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
jsdsrc = jsd_FindSourceForURL(jsdc, new_url_string);
|
jsdsrc = jsd_FindSourceForURL(jsdc, new_url_string);
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url)
|
|||||||
{
|
{
|
||||||
free(new_url_string);
|
free(new_url_string);
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_moveSourceToRemovedList(jsdc, jsdsrc);
|
_moveSourceToRemovedList(jsdc, jsdsrc);
|
||||||
@@ -383,14 +383,14 @@ jsd_AppendSourceText(JSDContext* jsdc,
|
|||||||
if( jsdsrc->doingEval )
|
if( jsdsrc->doingEval )
|
||||||
{
|
{
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! _isSourceInSourceList( jsdc, jsdsrc ) )
|
if( ! _isSourceInSourceList( jsdc, jsdsrc ) )
|
||||||
{
|
{
|
||||||
_removeSourceFromRemovedList( jsdc, jsdsrc );
|
_removeSourceFromRemovedList( jsdc, jsdsrc );
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( text && length && ! _appendText( jsdc, jsdsrc, text, length ) )
|
if( text && length && ! _appendText( jsdc, jsdsrc, text, length ) )
|
||||||
@@ -400,7 +400,7 @@ jsd_AppendSourceText(JSDContext* jsdc,
|
|||||||
jsdsrc->status = JSD_SOURCE_FAILED;
|
jsdsrc->status = JSD_SOURCE_FAILED;
|
||||||
_moveSourceToRemovedList(jsdc, jsdsrc);
|
_moveSourceToRemovedList(jsdc, jsdsrc);
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsdsrc->dirty = true;
|
jsdsrc->dirty = true;
|
||||||
@@ -419,11 +419,11 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
|||||||
JSDSourceStatus status)
|
JSDSourceStatus status)
|
||||||
{
|
{
|
||||||
#define UNICODE_TRUNCATE_BUF_SIZE 1024
|
#define UNICODE_TRUNCATE_BUF_SIZE 1024
|
||||||
static char* buf = NULL;
|
static char* buf = nullptr;
|
||||||
int remaining = length;
|
int remaining = length;
|
||||||
|
|
||||||
if(!text || !length)
|
if(!text || !length)
|
||||||
return jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status);
|
return jsd_AppendSourceText(jsdc, jsdsrc, nullptr, 0, status);
|
||||||
|
|
||||||
JSD_LOCK_SOURCE_TEXT(jsdc);
|
JSD_LOCK_SOURCE_TEXT(jsdc);
|
||||||
if(!buf)
|
if(!buf)
|
||||||
@@ -432,7 +432,7 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
|||||||
if(!buf)
|
if(!buf)
|
||||||
{
|
{
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(remaining && jsdsrc) {
|
while(remaining && jsdsrc) {
|
||||||
@@ -446,7 +446,7 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
|||||||
remaining -= bytes;
|
remaining -= bytes;
|
||||||
}
|
}
|
||||||
if(jsdsrc && status != JSD_SOURCE_PARTIAL)
|
if(jsdsrc && status != JSD_SOURCE_PARTIAL)
|
||||||
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status);
|
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, nullptr, 0, status);
|
||||||
|
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
return jsdsrc;
|
return jsdsrc;
|
||||||
@@ -469,7 +469,7 @@ jsd_AddFullSourceText(JSDContext* jsdc,
|
|||||||
text, length, JSD_SOURCE_PARTIAL );
|
text, length, JSD_SOURCE_PARTIAL );
|
||||||
if( jsdsrc )
|
if( jsdsrc )
|
||||||
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
||||||
NULL, 0, JSD_SOURCE_COMPLETED );
|
nullptr, 0, JSD_SOURCE_COMPLETED );
|
||||||
|
|
||||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
|
|
||||||
|
|||||||
@@ -197,12 +197,12 @@ jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
stringval = STRING_TO_JSVAL(string);
|
stringval = STRING_TO_JSVAL(string);
|
||||||
}
|
}
|
||||||
if(!string || !JS_WrapValue(cx, stringval.address())) {
|
if(!string || !JS_WrapValue(cx, stringval.address())) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsdval->string = JSVAL_TO_STRING(stringval);
|
jsdval->string = JSVAL_TO_STRING(stringval);
|
||||||
if(!JS_AddNamedStringRoot(cx, &jsdval->string, "ValueString"))
|
if(!JS_AddNamedStringRoot(cx, &jsdval->string, "ValueString"))
|
||||||
jsdval->string = NULL;
|
jsdval->string = nullptr;
|
||||||
|
|
||||||
return jsdval->string;
|
return jsdval->string;
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
AutoSaveExceptionState as(cx);
|
AutoSaveExceptionState as(cx);
|
||||||
fun = JSD_GetValueFunction(jsdc, jsdval);
|
fun = JSD_GetValueFunction(jsdc, jsdval);
|
||||||
if(!fun)
|
if(!fun)
|
||||||
return NULL;
|
return nullptr;
|
||||||
jsdval->funName = JS_GetFunctionId(fun);
|
jsdval->funName = JS_GetFunctionId(fun);
|
||||||
|
|
||||||
/* For compatibility we return "anonymous", not an empty string here. */
|
/* For compatibility we return "anonymous", not an empty string here. */
|
||||||
@@ -244,7 +244,7 @@ jsd_NewValue(JSDContext* jsdc, jsval value)
|
|||||||
JSDValue* jsdval;
|
JSDValue* jsdval;
|
||||||
|
|
||||||
if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
|
if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if(JSVAL_IS_GCTHING(val))
|
if(JSVAL_IS_GCTHING(val))
|
||||||
{
|
{
|
||||||
@@ -261,7 +261,7 @@ jsd_NewValue(JSDContext* jsdc, jsval value)
|
|||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
free(jsdval);
|
free(jsdval);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsdval->val = val;
|
jsdval->val = val;
|
||||||
@@ -316,7 +316,7 @@ static JSDProperty* _newProperty(JSDContext* jsdc, JS::HandleValue propId,
|
|||||||
JSDProperty* jsdprop;
|
JSDProperty* jsdprop;
|
||||||
|
|
||||||
if(!(jsdprop = (JSDProperty*) calloc(1, sizeof(JSDProperty))))
|
if(!(jsdprop = (JSDProperty*) calloc(1, sizeof(JSDProperty))))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
JS_INIT_CLIST(&jsdprop->links);
|
JS_INIT_CLIST(&jsdprop->links);
|
||||||
jsdprop->nref = 1;
|
jsdprop->nref = 1;
|
||||||
@@ -335,7 +335,7 @@ static JSDProperty* _newProperty(JSDContext* jsdc, JS::HandleValue propId,
|
|||||||
return jsdprop;
|
return jsdprop;
|
||||||
new_prop_fail:
|
new_prop_fail:
|
||||||
jsd_DropProperty(jsdc, jsdprop);
|
jsd_DropProperty(jsdc, jsdprop);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _freeProps(JSDContext* jsdc, JSDValue* jsdval)
|
static void _freeProps(JSDContext* jsdc, JSDValue* jsdval)
|
||||||
@@ -399,7 +399,7 @@ static bool _buildProps(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef DROP_CLEAR_VALUE
|
#undef DROP_CLEAR_VALUE
|
||||||
#define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = NULL;}
|
#define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = nullptr;}
|
||||||
|
|
||||||
void
|
void
|
||||||
jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
|
jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
|
||||||
@@ -413,11 +413,11 @@ jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
JSAutoCompartment ac(cx, jsdc->glob);
|
JSAutoCompartment ac(cx, jsdc->glob);
|
||||||
JS_RemoveStringRoot(cx, &jsdval->string);
|
JS_RemoveStringRoot(cx, &jsdval->string);
|
||||||
}
|
}
|
||||||
jsdval->string = NULL;
|
jsdval->string = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsdval->funName = NULL;
|
jsdval->funName = nullptr;
|
||||||
jsdval->className = NULL;
|
jsdval->className = nullptr;
|
||||||
DROP_CLEAR_VALUE(jsdc, jsdval->proto);
|
DROP_CLEAR_VALUE(jsdc, jsdval->proto);
|
||||||
DROP_CLEAR_VALUE(jsdc, jsdval->parent);
|
DROP_CLEAR_VALUE(jsdc, jsdval->parent);
|
||||||
DROP_CLEAR_VALUE(jsdc, jsdval->ctor);
|
DROP_CLEAR_VALUE(jsdc, jsdval->ctor);
|
||||||
@@ -454,13 +454,13 @@ jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(!jsdprop);
|
JS_ASSERT(!jsdprop);
|
||||||
if(!_buildProps(jsdc, jsdval))
|
if(!_buildProps(jsdc, jsdval))
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!jsdprop)
|
if(!jsdprop)
|
||||||
jsdprop = (JSDProperty*)jsdval->props.next;
|
jsdprop = (JSDProperty*)jsdval->props.next;
|
||||||
if(jsdprop == (JSDProperty*)&jsdval->props)
|
if(jsdprop == (JSDProperty*)&jsdval->props)
|
||||||
return NULL;
|
return nullptr;
|
||||||
*iterp = (JSDProperty*)jsdprop->links.next;
|
*iterp = (JSDProperty*)jsdprop->links.next;
|
||||||
|
|
||||||
JS_ASSERT(jsdprop);
|
JS_ASSERT(jsdprop);
|
||||||
@@ -475,7 +475,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
JSAutoCompartment acBase(cx, jsdc->glob);
|
JSAutoCompartment acBase(cx, jsdc->glob);
|
||||||
JSDProperty* jsdprop;
|
JSDProperty* jsdprop;
|
||||||
JSDProperty* iter = NULL;
|
JSDProperty* iter = nullptr;
|
||||||
JS::RootedObject obj(cx);
|
JS::RootedObject obj(cx);
|
||||||
bool found;
|
bool found;
|
||||||
JS::RootedValue val(cx), nameval(cx);
|
JS::RootedValue val(cx), nameval(cx);
|
||||||
@@ -486,10 +486,10 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
uint8_t propFlags;
|
uint8_t propFlags;
|
||||||
|
|
||||||
if(!jsd_IsValueObject(jsdc, jsdval))
|
if(!jsd_IsValueObject(jsdc, jsdval))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* If we already have the prop, then return it */
|
/* If we already have the prop, then return it */
|
||||||
while(NULL != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter)))
|
while(nullptr != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter)))
|
||||||
{
|
{
|
||||||
JSString* propName = jsd_GetValueString(jsdc, jsdprop->name);
|
JSString* propName = jsd_GetValueString(jsdc, jsdprop->name);
|
||||||
if(propName) {
|
if(propName) {
|
||||||
@@ -503,10 +503,10 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
|
|
||||||
nameval = STRING_TO_JSVAL(name);
|
nameval = STRING_TO_JSVAL(name);
|
||||||
if(!JS_ValueToId(cx, nameval, nameid.address()))
|
if(!JS_ValueToId(cx, nameval, nameid.address()))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
|
if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
||||||
{
|
{
|
||||||
@@ -514,11 +514,11 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
JS::RootedId id(cx, nameid);
|
JS::RootedId id(cx, nameid);
|
||||||
|
|
||||||
if(!JS_WrapId(cx, id.address()))
|
if(!JS_WrapId(cx, id.address()))
|
||||||
return NULL;
|
return nullptr;
|
||||||
if(!JS_GetOwnPropertyDescriptorById(cx, obj, id, 0, &desc))
|
if(!JS_GetOwnPropertyDescriptorById(cx, obj, id, 0, &desc))
|
||||||
return NULL;
|
return nullptr;
|
||||||
if(!desc.object())
|
if(!desc.object())
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
JS_ClearPendingException(cx);
|
JS_ClearPendingException(cx);
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
{
|
{
|
||||||
if (!JS_GetPendingException(cx, &propValue))
|
if (!JS_GetPendingException(cx, &propValue))
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
propFlags = JSPD_EXCEPTION;
|
propFlags = JSPD_EXCEPTION;
|
||||||
}
|
}
|
||||||
@@ -545,7 +545,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_IdToValue(cx, nameid, propId.address()))
|
if (!JS_IdToValue(cx, nameid, propId.address()))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
propAlias = JSVAL_NULL;
|
propAlias = JSVAL_NULL;
|
||||||
propFlags |= desc.isEnumerable() ? JSPD_ENUMERATE : 0
|
propFlags |= desc.isEnumerable() ? JSPD_ENUMERATE : 0
|
||||||
@@ -568,7 +568,7 @@ jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
JS::RootedFunction fun(cx);
|
JS::RootedFunction fun(cx);
|
||||||
|
|
||||||
if (JSVAL_IS_PRIMITIVE(jsdval->val))
|
if (JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
obj = js::UncheckedUnwrap(JSVAL_TO_OBJECT(jsdval->val));
|
obj = js::UncheckedUnwrap(JSVAL_TO_OBJECT(jsdval->val));
|
||||||
JSAutoCompartment ac(cx, obj);
|
JSAutoCompartment ac(cx, obj);
|
||||||
@@ -588,12 +588,12 @@ jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
JS_ASSERT(!jsdval->proto);
|
JS_ASSERT(!jsdval->proto);
|
||||||
SET_BIT_FLAG(jsdval->flags, GOT_PROTO);
|
SET_BIT_FLAG(jsdval->flags, GOT_PROTO);
|
||||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||||
return NULL;
|
return nullptr;
|
||||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||||
if(!JS_GetPrototype(cx, obj, &proto))
|
if(!JS_GetPrototype(cx, obj, &proto))
|
||||||
return NULL;
|
return nullptr;
|
||||||
if(!proto)
|
if(!proto)
|
||||||
return NULL;
|
return nullptr;
|
||||||
jsdval->proto = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(proto));
|
jsdval->proto = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(proto));
|
||||||
}
|
}
|
||||||
if(jsdval->proto)
|
if(jsdval->proto)
|
||||||
@@ -612,14 +612,14 @@ jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
JS_ASSERT(!jsdval->parent);
|
JS_ASSERT(!jsdval->parent);
|
||||||
SET_BIT_FLAG(jsdval->flags, GOT_PARENT);
|
SET_BIT_FLAG(jsdval->flags, GOT_PARENT);
|
||||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||||
return NULL;
|
return nullptr;
|
||||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||||
{
|
{
|
||||||
JSAutoCompartment ac(cx, obj);
|
JSAutoCompartment ac(cx, obj);
|
||||||
parent = JS_GetParentOrScopeChain(cx, obj);
|
parent = JS_GetParentOrScopeChain(cx, obj);
|
||||||
}
|
}
|
||||||
if(!parent)
|
if(!parent)
|
||||||
return NULL;
|
return nullptr;
|
||||||
jsdval->parent = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(parent));
|
jsdval->parent = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(parent));
|
||||||
}
|
}
|
||||||
if(jsdval->parent)
|
if(jsdval->parent)
|
||||||
@@ -639,18 +639,18 @@ jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
JS_ASSERT(!jsdval->ctor);
|
JS_ASSERT(!jsdval->ctor);
|
||||||
SET_BIT_FLAG(jsdval->flags, GOT_CTOR);
|
SET_BIT_FLAG(jsdval->flags, GOT_CTOR);
|
||||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||||
return NULL;
|
return nullptr;
|
||||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||||
if(!JS_GetPrototype(cx, obj, &proto))
|
if(!JS_GetPrototype(cx, obj, &proto))
|
||||||
return NULL;
|
return nullptr;
|
||||||
if(!proto)
|
if(!proto)
|
||||||
return NULL;
|
return nullptr;
|
||||||
{
|
{
|
||||||
JSAutoCompartment ac(cx, obj);
|
JSAutoCompartment ac(cx, obj);
|
||||||
ctor = JS_GetConstructor(cx, proto);
|
ctor = JS_GetConstructor(cx, proto);
|
||||||
}
|
}
|
||||||
if(!ctor)
|
if(!ctor)
|
||||||
return NULL;
|
return nullptr;
|
||||||
jsdval->ctor = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(ctor));
|
jsdval->ctor = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(ctor));
|
||||||
}
|
}
|
||||||
if(jsdval->ctor)
|
if(jsdval->ctor)
|
||||||
@@ -677,12 +677,12 @@ jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
{
|
{
|
||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
JS::RootedValue val(cx, jsdval->val);
|
JS::RootedValue val(cx, jsdval->val);
|
||||||
JSFunction* fun = NULL;
|
JSFunction* fun = nullptr;
|
||||||
JS::RootedScript script(cx);
|
JS::RootedScript script(cx);
|
||||||
JSDScript* jsdscript;
|
JSDScript* jsdscript;
|
||||||
|
|
||||||
if (!jsd_IsValueFunction(jsdc, jsdval))
|
if (!jsd_IsValueFunction(jsdc, jsdval))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
{
|
{
|
||||||
JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(val));
|
JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(val));
|
||||||
@@ -693,7 +693,7 @@ jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!script)
|
if (!script)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
JSD_LOCK_SCRIPTS(jsdc);
|
JSD_LOCK_SCRIPTS(jsdc);
|
||||||
jsdscript = jsd_FindJSDScript(jsdc, script);
|
jsdscript = jsd_FindJSDScript(jsdc, script);
|
||||||
|
|||||||
@@ -975,7 +975,7 @@ jsdScript::CreatePPLineMap()
|
|||||||
{
|
{
|
||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
JSAutoCompartment ac(cx, JSD_GetDefaultGlobal (mCx)); // Just in case.
|
JSAutoCompartment ac(cx, JSD_GetDefaultGlobal (mCx)); // Just in case.
|
||||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
JS::RootedFunction fun(cx, JSD_GetJSFunction (mCx, mScript));
|
JS::RootedFunction fun(cx, JSD_GetJSFunction (mCx, mScript));
|
||||||
@@ -1142,7 +1142,7 @@ jsdScript::Invalidate()
|
|||||||
(JSD_GetScriptPrivate(mScript));
|
(JSD_GetScriptPrivate(mScript));
|
||||||
NS_ASSERTION (script == this, "That's not my script!");
|
NS_ASSERTION (script == this, "That's not my script!");
|
||||||
NS_RELEASE(script);
|
NS_RELEASE(script);
|
||||||
JSD_SetScriptPrivate(mScript, NULL);
|
JSD_SetScriptPrivate(mScript, nullptr);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1154,10 +1154,10 @@ jsdScript::InvalidateAll ()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
JSDScript *script;
|
JSDScript *script;
|
||||||
JSDScript *iter = NULL;
|
JSDScript *iter = nullptr;
|
||||||
|
|
||||||
JSD_LockScriptSubsystem(cx);
|
JSD_LockScriptSubsystem(cx);
|
||||||
while((script = JSD_IterateScripts(cx, &iter)) != NULL) {
|
while((script = JSD_IterateScripts(cx, &iter)) != nullptr) {
|
||||||
nsCOMPtr<jsdIScript> jsdis =
|
nsCOMPtr<jsdIScript> jsdis =
|
||||||
static_cast<jsdIScript *>(JSD_GetScriptPrivate(script));
|
static_cast<jsdIScript *>(JSD_GetScriptPrivate(script));
|
||||||
if (jsdis)
|
if (jsdis)
|
||||||
@@ -1460,7 +1460,8 @@ jsdScript::GetExecutableLines(uint32_t aPcmap, uint32_t aStartLine, uint32_t aMa
|
|||||||
uintptr_t end = JSD_GetClosestPC(mCx, mScript, lastLine + 1);
|
uintptr_t end = JSD_GetClosestPC(mCx, mScript, lastLine + 1);
|
||||||
|
|
||||||
*aExecutableLines = static_cast<uint32_t*>(NS_Alloc((end - start + 1) * sizeof(uint32_t)));
|
*aExecutableLines = static_cast<uint32_t*>(NS_Alloc((end - start + 1) * sizeof(uint32_t)));
|
||||||
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines, NULL))
|
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines,
|
||||||
|
nullptr))
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -1529,7 +1530,7 @@ jsdScript::SetBreakpoint(uint32_t aPC)
|
|||||||
{
|
{
|
||||||
ASSERT_VALID_EPHEMERAL;
|
ASSERT_VALID_EPHEMERAL;
|
||||||
uintptr_t pc = mFirstPC + aPC;
|
uintptr_t pc = mFirstPC + aPC;
|
||||||
JSD_SetExecutionHook (mCx, mScript, pc, jsds_ExecutionHookProc, NULL);
|
JSD_SetExecutionHook (mCx, mScript, pc, jsds_ExecutionHookProc, nullptr);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2269,7 +2270,7 @@ jsdValue::GetProperties (jsdIProperty ***propArray, uint32_t *length)
|
|||||||
NS_ENSURE_TRUE(pa_temp, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(pa_temp, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
JSDProperty *iter = NULL;
|
JSDProperty *iter = nullptr;
|
||||||
JSDProperty *prop;
|
JSDProperty *prop;
|
||||||
while ((prop = JSD_IterateProperties (mCx, mValue, &iter))) {
|
while ((prop = JSD_IterateProperties (mCx, mValue, &iter))) {
|
||||||
pa_temp[i] = jsdProperty::FromPtr (mCx, prop);
|
pa_temp[i] = jsdProperty::FromPtr (mCx, prop);
|
||||||
@@ -2441,8 +2442,8 @@ jsdService::DeactivateDebugger ()
|
|||||||
jsdStackFrame::InvalidateAll();
|
jsdStackFrame::InvalidateAll();
|
||||||
ClearAllBreakpoints();
|
ClearAllBreakpoints();
|
||||||
|
|
||||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||||
JSD_SetScriptHook (mCx, NULL, NULL);
|
JSD_SetScriptHook (mCx, nullptr, nullptr);
|
||||||
JSD_ClearThrowHook (mCx);
|
JSD_ClearThrowHook (mCx);
|
||||||
JSD_ClearInterruptHook (mCx);
|
JSD_ClearInterruptHook (mCx);
|
||||||
JSD_ClearDebuggerHook (mCx);
|
JSD_ClearDebuggerHook (mCx);
|
||||||
@@ -2472,7 +2473,7 @@ jsdService::ActivateDebugger (JSRuntime *rt)
|
|||||||
/* condition indicates that the callback proc has not been set yet */
|
/* condition indicates that the callback proc has not been set yet */
|
||||||
gPrevGCSliceCallback = JS::SetGCSliceCallback (rt, jsds_GCSliceCallbackProc);
|
gPrevGCSliceCallback = JS::SetGCSliceCallback (rt, jsds_GCSliceCallbackProc);
|
||||||
|
|
||||||
mCx = JSD_DebuggerOnForUser (rt, NULL, NULL);
|
mCx = JSD_DebuggerOnForUser (rt, nullptr, nullptr);
|
||||||
if (!mCx)
|
if (!mCx)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@@ -2492,29 +2493,29 @@ jsdService::ActivateDebugger (JSRuntime *rt)
|
|||||||
/* Start watching for script creation/destruction and manage jsdScript
|
/* Start watching for script creation/destruction and manage jsdScript
|
||||||
* objects accordingly
|
* objects accordingly
|
||||||
*/
|
*/
|
||||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL);
|
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, nullptr);
|
||||||
|
|
||||||
/* If any of these mFooHook objects are installed, do the required JSD
|
/* If any of these mFooHook objects are installed, do the required JSD
|
||||||
* hookup now. See also, jsdService::SetFooHook().
|
* hookup now. See also, jsdService::SetFooHook().
|
||||||
*/
|
*/
|
||||||
if (mErrorHook)
|
if (mErrorHook)
|
||||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||||
if (mThrowHook)
|
if (mThrowHook)
|
||||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
/* can't ignore script callbacks, as we need to |Release| the wrapper
|
/* can't ignore script callbacks, as we need to |Release| the wrapper
|
||||||
* stored in private data when a script is deleted. */
|
* stored in private data when a script is deleted. */
|
||||||
if (mInterruptHook)
|
if (mInterruptHook)
|
||||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mDebuggerHook)
|
if (mDebuggerHook)
|
||||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mDebugHook)
|
if (mDebugHook)
|
||||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mTopLevelHook)
|
if (mTopLevelHook)
|
||||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearTopLevelHook (mCx);
|
JSD_ClearTopLevelHook (mCx);
|
||||||
if (mFunctionHook)
|
if (mFunctionHook)
|
||||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearFunctionHook (mCx);
|
JSD_ClearFunctionHook (mCx);
|
||||||
mOn = true;
|
mOn = true;
|
||||||
@@ -2585,7 +2586,7 @@ jsdService::DoPause(uint32_t *_rval, bool internalCall)
|
|||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
if (++mPauseLevel == 1) {
|
if (++mPauseLevel == 1) {
|
||||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||||
JSD_ClearThrowHook (mCx);
|
JSD_ClearThrowHook (mCx);
|
||||||
JSD_ClearInterruptHook (mCx);
|
JSD_ClearInterruptHook (mCx);
|
||||||
JSD_ClearDebuggerHook (mCx);
|
JSD_ClearDebuggerHook (mCx);
|
||||||
@@ -2631,21 +2632,21 @@ jsdService::DoUnPause(uint32_t *_rval, bool internalCall)
|
|||||||
if (--mPauseLevel == 0 && mOn) {
|
if (--mPauseLevel == 0 && mOn) {
|
||||||
JSD_DebuggerUnpause (mCx);
|
JSD_DebuggerUnpause (mCx);
|
||||||
if (mErrorHook)
|
if (mErrorHook)
|
||||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||||
if (mThrowHook)
|
if (mThrowHook)
|
||||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mInterruptHook)
|
if (mInterruptHook)
|
||||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mDebuggerHook)
|
if (mDebuggerHook)
|
||||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mDebugHook)
|
if (mDebugHook)
|
||||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
if (mTopLevelHook)
|
if (mTopLevelHook)
|
||||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearTopLevelHook (mCx);
|
JSD_ClearTopLevelHook (mCx);
|
||||||
if (mFunctionHook)
|
if (mFunctionHook)
|
||||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearFunctionHook (mCx);
|
JSD_ClearFunctionHook (mCx);
|
||||||
|
|
||||||
@@ -2673,7 +2674,7 @@ jsdService::EnumerateContexts (jsdIContextEnumerator *enumerator)
|
|||||||
if (!enumerator)
|
if (!enumerator)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
JSContext *iter = NULL;
|
JSContext *iter = nullptr;
|
||||||
JSContext *cx;
|
JSContext *cx;
|
||||||
|
|
||||||
while ((cx = JS_ContextIterator (mRuntime, &iter)))
|
while ((cx = JS_ContextIterator (mRuntime, &iter)))
|
||||||
@@ -2696,7 +2697,7 @@ jsdService::EnumerateScripts (jsdIScriptEnumerator *enumerator)
|
|||||||
ASSERT_VALID_CONTEXT;
|
ASSERT_VALID_CONTEXT;
|
||||||
|
|
||||||
JSDScript *script;
|
JSDScript *script;
|
||||||
JSDScript *iter = NULL;
|
JSDScript *iter = nullptr;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
JSD_LockScriptSubsystem(mCx);
|
JSD_LockScriptSubsystem(mCx);
|
||||||
@@ -2733,7 +2734,8 @@ jsdService::DumpHeap(const nsACString &fileName)
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
if (!JS_DumpHeap(JS_GetRuntime(nsContentUtils::GetSafeJSContext()), file, NULL, JSTRACE_OBJECT, NULL, (size_t)-1, NULL))
|
if (!JS_DumpHeap(JS_GetRuntime(nsContentUtils::GetSafeJSContext()),
|
||||||
|
file, nullptr, JSTRACE_OBJECT, nullptr, (size_t)-1, nullptr))
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
if (file != stdout)
|
if (file != stdout)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
@@ -3003,9 +3005,9 @@ jsdService::SetErrorHook (jsdIErrorHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -3047,7 +3049,7 @@ jsdService::SetDebugHook (jsdIExecutionHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearDebugBreakHook (mCx);
|
JSD_ClearDebugBreakHook (mCx);
|
||||||
|
|
||||||
@@ -3075,7 +3077,7 @@ jsdService::SetDebuggerHook (jsdIExecutionHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearDebuggerHook (mCx);
|
JSD_ClearDebuggerHook (mCx);
|
||||||
|
|
||||||
@@ -3103,7 +3105,7 @@ jsdService::SetInterruptHook (jsdIExecutionHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearInterruptHook (mCx);
|
JSD_ClearInterruptHook (mCx);
|
||||||
|
|
||||||
@@ -3131,7 +3133,7 @@ jsdService::SetScriptHook (jsdIScriptHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL);
|
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, nullptr);
|
||||||
/* we can't unset it if !aHook, because we still need to see script
|
/* we can't unset it if !aHook, because we still need to see script
|
||||||
* deletes in order to Release the jsdIScripts held in JSDScript
|
* deletes in order to Release the jsdIScripts held in JSDScript
|
||||||
* private data. */
|
* private data. */
|
||||||
@@ -3159,7 +3161,7 @@ jsdService::SetThrowHook (jsdIExecutionHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearThrowHook (mCx);
|
JSD_ClearThrowHook (mCx);
|
||||||
|
|
||||||
@@ -3187,7 +3189,7 @@ jsdService::SetTopLevelHook (jsdICallHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearTopLevelHook (mCx);
|
JSD_ClearTopLevelHook (mCx);
|
||||||
|
|
||||||
@@ -3215,7 +3217,7 @@ jsdService::SetFunctionHook (jsdICallHook *aHook)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (aHook)
|
if (aHook)
|
||||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||||
else
|
else
|
||||||
JSD_ClearFunctionHook (mCx);
|
JSD_ClearFunctionHook (mCx);
|
||||||
|
|
||||||
@@ -3313,15 +3315,15 @@ NS_DEFINE_NAMED_CID(JSDSERVICE_CID);
|
|||||||
NS_DEFINE_NAMED_CID(JSDASO_CID);
|
NS_DEFINE_NAMED_CID(JSDASO_CID);
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kJSDCIDs[] = {
|
static const mozilla::Module::CIDEntry kJSDCIDs[] = {
|
||||||
{ &kJSDSERVICE_CID, false, NULL, jsdServiceConstructor },
|
{ &kJSDSERVICE_CID, false, nullptr, jsdServiceConstructor },
|
||||||
{ &kJSDASO_CID, false, NULL, jsdASObserverConstructor },
|
{ &kJSDASO_CID, false, nullptr, jsdASObserverConstructor },
|
||||||
{ NULL }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kJSDContracts[] = {
|
static const mozilla::Module::ContractIDEntry kJSDContracts[] = {
|
||||||
{ jsdServiceCtrID, &kJSDSERVICE_CID },
|
{ jsdServiceCtrID, &kJSDSERVICE_CID },
|
||||||
{ jsdARObserverCtrID, &kJSDASO_CID },
|
{ jsdARObserverCtrID, &kJSDASO_CID },
|
||||||
{ NULL }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const mozilla::Module kJSDModule = {
|
static const mozilla::Module kJSDModule = {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ JSD_DebuggerOnForUser(JSRuntime* jsrt,
|
|||||||
JSD_UserCallbacks* callbacks,
|
JSD_UserCallbacks* callbacks,
|
||||||
void* user)
|
void* user)
|
||||||
{
|
{
|
||||||
return jsd_DebuggerOnForUser(jsrt, callbacks, user, NULL);
|
return jsd_DebuggerOnForUser(jsrt, callbacks, user, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSD_PUBLIC_API(JSDContext*)
|
JSD_PUBLIC_API(JSDContext*)
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ JSD_SetUserCallbacks(JSRuntime* jsrt,
|
|||||||
/*
|
/*
|
||||||
* Startup JSD.
|
* Startup JSD.
|
||||||
* This version of the init function requires that JSD_SetUserCallbacks()
|
* This version of the init function requires that JSD_SetUserCallbacks()
|
||||||
* has been previously called (with a non-NULL callback struct pointer)
|
* has been previously called (with a non-nullptr callback struct pointer)
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDContext*)
|
extern JSD_PUBLIC_API(JSDContext*)
|
||||||
JSD_DebuggerOn(void);
|
JSD_DebuggerOn(void);
|
||||||
@@ -262,15 +262,15 @@ JSD_UnlockScriptSubsystem(JSDContext* jsdc);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Iterate through all the active scripts for this JSDContext.
|
* Iterate through all the active scripts for this JSDContext.
|
||||||
* NOTE: must initialize iterp to NULL to start iteration.
|
* NOTE: must initialize iterp to nullptr to start iteration.
|
||||||
* NOTE: must lock and unlock the subsystem
|
* NOTE: must lock and unlock the subsystem
|
||||||
* example:
|
* example:
|
||||||
*
|
*
|
||||||
* JSDScript jsdscript;
|
* JSDScript jsdscript;
|
||||||
* JSDScript iter = NULL;
|
* JSDScript iter = nullptr;
|
||||||
*
|
*
|
||||||
* JSD_LockScriptSubsystem(jsdc);
|
* JSD_LockScriptSubsystem(jsdc);
|
||||||
* while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != NULL) {
|
* while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != nullptr) {
|
||||||
* *** use jsdscript here ***
|
* *** use jsdscript here ***
|
||||||
* }
|
* }
|
||||||
* JSD_UnlockScriptSubsystem(jsdc);
|
* JSD_UnlockScriptSubsystem(jsdc);
|
||||||
@@ -395,8 +395,9 @@ extern JSD_PUBLIC_API(const char*)
|
|||||||
JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
|
JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the function name associated with this script (NULL if not a function).
|
* Get the function name associated with this script (nullptr if not a
|
||||||
* If the function does not have a name the result is the string "anonymous".
|
* function). If the function does not have a name the result is the
|
||||||
|
* string "anonymous".
|
||||||
* *** new for gecko 2.0 ****
|
* *** new for gecko 2.0 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSString *)
|
extern JSD_PUBLIC_API(JSString *)
|
||||||
@@ -464,9 +465,9 @@ JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a list of lines and the corresponding earliest PC for each (see
|
* Get a list of lines and the corresponding earliest PC for each (see
|
||||||
* JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL
|
* JSD_GetClosestPC). Lines with no PCs associated will not be returned.
|
||||||
* may be passed for either lines or pcs to avoid filling anything in for that
|
* nullptr may be passed for either lines or pcs to avoid filling anything in
|
||||||
* argument.
|
* for that argument.
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(bool)
|
extern JSD_PUBLIC_API(bool)
|
||||||
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||||
@@ -557,7 +558,7 @@ JSD_IterateSources(JSDContext* jsdc, JSDSourceText **iterp);
|
|||||||
/*
|
/*
|
||||||
* Find the source text item for the given URL (or filename - or whatever
|
* Find the source text item for the given URL (or filename - or whatever
|
||||||
* string the given embedding uses to describe source locations).
|
* string the given embedding uses to describe source locations).
|
||||||
* Returns NULL is not found.
|
* Returns nullptr if not found.
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||||
JSD_FindSourceForURL(JSDContext* jsdc, const char* url);
|
JSD_FindSourceForURL(JSDContext* jsdc, const char* url);
|
||||||
@@ -639,7 +640,7 @@ JSD_DestroyAllSources( JSDContext* jsdc );
|
|||||||
/*
|
/*
|
||||||
* Add a new item for a given URL. If an item already exists for the given URL
|
* Add a new item for a given URL. If an item already exists for the given URL
|
||||||
* then the old item is removed.
|
* then the old item is removed.
|
||||||
* 'url' may not be NULL.
|
* 'url' may not be nullptr.
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||||
JSD_NewSourceText(JSDContext* jsdc, const char* url);
|
JSD_NewSourceText(JSDContext* jsdc, const char* url);
|
||||||
@@ -647,8 +648,9 @@ JSD_NewSourceText(JSDContext* jsdc, const char* url);
|
|||||||
/*
|
/*
|
||||||
* Append text (or change status -- e.g. set completed) for a source text
|
* Append text (or change status -- e.g. set completed) for a source text
|
||||||
* item. Text need not be zero terminated. Callers should consider the returned
|
* item. Text need not be zero terminated. Callers should consider the returned
|
||||||
* JSDSourceText to be the 'current' item for future use. This may return NULL
|
* JSDSourceText to be the 'current' item for future use. This may return
|
||||||
* if called after this item has been replaced by a call to JSD_NewSourceText.
|
* nullptr if called after this item has been replaced by a call to
|
||||||
|
* JSD_NewSourceText.
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||||
JSD_AppendSourceText(JSDContext* jsdc,
|
JSD_AppendSourceText(JSDContext* jsdc,
|
||||||
@@ -681,7 +683,7 @@ JSD_AppendUCSourceText(JSDContext* jsdc,
|
|||||||
* text, length, JSD_SOURCE_PARTIAL);
|
* text, length, JSD_SOURCE_PARTIAL);
|
||||||
* if(jsdsrc)
|
* if(jsdsrc)
|
||||||
* jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
* jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
||||||
* NULL, 0, JSD_SOURCE_COMPLETED);
|
* nullptr, 0, JSD_SOURCE_COMPLETED);
|
||||||
* JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
* JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||||
* return jsdsrc ? true : false;
|
* return jsdsrc ? true : false;
|
||||||
*/
|
*/
|
||||||
@@ -1016,8 +1018,8 @@ JSD_ValToStringInStackFrame(JSDContext* jsdc,
|
|||||||
JS::Value val);
|
JS::Value val);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the JSDValue currently being thrown as an exception (may be NULL).
|
* Get the JSDValue currently being thrown as an exception (may be nullptr).
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1129,7 +1131,7 @@ JSD_CurrentThread();
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new JSDValue to wrap the given JS::Value
|
* Create a new JSDValue to wrap the given JS::Value
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1308,7 +1310,7 @@ JSD_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the JSDProperty for the property of this JSDVal with this name.
|
* Get the JSDProperty for the property of this JSDVal with this name.
|
||||||
* NOTE: must eventually release by calling JSD_DropProperty (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropProperty (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDProperty*)
|
extern JSD_PUBLIC_API(JSDProperty*)
|
||||||
@@ -1316,7 +1318,7 @@ JSD_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the prototype object for this JSDValue.
|
* Get the prototype object for this JSDValue.
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1324,7 +1326,7 @@ JSD_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the parent object for this JSDValue.
|
* Get the parent object for this JSDValue.
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1332,7 +1334,7 @@ JSD_GetValueParent(JSDContext* jsdc, JSDValue* jsdval);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the ctor object for this JSDValue (or likely its prototype's ctor).
|
* Get the ctor object for this JSDValue (or likely its prototype's ctor).
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1386,7 +1388,7 @@ JSD_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the JSDValue represeting the current value of this property
|
* Get the JSDValue represeting the current value of this property
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1394,7 +1396,7 @@ JSD_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the JSDValue represeting the alias of this property (if JSDPD_ALIAS set)
|
* Get the JSDValue represeting the alias of this property (if JSDPD_ALIAS set)
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
@@ -1455,7 +1457,7 @@ JSD_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the URL of the line of source that caused this object to be created.
|
* Get the URL of the line of source that caused this object to be created.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(const char*)
|
extern JSD_PUBLIC_API(const char*)
|
||||||
@@ -1471,7 +1473,7 @@ JSD_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the URL of the line of source of the constructor for this object.
|
* Get the URL of the line of source of the constructor for this object.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(const char*)
|
extern JSD_PUBLIC_API(const char*)
|
||||||
@@ -1487,7 +1489,7 @@ JSD_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the name of the constructor for this object.
|
* Get the name of the constructor for this object.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(const char*)
|
extern JSD_PUBLIC_API(const char*)
|
||||||
@@ -1495,7 +1497,7 @@ JSD_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get JSDObject representing this JSObject.
|
* Get JSDObject representing this JSObject.
|
||||||
* May return NULL.
|
* May return nullptr.
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDObject*)
|
extern JSD_PUBLIC_API(JSDObject*)
|
||||||
@@ -1503,7 +1505,7 @@ JSD_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get JSDObject representing this JSDValue.
|
* Get JSDObject representing this JSDValue.
|
||||||
* May return NULL.
|
* May return nullptr.
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDObject*)
|
extern JSD_PUBLIC_API(JSDObject*)
|
||||||
@@ -1511,7 +1513,7 @@ JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a JSDValue to wrap (and root) this JSDObject.
|
* Create a JSDValue to wrap (and root) this JSDObject.
|
||||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||||
* *** new for version 1.1 ****
|
* *** new for version 1.1 ****
|
||||||
*/
|
*/
|
||||||
extern JSD_PUBLIC_API(JSDValue*)
|
extern JSD_PUBLIC_API(JSDValue*)
|
||||||
|
|||||||
@@ -82,14 +82,14 @@ JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
|
|||||||
} else {
|
} else {
|
||||||
n = CeilingLog2Size(n);
|
n = CeilingLog2Size(n);
|
||||||
if (int32_t(n) < 0)
|
if (int32_t(n) < 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allocOps) allocOps = &defaultHashAllocOps;
|
if (!allocOps) allocOps = &defaultHashAllocOps;
|
||||||
|
|
||||||
ht = (JSHashTable*) allocOps->allocTable(allocPriv, sizeof *ht);
|
ht = (JSHashTable*) allocOps->allocTable(allocPriv, sizeof *ht);
|
||||||
if (!ht)
|
if (!ht)
|
||||||
return NULL;
|
return nullptr;
|
||||||
memset(ht, 0, sizeof *ht);
|
memset(ht, 0, sizeof *ht);
|
||||||
ht->shift = JS_HASH_BITS - n;
|
ht->shift = JS_HASH_BITS - n;
|
||||||
n = JS_BIT(n);
|
n = JS_BIT(n);
|
||||||
@@ -97,7 +97,7 @@ JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
|
|||||||
ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb);
|
ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb);
|
||||||
if (!ht->buckets) {
|
if (!ht->buckets) {
|
||||||
allocOps->freeTable(allocPriv, ht, nb);
|
allocOps->freeTable(allocPriv, ht, nb);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
memset(ht->buckets, 0, nb);
|
memset(ht->buckets, 0, nb);
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ JS_HashTableDestroy(JSHashTable *ht)
|
|||||||
n = NBUCKETS(ht);
|
n = NBUCKETS(ht);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
hep = &ht->buckets[i];
|
hep = &ht->buckets[i];
|
||||||
while ((he = *hep) != NULL) {
|
while ((he = *hep) != nullptr) {
|
||||||
*hep = he->next;
|
*hep = he->next;
|
||||||
allocOps->freeEntry(allocPriv, he, HT_FREE_ENTRY);
|
allocOps->freeEntry(allocPriv, he, HT_FREE_ENTRY);
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
|
|||||||
ht->nlookups++;
|
ht->nlookups++;
|
||||||
#endif
|
#endif
|
||||||
hep = hep0 = BUCKET_HEAD(ht, keyHash);
|
hep = hep0 = BUCKET_HEAD(ht, keyHash);
|
||||||
while ((he = *hep) != NULL) {
|
while ((he = *hep) != nullptr) {
|
||||||
if (he->keyHash == keyHash && ht->keyCompare(key, he->key)) {
|
if (he->keyHash == keyHash && ht->keyCompare(key, he->key)) {
|
||||||
/* Move to front of chain if not already there */
|
/* Move to front of chain if not already there */
|
||||||
if (hep != hep0) {
|
if (hep != hep0) {
|
||||||
@@ -208,7 +208,7 @@ Resize(JSHashTable *ht, uint32_t newshift)
|
|||||||
*/
|
*/
|
||||||
while (*hep)
|
while (*hep)
|
||||||
hep = &(*hep)->next;
|
hep = &(*hep)->next;
|
||||||
he->next = NULL;
|
he->next = nullptr;
|
||||||
*hep = he;
|
*hep = he;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep,
|
|||||||
n = NBUCKETS(ht);
|
n = NBUCKETS(ht);
|
||||||
if (ht->nentries >= OVERLOADED(n)) {
|
if (ht->nentries >= OVERLOADED(n)) {
|
||||||
if (!Resize(ht, ht->shift - 1))
|
if (!Resize(ht, ht->shift - 1))
|
||||||
return NULL;
|
return nullptr;
|
||||||
#ifdef JS_HASHMETER
|
#ifdef JS_HASHMETER
|
||||||
ht->ngrows++;
|
ht->ngrows++;
|
||||||
#endif
|
#endif
|
||||||
@@ -241,7 +241,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep,
|
|||||||
/* Make a new key value entry */
|
/* Make a new key value entry */
|
||||||
he = ht->allocOps->allocEntry(ht->allocPriv, key);
|
he = ht->allocOps->allocEntry(ht->allocPriv, key);
|
||||||
if (!he)
|
if (!he)
|
||||||
return NULL;
|
return nullptr;
|
||||||
he->keyHash = keyHash;
|
he->keyHash = keyHash;
|
||||||
he->key = key;
|
he->key = key;
|
||||||
he->value = value;
|
he->value = value;
|
||||||
@@ -259,7 +259,7 @@ JS_HashTableAdd(JSHashTable *ht, const void *key, void *value)
|
|||||||
|
|
||||||
keyHash = ht->keyHash(key);
|
keyHash = ht->keyHash(key);
|
||||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||||
if ((he = *hep) != NULL) {
|
if ((he = *hep) != nullptr) {
|
||||||
/* Hit; see if values match */
|
/* Hit; see if values match */
|
||||||
if (ht->valueCompare(he->value, value)) {
|
if (ht->valueCompare(he->value, value)) {
|
||||||
/* key,value pair is already present in table */
|
/* key,value pair is already present in table */
|
||||||
@@ -299,7 +299,7 @@ JS_HashTableRemove(JSHashTable *ht, const void *key)
|
|||||||
|
|
||||||
keyHash = ht->keyHash(key);
|
keyHash = ht->keyHash(key);
|
||||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||||
if ((he = *hep) == NULL)
|
if ((he = *hep) == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Hit; remove element */
|
/* Hit; remove element */
|
||||||
@@ -315,10 +315,10 @@ JS_HashTableLookup(JSHashTable *ht, const void *key)
|
|||||||
|
|
||||||
keyHash = ht->keyHash(key);
|
keyHash = ht->keyHash(key);
|
||||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||||
if ((he = *hep) != NULL) {
|
if ((he = *hep) != nullptr) {
|
||||||
return he->value;
|
return he->value;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -337,7 +337,7 @@ JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg)
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (bucket = ht->buckets; n != nlimit; ++bucket) {
|
for (bucket = ht->buckets; n != nlimit; ++bucket) {
|
||||||
hep = bucket;
|
hep = bucket;
|
||||||
while ((he = *hep) != NULL) {
|
while ((he = *hep) != nullptr) {
|
||||||
JS_ASSERT(n < nlimit);
|
JS_ASSERT(n < nlimit);
|
||||||
rv = f(he, n, arg);
|
rv = f(he, n, arg);
|
||||||
n++;
|
n++;
|
||||||
|
|||||||
Reference in New Issue
Block a user