Bug 578696 part 10. Stop holding strong refs when calling ContentInserted. r=sicking

This commit is contained in:
Boris Zbarsky 2010-07-21 11:33:32 -04:00
parent e3b2e5a289
commit 3e398f4206
3 changed files with 10 additions and 1 deletions

View File

@ -234,6 +234,12 @@ public:
* aDocument
* @param aChild The newly inserted child.
* @param aIndexInContainer The index in the container of the new child.
*
* @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays
* alive for the duration of the call as needed. The observer may
* assume that this call will happen when there are script blockers on
* the stack.
*/
virtual void ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,

View File

@ -183,7 +183,7 @@ nsNodeUtils::ContentInserted(nsINode* aContainer,
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_STRONGREF_MUTATION_NOTIFICATION(ContentInserted, aContainer,
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer,
(document, container, aChild, aIndexInContainer));
}

View File

@ -1121,6 +1121,9 @@ nsXULDocument::ContentInserted(nsIDocument* aDocument,
{
NS_ASSERTION(aDocument == this, "unexpected doc");
// Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
AddSubtreeToDocument(aChild);
}