mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 770840 - Add Runtime aborts when using XPCWrappedJS off-main-thread. v2
This commit is contained in:
parent
94b63dfc74
commit
e11b57da96
@ -11,6 +11,7 @@
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsCycleCollectorUtils.h"
|
||||
|
||||
// NOTE: much of the fancy footwork is done in xpcstubs.cpp
|
||||
|
||||
@ -150,6 +151,8 @@ nsXPCWrappedJS::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
nsrefcnt
|
||||
nsXPCWrappedJS::AddRef(void)
|
||||
{
|
||||
if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
MOZ_CRASH();
|
||||
nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt);
|
||||
NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this));
|
||||
|
||||
@ -164,6 +167,8 @@ nsXPCWrappedJS::AddRef(void)
|
||||
nsrefcnt
|
||||
nsXPCWrappedJS::Release(void)
|
||||
{
|
||||
if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
MOZ_CRASH();
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
|
||||
if (mMainThreadOnly && !NS_IsMainThread()) {
|
||||
@ -277,6 +282,10 @@ nsXPCWrappedJS::GetNewOrUsed(JSContext* cx,
|
||||
nsISupports* aOuter,
|
||||
nsXPCWrappedJS** wrapperResult)
|
||||
{
|
||||
// Do a release-mode assert against accessing nsXPCWrappedJS off-main-thread.
|
||||
if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
MOZ_CRASH();
|
||||
|
||||
JS::RootedObject jsObj(cx, aJSObj);
|
||||
JSObject2WrappedJSMap* map;
|
||||
nsXPCWrappedJS* root = nullptr;
|
||||
@ -559,6 +568,10 @@ nsXPCWrappedJS::CallMethod(uint16_t methodIndex,
|
||||
const XPTMethodDescriptor* info,
|
||||
nsXPTCMiniVariant* params)
|
||||
{
|
||||
// Do a release-mode assert against accessing nsXPCWrappedJS off-main-thread.
|
||||
if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
MOZ_CRASH();
|
||||
|
||||
if (!IsValid())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
if (NS_IsMainThread() != mMainThread) {
|
||||
|
Loading…
Reference in New Issue
Block a user