Bug 552686 JS_GetFrameThis seems to require a JSContext these days when it calls some xpconnect wrapper that gets a thisObject

r=jorendorff

--HG--
extra : rebase_source : 7db05ad444219ffd5dbb64a86ac7470aa8095ace
This commit is contained in:
timeless@mozdev.org 2010-05-25 04:11:47 +03:00
parent 7f52e9bfd0
commit 6ef8003e9c

View File

@ -120,6 +120,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
JS_INIT_CLIST(&jsdthreadstate->stack); JS_INIT_CLIST(&jsdthreadstate->stack);
jsdthreadstate->stackDepth = 0; jsdthreadstate->stackDepth = 0;
JS_BeginRequest(jsdthreadstate->context);
while( NULL != (fp = JS_FrameIterator(cx, &iter)) ) while( NULL != (fp = JS_FrameIterator(cx, &iter)) )
{ {
JSScript* script = JS_GetFrameScript(cx, fp); JSScript* script = JS_GetFrameScript(cx, fp);
@ -148,10 +149,12 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
*/ */
JS_INIT_CLIST(&jsdthreadstate->links); JS_INIT_CLIST(&jsdthreadstate->links);
jsd_DestroyThreadState(jsdc, jsdthreadstate); jsd_DestroyThreadState(jsdc, jsdthreadstate);
JS_EndRequest(jsdthreadstate->context);
return NULL; return NULL;
} }
} }
} }
JS_EndRequest(jsdthreadstate->context);
if (jsdthreadstate->stackDepth == 0) if (jsdthreadstate->stackDepth == 0)
{ {
@ -339,7 +342,9 @@ jsd_GetThisForStackFrame(JSDContext* jsdc,
if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
{ {
JS_BeginRequest(jsdthreadstate->context);
obj = JS_GetFrameThis(jsdthreadstate->context, jsdframe->fp); obj = JS_GetFrameThis(jsdthreadstate->context, jsdframe->fp);
JS_EndRequest(jsdthreadstate->context);
if(obj) if(obj)
jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj)); jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj));
} }