bug 103804, "Venkman doesn't like stopping in timeouts", r=jband, sr=shaver

add callback to the enterNestedEventLoop method
This commit is contained in:
rginda%netscape.com 2001-10-10 06:35:46 +00:00
parent 452cb26ea3
commit 6c53ec4ba6
2 changed files with 23 additions and 3 deletions

View File

@ -53,6 +53,7 @@ native jsuword(jsuword);
/* interfaces we declare in this file */
interface jsdIDebuggerService;
interface jsdINestCallback;
interface jsdIScriptEnumerator;
interface jsdIScriptHook;
interface jsdIExecutionHook;
@ -166,14 +167,28 @@ interface jsdIDebuggerService : nsISupports
/**
* XXX temporary hacks
* These routines are used to nest and unnest UI event loops.
* These routines are used to nest and unnest UI and network event loops.
*/
unsigned long enterNestedEventLoop ();
unsigned long enterNestedEventLoop (in jsdINestCallback callback);
unsigned long exitNestedEventLoop ();
};
/* callback interfaces */
/**
* Pass an instance of one of these to jsdIDebuggerService::enterNestedEventLoop.
*/
[scriptable, uuid(88bea60f-9b5d-4b39-b08b-1c3a278782c6)]
interface jsdINestCallback : nsISupports
{
/**
* This method will be called after pre-nesting work has completed, such
* as pushing the js context and network event queue, but before the new
* event loop starts.
*/
void onNest ();
};
/**
* Pass an instance of one of these to jsdIDebuggerService::enumerateScripts.
*/

View File

@ -1322,7 +1322,7 @@ jsdService::ClearAllBreakpoints (void)
}
NS_IMETHODIMP
jsdService::EnterNestedEventLoop (PRUint32 *_rval)
jsdService::EnterNestedEventLoop (jsdINestCallback *callback, PRUint32 *_rval)
{
nsCOMPtr<nsIAppShell> appShell(do_CreateInstance(kAppShellCID));
NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
@ -1342,6 +1342,11 @@ jsdService::EnterNestedEventLoop (PRUint32 *_rval)
if (stack && NS_SUCCEEDED(stack->Push(nsnull)) &&
NS_SUCCEEDED(eventService->PushThreadEventQueue(getter_AddRefs(eventQ))))
{
if (NS_SUCCEEDED(rv) && callback)
{
rv = callback->OnNest();
}
while(NS_SUCCEEDED(rv) && mNestedLoopLevel >= nestLevel)
{
void* data;