add enumerateScripts() method to jsdIDebugger service
don't create a new debugger context if the user trys to call on[ForRuntime]() multiple times
This commit is contained in:
rginda%netscape.com 2001-05-21 07:18:10 +00:00
Родитель 219d5ecddc
Коммит d57c27e7a0
2 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -243,6 +243,13 @@ interface jsdIExecutionHook : nsISupports
in unsigned long type, inout jsdIValue val);
};
/* script enumeration callback */
[scriptable, uuid(4c2f706e-1dd2-11b2-9ebc-85a06e948830)]
interface jsdIScriptEnumerator : nsISupports
{
boolean enumerateScript (in jsdIScript script);
};
/* debugger service */
[scriptable, uuid(01be7f9a-1dd2-11b2-9d55-aaf919b27c73)]
interface jsdIDebuggerService : nsISupports
@ -258,6 +265,7 @@ interface jsdIDebuggerService : nsISupports
[noscript] void onForRuntime (in JSRuntime rt); /* native version of on() */
void off ();
void enumerateScripts (in jsdIScriptEnumerator enumerator);
void clearAllBreakpoints ();
/* XXX temporary hacks */

Просмотреть файл

@ -898,7 +898,8 @@ jsdService::OnForRuntime (JSRuntime *rt)
/* condition indicates that the callback proc has not been set yet */
gLastGCProc = JS_SetGCCallbackRT (rt, jsds_GCCallbackProc);
mCx = JSD_DebuggerOnForUser (rt, NULL, NULL);
if (!mOn)
mCx = JSD_DebuggerOnForUser (rt, NULL, NULL);
if (!mCx)
return NS_ERROR_FAILURE;
@ -911,10 +912,31 @@ NS_IMETHODIMP
jsdService::Off (void)
{
JSD_DebuggerOff (mCx);
mCx = 0;
mOn = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
jsdService::EnumerateScripts (jsdIScriptEnumerator *enumerator)
{
JSDScript *script;
JSDScript *iter = NULL;
PRBool cont_flag;
nsresult rv = NS_OK;
JSD_LockScriptSubsystem(mCx);
while((script = JSD_IterateScripts(mCx, &iter)) != NULL) {
rv = enumerator->EnumerateScript (jsdScript::FromPtr(mCx, script),
&cont_flag);
if (NS_FAILED(rv) || !cont_flag)
break;
}
JSD_UnlockScriptSubsystem(mCx);
return rv;
}
NS_IMETHODIMP
jsdService::ClearAllBreakpoints (void)
{