Fixing bug 414658. Make sure to not use a context from a different thread when calling functions on a wrapped JS object. r+sr=peterv@propagandism.org

This commit is contained in:
jst@mozilla.org 2008-01-29 15:56:49 -08:00
parent 30be9b9e5c
commit 58f7d84c76

View File

@ -516,7 +516,15 @@ GetContextFromObject(JSObject *obj)
XPCWrappedNativeScope* scope =
XPCWrappedNativeScope::FindInJSObjectScope(ccx, obj);
XPCContext *xpcc = scope->GetContext();
return xpcc ? xpcc->GetJSContext() : nsnull;
if(xpcc)
{
JSContext *cx = xpcc->GetJSContext();
if(cx->thread->id == js_CurrentThreadId())
return cx;
}
return nsnull;
}
NS_IMETHODIMP