Bug 480765 - Scripts compiled before the debugger got activated cannot be debugged; r=timeless

This commit is contained in:
Wladimir Palant 2009-03-14 15:57:31 +01:00
parent 62f2faf9dd
commit 1806ebc45a
5 changed files with 35 additions and 7 deletions

View File

@ -389,6 +389,12 @@ extern JSDScript*
jsd_FindJSDScript(JSDContext* jsdc,
JSScript *script);
extern JSDScript*
jsd_FindOrCreateJSDScript(JSDContext *jsdc,
JSContext *cx,
JSScript *script,
JSStackFrame *fp);
extern JSDProfileData*
jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script);

View File

@ -66,7 +66,7 @@ jsd_InterruptHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rva
return JSTRAP_CONTINUE;
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSTRAP_CONTINUE;
@ -104,7 +104,7 @@ jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
return JSTRAP_CONTINUE;
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSTRAP_CONTINUE;
@ -138,7 +138,7 @@ jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
return JSD_HOOK_RETURN_CONTINUE_THROW;
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSD_HOOK_RETURN_CONTINUE_THROW;

View File

@ -205,7 +205,7 @@ jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
jsdobj->ctorURL = jsd_AddAtom(jsdc, ctorURL);
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, fp);
JSD_UNLOCK_SCRIPTS(jsdc);
if( jsdscript )
{

View File

@ -286,6 +286,28 @@ jsd_FindJSDScript( JSDContext* jsdc,
return (JSDScript*) JS_HashTableLookup(jsdc->scriptsTable, (void *)script);
}
JSDScript *
jsd_FindOrCreateJSDScript(JSDContext *jsdc,
JSContext *cx,
JSScript *script,
JSStackFrame *fp)
{
JSDScript *jsdscript;
JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc));
jsdscript = jsd_FindJSDScript(jsdc, script);
if (jsdscript)
return jsdscript;
// Fallback for unknown scripts: create a new script
if (!fp)
JS_FrameIterator(cx, &fp);
if (fp)
jsdscript = _newJSDScript(jsdc, cx, script, JS_GetFrameFunction(cx, fp));
return jsdscript;
}
JSDProfileData*
jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script)
{

View File

@ -76,7 +76,7 @@ _interpreterTrace(JSDContext* jsdc, JSContext *cx, JSStackFrame *fp,
if(script)
{
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, fp);
JSD_UNLOCK_SCRIPTS(jsdc);
if(jsdscript)
funName = JSD_GetScriptFunctionName(jsdc, jsdscript);
@ -136,7 +136,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSStackFrame *fp, JSBool before,
if (jsscript)
{
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, jsscript);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, jsscript, fp);
JSD_UNLOCK_SCRIPTS(jsdc);
if (jsdscript)