зеркало из https://github.com/mozilla/gecko-dev.git
Bug 832385 - Always NS_DROP_JS_OBJECTS in ~IDBWrapperCache. r=smaug,khuey a=tef+
This commit is contained in:
Родитель
37c71124f0
Коммит
2a79d71a5e
|
@ -2198,8 +2198,6 @@ private:
|
|||
static nsILineBreaker* sLineBreaker;
|
||||
static nsIWordBreaker* sWordBreaker;
|
||||
|
||||
static uint32_t sJSGCThingRootCount;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
static nsIBidiKeyboard* sBidiKeyboard;
|
||||
#endif
|
||||
|
|
|
@ -210,7 +210,6 @@ nsIContentPolicy *nsContentUtils::sContentPolicyService;
|
|||
bool nsContentUtils::sTriedToGetContentPolicy = false;
|
||||
nsILineBreaker *nsContentUtils::sLineBreaker;
|
||||
nsIWordBreaker *nsContentUtils::sWordBreaker;
|
||||
uint32_t nsContentUtils::sJSGCThingRootCount;
|
||||
#ifdef IBMBIDI
|
||||
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
|
||||
#endif
|
||||
|
@ -4574,28 +4573,18 @@ nsContentUtils::HoldJSObjects(void* aScriptObjectHolder,
|
|||
{
|
||||
NS_ENSURE_TRUE(sXPConnect, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsresult rv = sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (sJSGCThingRootCount++ == 0) {
|
||||
nsLayoutStatics::AddRef();
|
||||
}
|
||||
NS_LOG_ADDREF(sXPConnect, sJSGCThingRootCount, "HoldJSObjects",
|
||||
sizeof(void*));
|
||||
|
||||
return NS_OK;
|
||||
return sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::DropJSObjects(void* aScriptObjectHolder)
|
||||
{
|
||||
NS_LOG_RELEASE(sXPConnect, sJSGCThingRootCount - 1, "HoldJSObjects");
|
||||
nsresult rv = sXPConnect->RemoveJSHolder(aScriptObjectHolder);
|
||||
if (--sJSGCThingRootCount == 0) {
|
||||
nsLayoutStatics::Release();
|
||||
if (!sXPConnect) {
|
||||
return NS_OK;
|
||||
}
|
||||
return rv;
|
||||
|
||||
return sXPConnect->RemoveJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -40,9 +40,9 @@ NS_IMPL_RELEASE_INHERITED(IDBWrapperCache, nsDOMEventTargetHelper)
|
|||
|
||||
IDBWrapperCache::~IDBWrapperCache()
|
||||
{
|
||||
if (mScriptOwner) {
|
||||
NS_DROP_JS_OBJECTS(this, IDBWrapperCache);
|
||||
}
|
||||
mScriptOwner = nullptr;
|
||||
nsContentUtils::ReleaseWrapper(this, this);
|
||||
NS_DROP_JS_OBJECTS(this, IDBWrapperCache);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -251,7 +251,11 @@ nsresult
|
|||
XPCJSRuntime::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
|
||||
{
|
||||
MOZ_ASSERT(aTracer->Trace, "AddJSHolder needs a non-null Trace function");
|
||||
bool wasEmpty = mJSHolders.Count() == 0;
|
||||
mJSHolders.Put(aHolder, aTracer);
|
||||
if (wasEmpty && mJSHolders.Count() == 1) {
|
||||
nsLayoutStatics::AddRef();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -259,7 +263,11 @@ XPCJSRuntime::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
|
|||
nsresult
|
||||
XPCJSRuntime::RemoveJSHolder(void* aHolder)
|
||||
{
|
||||
bool hadOne = mJSHolders.Count() == 1;
|
||||
mJSHolders.Remove(aHolder);
|
||||
if (hadOne && mJSHolders.Count() == 0) {
|
||||
nsLayoutStatics::Release();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче