mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Don't try to correlate scripts with functions in JSD interface, bug 707613. r=luke
This commit is contained in:
parent
1cacd2ead0
commit
9f939e2a4b
@ -187,7 +187,6 @@ struct JSDScript
|
||||
JSCList links; /* we are part of a JSCList */
|
||||
JSDContext* jsdc; /* JSDContext for this jsdscript */
|
||||
JSScript* script; /* script we are wrapping */
|
||||
JSFunction* function; /* back pointer to owning function (can be NULL) */
|
||||
uintN lineBase; /* we cache this */
|
||||
uintN lineExtent; /* we cache this */
|
||||
JSCList hooks; /* JSCList of JSDExecHooks for this script */
|
||||
|
@ -91,8 +91,7 @@ HasFileExtention(const char* name, const char* ext)
|
||||
static JSDScript*
|
||||
_newJSDScript(JSDContext* jsdc,
|
||||
JSContext *cx,
|
||||
JSScript *script,
|
||||
JSFunction* function)
|
||||
JSScript *script)
|
||||
{
|
||||
JSDScript* jsdscript;
|
||||
uintN lineno;
|
||||
@ -114,8 +113,7 @@ _newJSDScript(JSDContext* jsdc,
|
||||
JS_HashTableAdd(jsdc->scriptsTable, (void *)script, (void *)jsdscript);
|
||||
JS_APPEND_LINK(&jsdscript->links, &jsdc->scripts);
|
||||
jsdscript->jsdc = jsdc;
|
||||
jsdscript->script = script;
|
||||
jsdscript->function = function;
|
||||
jsdscript->script = script;
|
||||
jsdscript->lineBase = lineno;
|
||||
jsdscript->lineExtent = (uintN)NOT_SET_YET;
|
||||
jsdscript->data = NULL;
|
||||
@ -325,7 +323,7 @@ jsd_FindOrCreateJSDScript(JSDContext *jsdc,
|
||||
if (!fp)
|
||||
JS_FrameIterator(cx, &fp);
|
||||
if (fp)
|
||||
jsdscript = _newJSDScript(jsdc, cx, script, JS_GetFrameFunction(cx, fp));
|
||||
jsdscript = _newJSDScript(jsdc, cx, script);
|
||||
|
||||
return jsdscript;
|
||||
}
|
||||
@ -442,7 +440,7 @@ jsd_GetJSScript (JSDContext *jsdc, JSDScript *script)
|
||||
JSFunction *
|
||||
jsd_GetJSFunction (JSDContext *jsdc, JSDScript *script)
|
||||
{
|
||||
return script->function;
|
||||
return JS_GetScriptFunction(jsdc->dumbContext, script->script);
|
||||
}
|
||||
|
||||
JSDScript*
|
||||
@ -501,10 +499,11 @@ JSString*
|
||||
jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript)
|
||||
{
|
||||
JSString* str;
|
||||
JSFunction *fun = jsd_GetJSFunction(jsdc, jsdscript);
|
||||
|
||||
if( ! jsdscript->function )
|
||||
if( ! fun )
|
||||
return NULL;
|
||||
str = JS_GetFunctionId(jsdscript->function);
|
||||
str = JS_GetFunctionId(fun);
|
||||
|
||||
/* For compatibility we return "anonymous", not an empty string here. */
|
||||
return str ? str : JS_GetAnonymousString(jsdc->jsrt);
|
||||
@ -680,7 +679,7 @@ jsd_NewScriptHookProc(
|
||||
return;
|
||||
|
||||
JSD_LOCK_SCRIPTS(jsdc);
|
||||
jsdscript = _newJSDScript(jsdc, cx, script, fun);
|
||||
jsdscript = _newJSDScript(jsdc, cx, script);
|
||||
JSD_UNLOCK_SCRIPTS(jsdc);
|
||||
if( ! jsdscript )
|
||||
return;
|
||||
|
@ -632,6 +632,12 @@ JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fpArg)
|
||||
return &fp->callee();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSFunction *)
|
||||
JS_GetScriptFunction(JSContext *cx, JSScript *script)
|
||||
{
|
||||
return script->function();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
|
@ -276,6 +276,9 @@ JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
|
||||
|
||||
JS_PUBLIC_API(JSFunction *)
|
||||
JS_GetScriptFunction(JSContext *cx, JSScript *script);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user