diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 9af67aba209..e177827b54e 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -1027,28 +1027,4 @@ public: 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___ */ diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index dfd9c7e2dc9..5813cb95bc5 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -801,6 +801,9 @@ public: // putting a DestroySlots function on nsINode virtual ~nsSlots(); + void Traverse(nsCycleCollectionTraversalCallback &cb); + void Unlink(); + /** * A list of mutation observers */ @@ -1342,6 +1345,10 @@ protected: #undef TOUCH_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 mNodeInfo; nsINode* mParent; diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index 85acb4e1015..6a5d20c167c 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -60,7 +60,6 @@ #include "mozAutoDocUpdate.h" #include "nsMutationEvent.h" #include "nsPLDOMEvent.h" -#include "nsContentUtils.h" // NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER 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_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_LISTENERMANAGER - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END 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_UNLINK_BEGIN(nsDOMAttribute) + nsINode::Unlink(tmp); if (tmp->mChild) { static_cast(tmp->mChild)->UnbindFromAttribute(); NS_RELEASE(tmp->mChild); 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 DOMCI_NODE_DATA(Attr, nsDOMAttribute) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 4c97b858cfc..392670328b4 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1825,7 +1825,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) // if we're uncollectable. NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS - if (nsCCUncollectableMarker::InGeneration(cb, tmp->GetMarkedCCGeneration())) { + if (!nsINode::Traverse(tmp, cb)) { return NS_SUCCESS_INTERRUPTED_TRAVERSE; } @@ -1833,16 +1833,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) tmp->mExternalResourceMap.Traverse(&cb); - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo) - // Traverse the mChildren nsAttrAndChildArray. for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()); indx > 0; --indx) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildren[i]"); cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1)); } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA - // Traverse all nsIDocument pointer members. NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedRootElement) 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_PRESERVED_WRAPPER + nsINode::Trace(tmp, aCallback, aClosure); NS_IMPL_CYCLE_COLLECTION_TRACE_END @@ -1913,6 +1909,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) nsAutoScriptBlocker scriptBlocker; + nsINode::Unlink(tmp); + // Unlink the mChildren nsAttrAndChildArray. for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1; 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(mCachedEncoder) - NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER - NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA - tmp->mParentDocument = nsnull; NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages) diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 8b6b8e062e0..394f59f8e76 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -93,7 +93,7 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode() NS_IMPL_CYCLE_COLLECTION_CLASS(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_TRAVERSE_BEGIN(nsGenericDOMDataNode) @@ -101,28 +101,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode) // if we're uncollectable. NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS - nsIDocument* currentDoc = tmp->GetCurrentDoc(); - if (currentDoc && nsCCUncollectableMarker::InGeneration( - cb, currentDoc->GetMarkedCCGeneration())) { + if (!nsINode::Traverse(tmp, cb)) { return NS_SUCCESS_INTERRUPTED_TRAVERSE; } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo) - nsIDocument* ownerDoc = tmp->GetOwnerDoc(); if (ownerDoc) { 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_UNLINK_BEGIN(nsGenericDOMDataNode) - NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER - NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER - NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA + nsINode::Unlink(tmp); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index b9465367fde..3453d82c109 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -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() @@ -1142,6 +1158,63 @@ nsINode::GetContextForEventHandlers(nsresult* 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 @@ -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 aNodeInfo) : Element(aNodeInfo) { @@ -4110,9 +4222,7 @@ nsINode::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn) NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement) - NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER - NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER - NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA + nsINode::Unlink(tmp); if (tmp->HasProperties() && tmp->IsXUL()) { tmp->DeleteProperty(nsGkAtoms::contextmenulistener); @@ -4140,17 +4250,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement) { nsDOMSlots *slots = tmp->GetExistingDOMSlots(); if (slots) { - slots->mStyle = nsnull; -#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; + slots->Unlink(tmp->IsXUL()); } } @@ -4163,7 +4263,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement) NS_IMPL_CYCLE_COLLECTION_UNLINK_END 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 static const char* kNSURIs[] = { @@ -4204,9 +4304,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement) // if we're uncollectable. NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS - nsIDocument* currentDoc = tmp->GetCurrentDoc(); - if (currentDoc && nsCCUncollectableMarker::InGeneration( - cb, currentDoc->GetMarkedCCGeneration())) { + if (!nsINode::Traverse(tmp, cb)) { return NS_SUCCESS_INTERRUPTED_TRAVERSE; } @@ -4215,9 +4313,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement) ownerDoc->BindingManager()->Traverse(tmp, cb); } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA - if (tmp->HasProperties() && tmp->IsXUL()) { nsISupports* property = static_cast @@ -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. { nsDOMSlots *slots = tmp->GetExistingDOMSlots(); if (slots) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mStyle"); - 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(slots->mChildrenList.get())); + slots->Traverse(cb, tmp->IsXUL()); } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent()) } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 51f7396cb9e..2cd0e4614fa 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -826,6 +826,9 @@ public: nsDOMSlots(); virtual ~nsDOMSlots(); + void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL); + void Unlink(bool aIsXUL); + /** * The .style attribute (an interface that forwards to the actual * style rules) diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 514bfbddf7a..04edb49d449 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -1525,10 +1525,13 @@ nsObjectLoadingContent::RemovedFromDocument() } } +/* static */ void -nsObjectLoadingContent::Traverse(nsCycleCollectionTraversalCallback &cb) +nsObjectLoadingContent::Traverse(nsObjectLoadingContent *tmp, + nsCycleCollectionTraversalCallback &cb) { - cb.NoteXPCOMChild(static_cast(mFrameLoader)); + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader"); + cb.NoteXPCOMChild(static_cast(tmp->mFrameLoader)); } // diff --git a/content/base/src/nsObjectLoadingContent.h b/content/base/src/nsObjectLoadingContent.h index 2df93eaafe6..17f29884c61 100644 --- a/content/base/src/nsObjectLoadingContent.h +++ b/content/base/src/nsObjectLoadingContent.h @@ -222,7 +222,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent */ void RemovedFromDocument(); - void Traverse(nsCycleCollectionTraversalCallback &cb); + static void Traverse(nsObjectLoadingContent *tmp, + nsCycleCollectionTraversalCallback &cb); void CreateStaticClone(nsObjectLoadingContent* aDest) const; private: diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index 5cab99b221a..60b7b962c42 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -196,7 +196,7 @@ nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified) NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLObjectElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLObjectElement, nsGenericHTMLFormElement) - tmp->Traverse(cb); + nsObjectLoadingContent::Traverse(tmp, cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement) diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index ddff81a1a5c..76165cb5b54 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -216,7 +216,7 @@ nsHTMLSharedObjectElement::DoneAddingChildren(PRBool aHaveNotified) NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLSharedObjectElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLSharedObjectElement, nsGenericHTMLElement) - tmp->Traverse(cb); + nsObjectLoadingContent::Traverse(tmp, cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(nsHTMLSharedObjectElement, nsGenericElement) diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 8a87d56a396..4789ab9f066 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -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* nsXULElement::CreateSlots() { @@ -372,10 +379,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement, { nsXULSlots* slots = static_cast(tmp->GetExistingSlots()); if (slots) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader"); - nsISupports *frameLoader = - static_cast(slots->mFrameLoader); - cb.NoteXPCOMChild(frameLoader); + slots->Traverse(cb); } } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index a75e754ad15..14e6ff71cf3 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -593,10 +593,12 @@ protected: class nsXULSlots : public nsGenericElement::nsDOMSlots { public: - nsXULSlots(); - virtual ~nsXULSlots(); + nsXULSlots(); + virtual ~nsXULSlots(); - nsRefPtr mFrameLoader; + void Traverse(nsCycleCollectionTraversalCallback &cb); + + nsRefPtr mFrameLoader; }; virtual nsINode::nsSlots* CreateSlots();