mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 886408 - Move nsContentUtils::ReleaseWrapper into nsWrapperCache; r=mccr8
This commit is contained in:
parent
061d88874c
commit
62183dfe63
@ -1278,9 +1278,6 @@ public:
|
||||
mozilla::DeferredFinalizeFunction aFunc,
|
||||
void* aThing);
|
||||
|
||||
static void ReleaseWrapper(void* aScriptObjectHolder,
|
||||
nsWrapperCache* aCache);
|
||||
|
||||
/*
|
||||
* Notify when the first XUL menu is opened and when the all XUL menus are
|
||||
* closed. At opening, aInstalling should be TRUE, otherwise, it should be
|
||||
|
@ -989,7 +989,7 @@ FragmentOrElement::DestroyContent()
|
||||
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
nsContentUtils::ReleaseWrapper(this, this);
|
||||
ReleaseWrapper(this);
|
||||
|
||||
uint32_t i, count = mAttrsAndChildren.ChildCount();
|
||||
for (i = 0; i < count; ++i) {
|
||||
|
@ -6290,24 +6290,6 @@ nsContentUtils::IsInPointerLockContext(nsIDOMWindow* aWin)
|
||||
return top == lockTop;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsContentUtils::ReleaseWrapper(void* aScriptObjectHolder,
|
||||
nsWrapperCache* aCache)
|
||||
{
|
||||
if (aCache->PreservingWrapper()) {
|
||||
// PreserveWrapper puts new DOM bindings in the JS holders hash, but they
|
||||
// can also be in the DOM expando hash, so we need to try to remove them
|
||||
// from both here.
|
||||
JSObject* obj = aCache->GetWrapperPreserveColor();
|
||||
if (aCache->IsDOMBinding() && obj && js::IsProxy(obj)) {
|
||||
DOMProxyHandler::GetAndClearExpandoObject(obj);
|
||||
}
|
||||
aCache->SetPreservingWrapper(false);
|
||||
DropJSObjects(aScriptObjectHolder);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
int32_t
|
||||
nsContentUtils::GetAdjustedOffsetInTextControl(nsIFrame* aOffsetFrame,
|
||||
|
@ -7788,7 +7788,7 @@ nsDocument::Destroy()
|
||||
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
nsContentUtils::ReleaseWrapper(static_cast<nsINode*>(this), this);
|
||||
ReleaseWrapper(static_cast<nsINode*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -694,7 +694,7 @@ nsGenericDOMDataNode::DestroyContent()
|
||||
{
|
||||
// XXX We really should let cycle collection do this, but that currently still
|
||||
// leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
|
||||
nsContentUtils::ReleaseWrapper(this, this);
|
||||
ReleaseWrapper(this);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1254,9 +1254,9 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsINode::Unlink(nsINode *tmp)
|
||||
nsINode::Unlink(nsINode* tmp)
|
||||
{
|
||||
nsContentUtils::ReleaseWrapper(tmp, tmp);
|
||||
tmp->ReleaseWrapper(tmp);
|
||||
|
||||
nsSlots *slots = tmp->GetExistingSlots();
|
||||
if (slots) {
|
||||
|
@ -260,7 +260,7 @@ nsInProcessTabChildGlobal::DelayedDisconnect()
|
||||
}
|
||||
|
||||
if (!mLoadingScript) {
|
||||
nsContentUtils::ReleaseWrapper(static_cast<EventTarget*>(this), this);
|
||||
ReleaseWrapper(static_cast<EventTarget*>(this));
|
||||
mGlobal = nullptr;
|
||||
} else {
|
||||
mDelayedDisconnect = true;
|
||||
|
@ -260,7 +260,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
}
|
||||
}
|
||||
|
||||
nsContentUtils::ReleaseWrapper(aNode, aNode);
|
||||
aNode->ReleaseWrapper(aNode);
|
||||
}
|
||||
|
||||
struct MOZ_STACK_CLASS nsHandlerData
|
||||
|
@ -83,7 +83,7 @@ nsDOMEventTargetHelper::~nsDOMEventTargetHelper()
|
||||
if (mListenerManager) {
|
||||
mListenerManager->Disconnect();
|
||||
}
|
||||
nsContentUtils::ReleaseWrapper(this, this);
|
||||
ReleaseWrapper(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
||||
#include "jsproxy.h"
|
||||
#include "mozilla/dom/DOMJSProxyHandler.h"
|
||||
#include "nsCycleCollectionTraversalCallback.h"
|
||||
#include "nsCycleCollector.h"
|
||||
|
||||
@ -19,6 +21,22 @@ nsWrapperCache::HoldJSObjects(void* aScriptObjectHolder,
|
||||
cyclecollector::AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
}
|
||||
|
||||
void
|
||||
nsWrapperCache::ReleaseWrapper(void* aScriptObjectHolder)
|
||||
{
|
||||
if (PreservingWrapper()) {
|
||||
// PreserveWrapper puts new DOM bindings in the JS holders hash, but they
|
||||
// can also be in the DOM expando hash, so we need to try to remove them
|
||||
// from both here.
|
||||
JSObject* obj = GetWrapperPreserveColor();
|
||||
if (IsDOMBinding() && obj && js::IsProxy(obj)) {
|
||||
DOMProxyHandler::GetAndClearExpandoObject(obj);
|
||||
}
|
||||
SetPreservingWrapper(false);
|
||||
cyclecollector::RemoveJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
class DebugWrapperTraversalCallback : public nsCycleCollectionTraversalCallback
|
||||
|
@ -244,6 +244,8 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReleaseWrapper(void* aScriptObjectHolder);
|
||||
|
||||
private:
|
||||
JSObject *GetWrapperJSObject() const
|
||||
{
|
||||
@ -339,7 +341,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsWrapperCache, NS_WRAPPERCACHE_IID)
|
||||
tmp->TraceWrapper(aCallbacks, aClosure);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER \
|
||||
nsContentUtils::ReleaseWrapper(p, tmp);
|
||||
tmp->ReleaseWrapper(p);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_class) \
|
||||
|
@ -39,7 +39,7 @@ NS_IMPL_RELEASE_INHERITED(IDBWrapperCache, nsDOMEventTargetHelper)
|
||||
IDBWrapperCache::~IDBWrapperCache()
|
||||
{
|
||||
mScriptOwner = nullptr;
|
||||
nsContentUtils::ReleaseWrapper(this, this);
|
||||
ReleaseWrapper(this);
|
||||
NS_DROP_JS_OBJECTS(this, IDBWrapperCache);
|
||||
}
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMCSSStyleRule)
|
||||
// Unlink the wrapper for our declaraton. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
nsContentUtils::ReleaseWrapper(static_cast<nsISupports*>(p), tmp->DOMDeclaration());
|
||||
tmp->DOMDeclaration()->ReleaseWrapper(static_cast<nsISupports*>(p));
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMCSSStyleRule)
|
||||
|
@ -1760,7 +1760,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSFontFaceRule)
|
||||
// Unlink the wrapper for our declaraton. This just expands out
|
||||
// NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
|
||||
// directly because the wrapper is on the declaration, not on us.
|
||||
nsContentUtils::ReleaseWrapper(static_cast<nsISupports*>(p), &tmp->mDecl);
|
||||
tmp->mDecl.ReleaseWrapper(static_cast<nsISupports*>(p));
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCSSFontFaceRule)
|
||||
|
Loading…
Reference in New Issue
Block a user