mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Follow-up for bug 608142: disallow sending between main and non-main thread only (r=orange). a=beta7+
This commit is contained in:
parent
94cd8b8073
commit
ca7f2d3b0b
@ -3071,7 +3071,7 @@ private:
|
||||
nsXPCWrappedJS* mRoot;
|
||||
nsXPCWrappedJS* mNext;
|
||||
nsISupports* mOuter; // only set in root
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
bool mMainThread;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -436,7 +436,7 @@ nsXPCWrappedJS::nsXPCWrappedJS(XPCCallContext& ccx,
|
||||
mRoot(root ? root : this),
|
||||
mNext(nsnull),
|
||||
mOuter(root ? nsnull : aOuter),
|
||||
mThread(do_GetCurrentThread())
|
||||
mMainThread(NS_IsMainThread())
|
||||
{
|
||||
#ifdef DEBUG_stats_jband
|
||||
static int count = 0;
|
||||
@ -571,8 +571,9 @@ nsXPCWrappedJS::CallMethod(PRUint16 methodIndex,
|
||||
{
|
||||
if(!IsValid())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
if (NS_GetCurrentThread() != mThread)
|
||||
if (NS_IsMainThread() != mMainThread) {
|
||||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
return GetClass()->CallMethod(this, methodIndex, info, params);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user