зеркало из https://github.com/mozilla/pjs.git
Fix for bug 678528 (Traverse mChildNodes (and consolidate node CC code)). r=jst.
This commit is contained in:
Родитель
a6f8e8d438
Коммит
5b5d8e7b5c
|
@ -1027,28 +1027,4 @@ public:
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
|
||||||
|
|
||||||
// Some cycle-collecting helper macros for nsIContent subclasses
|
|
||||||
|
|
||||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER \
|
|
||||||
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) { \
|
|
||||||
nsContentUtils::TraverseListenerManager(tmp, cb); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA \
|
|
||||||
if (tmp->HasProperties()) { \
|
|
||||||
nsNodeUtils::TraverseUserData(tmp, cb); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER \
|
|
||||||
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) { \
|
|
||||||
nsContentUtils::RemoveListenerManager(tmp); \
|
|
||||||
tmp->UnsetFlags(NODE_HAS_LISTENERMANAGER); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA \
|
|
||||||
if (tmp->HasProperties()) { \
|
|
||||||
nsNodeUtils::UnlinkUserData(tmp); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* nsIContent_h___ */
|
#endif /* nsIContent_h___ */
|
||||||
|
|
|
@ -801,6 +801,9 @@ public:
|
||||||
// putting a DestroySlots function on nsINode
|
// putting a DestroySlots function on nsINode
|
||||||
virtual ~nsSlots();
|
virtual ~nsSlots();
|
||||||
|
|
||||||
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||||
|
void Unlink();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of mutation observers
|
* A list of mutation observers
|
||||||
*/
|
*/
|
||||||
|
@ -1342,6 +1345,10 @@ protected:
|
||||||
#undef TOUCH_EVENT
|
#undef TOUCH_EVENT
|
||||||
#undef EVENT
|
#undef EVENT
|
||||||
|
|
||||||
|
static void Trace(nsINode *tmp, TraceCallback cb, void *closure);
|
||||||
|
static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
|
||||||
|
static void Unlink(nsINode *tmp);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> mNodeInfo;
|
nsCOMPtr<nsINodeInfo> mNodeInfo;
|
||||||
|
|
||||||
nsINode* mParent;
|
nsINode* mParent;
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsMutationEvent.h"
|
#include "nsMutationEvent.h"
|
||||||
#include "nsPLDOMEvent.h"
|
#include "nsPLDOMEvent.h"
|
||||||
#include "nsContentUtils.h" // NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
|
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
@ -105,25 +104,25 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMAttribute)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
|
||||||
|
if (!nsINode::Traverse(tmp, cb)) {
|
||||||
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mChild)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mChild)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMAttribute)
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMAttribute)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
nsINode::Trace(tmp, aCallback, aClosure);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
|
||||||
|
nsINode::Unlink(tmp);
|
||||||
if (tmp->mChild) {
|
if (tmp->mChild) {
|
||||||
static_cast<nsTextNode*>(tmp->mChild)->UnbindFromAttribute();
|
static_cast<nsTextNode*>(tmp->mChild)->UnbindFromAttribute();
|
||||||
NS_RELEASE(tmp->mChild);
|
NS_RELEASE(tmp->mChild);
|
||||||
tmp->mFirstChild = nsnull;
|
tmp->mFirstChild = nsnull;
|
||||||
}
|
}
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
DOMCI_NODE_DATA(Attr, nsDOMAttribute)
|
DOMCI_NODE_DATA(Attr, nsDOMAttribute)
|
||||||
|
|
|
@ -1825,7 +1825,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
||||||
// if we're uncollectable.
|
// if we're uncollectable.
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
|
|
||||||
if (nsCCUncollectableMarker::InGeneration(cb, tmp->GetMarkedCCGeneration())) {
|
if (!nsINode::Traverse(tmp, cb)) {
|
||||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,16 +1833,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
||||||
|
|
||||||
tmp->mExternalResourceMap.Traverse(&cb);
|
tmp->mExternalResourceMap.Traverse(&cb);
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
|
||||||
|
|
||||||
// Traverse the mChildren nsAttrAndChildArray.
|
// Traverse the mChildren nsAttrAndChildArray.
|
||||||
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()); indx > 0; --indx) {
|
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()); indx > 0; --indx) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildren[i]");
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildren[i]");
|
||||||
cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1));
|
cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
|
|
||||||
|
|
||||||
// Traverse all nsIDocument pointer members.
|
// Traverse all nsIDocument pointer members.
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedRootElement)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedRootElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSecurityInfo)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSecurityInfo)
|
||||||
|
@ -1901,7 +1897,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDocument)
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDocument)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
nsINode::Trace(tmp, aCallback, aClosure);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
|
|
||||||
|
@ -1913,6 +1909,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||||
|
|
||||||
nsAutoScriptBlocker scriptBlocker;
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
|
|
||||||
|
nsINode::Unlink(tmp);
|
||||||
|
|
||||||
// Unlink the mChildren nsAttrAndChildArray.
|
// Unlink the mChildren nsAttrAndChildArray.
|
||||||
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1;
|
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1;
|
||||||
indx >= 0; --indx) {
|
indx >= 0; --indx) {
|
||||||
|
@ -1930,9 +1928,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
|
||||||
|
|
||||||
tmp->mParentDocument = nsnull;
|
tmp->mParentDocument = nsnull;
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages)
|
||||||
|
|
|
@ -93,7 +93,7 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericDOMDataNode)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericDOMDataNode)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
nsINode::Trace(tmp, aCallback, aClosure);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
|
||||||
|
@ -101,28 +101,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
|
||||||
// if we're uncollectable.
|
// if we're uncollectable.
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
|
|
||||||
nsIDocument* currentDoc = tmp->GetCurrentDoc();
|
if (!nsINode::Traverse(tmp, cb)) {
|
||||||
if (currentDoc && nsCCUncollectableMarker::InGeneration(
|
|
||||||
cb, currentDoc->GetMarkedCCGeneration())) {
|
|
||||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
|
||||||
|
|
||||||
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
|
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
|
||||||
if (ownerDoc) {
|
if (ownerDoc) {
|
||||||
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
nsINode::Unlink(tmp);
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
|
NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
|
||||||
|
|
|
@ -174,6 +174,22 @@ nsINode::nsSlots::~nsSlots()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsINode::nsSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||||
|
{
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildNodes");
|
||||||
|
cb.NoteXPCOMChild(mChildNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsINode::nsSlots::Unlink()
|
||||||
|
{
|
||||||
|
if (mChildNodes) {
|
||||||
|
mChildNodes->DropReference();
|
||||||
|
NS_RELEASE(mChildNodes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
nsINode::~nsINode()
|
nsINode::~nsINode()
|
||||||
|
@ -1142,6 +1158,63 @@ nsINode::GetContextForEventHandlers(nsresult* aRv)
|
||||||
return nsContentUtils::GetContextForEventHandlers(this, aRv);
|
return nsContentUtils::GetContextForEventHandlers(this, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
void
|
||||||
|
nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
|
||||||
|
{
|
||||||
|
nsContentUtils::TraceWrapper(tmp, cb, closure);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
bool
|
||||||
|
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||||
|
{
|
||||||
|
nsIDocument *currentDoc = tmp->GetCurrentDoc();
|
||||||
|
if (currentDoc &&
|
||||||
|
nsCCUncollectableMarker::InGeneration(cb, currentDoc->GetMarkedCCGeneration())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
|
||||||
|
|
||||||
|
nsSlots *slots = tmp->GetExistingSlots();
|
||||||
|
if (slots) {
|
||||||
|
slots->Traverse(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp->HasProperties()) {
|
||||||
|
nsNodeUtils::TraverseUserData(tmp, cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||||
|
nsContentUtils::TraverseListenerManager(tmp, cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
void
|
||||||
|
nsINode::Unlink(nsINode *tmp)
|
||||||
|
{
|
||||||
|
nsContentUtils::ReleaseWrapper(tmp, tmp);
|
||||||
|
|
||||||
|
nsSlots *slots = tmp->GetExistingSlots();
|
||||||
|
if (slots) {
|
||||||
|
slots->Unlink();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||||
|
nsContentUtils::RemoveListenerManager(tmp);
|
||||||
|
tmp->UnsetFlags(NODE_HAS_LISTENERMANAGER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp->HasProperties()) {
|
||||||
|
nsNodeUtils::UnlinkUserData(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
nsEventStates
|
nsEventStates
|
||||||
|
@ -2192,6 +2265,45 @@ nsGenericElement::nsDOMSlots::~nsDOMSlots()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
|
||||||
|
{
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
|
||||||
|
cb.NoteXPCOMChild(mStyle.get());
|
||||||
|
|
||||||
|
#ifdef MOZ_SMIL
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
|
||||||
|
cb.NoteXPCOMChild(mSMILOverrideStyle.get());
|
||||||
|
#endif // MOZ_SMIL
|
||||||
|
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
|
||||||
|
cb.NoteXPCOMChild(mAttributeMap.get());
|
||||||
|
|
||||||
|
if (aIsXUL) {
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mControllers");
|
||||||
|
cb.NoteXPCOMChild(mControllers);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
|
||||||
|
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
|
||||||
|
{
|
||||||
|
mStyle = nsnull;
|
||||||
|
#ifdef MOZ_SMIL
|
||||||
|
mSMILOverrideStyle = nsnull;
|
||||||
|
#endif // MOZ_SMIL
|
||||||
|
if (mAttributeMap) {
|
||||||
|
mAttributeMap->DropReference();
|
||||||
|
mAttributeMap = nsnull;
|
||||||
|
}
|
||||||
|
if (aIsXUL)
|
||||||
|
NS_IF_RELEASE(mControllers);
|
||||||
|
mChildrenList = nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||||
: Element(aNodeInfo)
|
: Element(aNodeInfo)
|
||||||
{
|
{
|
||||||
|
@ -4110,9 +4222,7 @@ nsINode::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn)
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
nsINode::Unlink(tmp);
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
|
||||||
|
|
||||||
if (tmp->HasProperties() && tmp->IsXUL()) {
|
if (tmp->HasProperties() && tmp->IsXUL()) {
|
||||||
tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
|
tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
|
||||||
|
@ -4140,17 +4250,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
|
||||||
{
|
{
|
||||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||||
if (slots) {
|
if (slots) {
|
||||||
slots->mStyle = nsnull;
|
slots->Unlink(tmp->IsXUL());
|
||||||
#ifdef MOZ_SMIL
|
|
||||||
slots->mSMILOverrideStyle = nsnull;
|
|
||||||
#endif // MOZ_SMIL
|
|
||||||
if (slots->mAttributeMap) {
|
|
||||||
slots->mAttributeMap->DropReference();
|
|
||||||
slots->mAttributeMap = nsnull;
|
|
||||||
}
|
|
||||||
if (tmp->IsXUL())
|
|
||||||
NS_IF_RELEASE(slots->mControllers);
|
|
||||||
slots->mChildrenList = nsnull;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4163,7 +4263,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericElement)
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
nsINode::Trace(tmp, aCallback, aClosure);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
static const char* kNSURIs[] = {
|
static const char* kNSURIs[] = {
|
||||||
|
@ -4204,9 +4304,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
|
||||||
// if we're uncollectable.
|
// if we're uncollectable.
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||||
|
|
||||||
nsIDocument* currentDoc = tmp->GetCurrentDoc();
|
if (!nsINode::Traverse(tmp, cb)) {
|
||||||
if (currentDoc && nsCCUncollectableMarker::InGeneration(
|
|
||||||
cb, currentDoc->GetMarkedCCGeneration())) {
|
|
||||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4215,9 +4313,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
|
||||||
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
ownerDoc->BindingManager()->Traverse(tmp, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
|
|
||||||
|
|
||||||
if (tmp->HasProperties() && tmp->IsXUL()) {
|
if (tmp->HasProperties() && tmp->IsXUL()) {
|
||||||
nsISupports* property =
|
nsISupports* property =
|
||||||
static_cast<nsISupports*>
|
static_cast<nsISupports*>
|
||||||
|
@ -4248,31 +4343,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
|
||||||
|
|
||||||
// Traverse any DOM slots of interest.
|
// Traverse any DOM slots of interest.
|
||||||
{
|
{
|
||||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||||
if (slots) {
|
if (slots) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mStyle");
|
slots->Traverse(cb, tmp->IsXUL());
|
||||||
cb.NoteXPCOMChild(slots->mStyle.get());
|
|
||||||
|
|
||||||
#ifdef MOZ_SMIL
|
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mSMILOverrideStyle");
|
|
||||||
cb.NoteXPCOMChild(slots->mSMILOverrideStyle.get());
|
|
||||||
#endif // MOZ_SMIL
|
|
||||||
|
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mAttributeMap");
|
|
||||||
cb.NoteXPCOMChild(slots->mAttributeMap.get());
|
|
||||||
|
|
||||||
if (tmp->IsXUL())
|
|
||||||
cb.NoteXPCOMChild(slots->mControllers);
|
|
||||||
cb.NoteXPCOMChild(
|
|
||||||
static_cast<nsIDOMNodeList*>(slots->mChildrenList.get()));
|
|
||||||
}
|
}
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -826,6 +826,9 @@ public:
|
||||||
nsDOMSlots();
|
nsDOMSlots();
|
||||||
virtual ~nsDOMSlots();
|
virtual ~nsDOMSlots();
|
||||||
|
|
||||||
|
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
|
||||||
|
void Unlink(bool aIsXUL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The .style attribute (an interface that forwards to the actual
|
* The .style attribute (an interface that forwards to the actual
|
||||||
* style rules)
|
* style rules)
|
||||||
|
|
|
@ -1525,10 +1525,13 @@ nsObjectLoadingContent::RemovedFromDocument()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
void
|
void
|
||||||
nsObjectLoadingContent::Traverse(nsCycleCollectionTraversalCallback &cb)
|
nsObjectLoadingContent::Traverse(nsObjectLoadingContent *tmp,
|
||||||
|
nsCycleCollectionTraversalCallback &cb)
|
||||||
{
|
{
|
||||||
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(mFrameLoader));
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader");
|
||||||
|
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(tmp->mFrameLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
// <private>
|
// <private>
|
||||||
|
|
|
@ -222,7 +222,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||||
*/
|
*/
|
||||||
void RemovedFromDocument();
|
void RemovedFromDocument();
|
||||||
|
|
||||||
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
static void Traverse(nsObjectLoadingContent *tmp,
|
||||||
|
nsCycleCollectionTraversalCallback &cb);
|
||||||
|
|
||||||
void CreateStaticClone(nsObjectLoadingContent* aDest) const;
|
void CreateStaticClone(nsObjectLoadingContent* aDest) const;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -196,7 +196,7 @@ nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLObjectElement)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLObjectElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLObjectElement,
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLObjectElement,
|
||||||
nsGenericHTMLFormElement)
|
nsGenericHTMLFormElement)
|
||||||
tmp->Traverse(cb);
|
nsObjectLoadingContent::Traverse(tmp, cb);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement)
|
||||||
|
|
|
@ -216,7 +216,7 @@ nsHTMLSharedObjectElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLSharedObjectElement)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLSharedObjectElement)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLSharedObjectElement,
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLSharedObjectElement,
|
||||||
nsGenericHTMLElement)
|
nsGenericHTMLElement)
|
||||||
tmp->Traverse(cb);
|
nsObjectLoadingContent::Traverse(tmp, cb);
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLSharedObjectElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLSharedObjectElement, nsGenericElement)
|
||||||
|
|
|
@ -253,6 +253,13 @@ nsXULElement::nsXULSlots::~nsXULSlots()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsXULElement::nsXULSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||||
|
{
|
||||||
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mFrameLoader");
|
||||||
|
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIFrameLoader*, mFrameLoader));
|
||||||
|
}
|
||||||
|
|
||||||
nsINode::nsSlots*
|
nsINode::nsSlots*
|
||||||
nsXULElement::CreateSlots()
|
nsXULElement::CreateSlots()
|
||||||
{
|
{
|
||||||
|
@ -372,10 +379,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement,
|
||||||
{
|
{
|
||||||
nsXULSlots* slots = static_cast<nsXULSlots*>(tmp->GetExistingSlots());
|
nsXULSlots* slots = static_cast<nsXULSlots*>(tmp->GetExistingSlots());
|
||||||
if (slots) {
|
if (slots) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader");
|
slots->Traverse(cb);
|
||||||
nsISupports *frameLoader =
|
|
||||||
static_cast<nsIFrameLoader*>(slots->mFrameLoader);
|
|
||||||
cb.NoteXPCOMChild(frameLoader);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
|
@ -593,10 +593,12 @@ protected:
|
||||||
class nsXULSlots : public nsGenericElement::nsDOMSlots
|
class nsXULSlots : public nsGenericElement::nsDOMSlots
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsXULSlots();
|
nsXULSlots();
|
||||||
virtual ~nsXULSlots();
|
virtual ~nsXULSlots();
|
||||||
|
|
||||||
nsRefPtr<nsFrameLoader> mFrameLoader;
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||||
|
|
||||||
|
nsRefPtr<nsFrameLoader> mFrameLoader;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual nsINode::nsSlots* CreateSlots();
|
virtual nsINode::nsSlots* CreateSlots();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче