From f65e64b1b3d5180ddf78ebea325c811661cfbabc Mon Sep 17 00:00:00 2001 From: "jst@mozilla.org" Date: Tue, 29 Jan 2008 15:56:49 -0800 Subject: [PATCH] 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 --- js/src/xpconnect/src/xpcwrappedjsclass.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/src/xpconnect/src/xpcwrappedjsclass.cpp b/js/src/xpconnect/src/xpcwrappedjsclass.cpp index c0f1b921802..15993f1fc5a 100644 --- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp @@ -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