diff --git a/content/base/src/nsDOMMutationObserver.h b/content/base/src/nsDOMMutationObserver.h index 18e97bd527e..4c276b26981 100644 --- a/content/base/src/nsDOMMutationObserver.h +++ b/content/base/src/nsDOMMutationObserver.h @@ -152,7 +152,7 @@ protected: nsMutationReceiverBase(nsINode* aRegisterTarget, nsMutationReceiverBase* aParent) : mTarget(nsnull), mObserver(nsnull), mParent(aParent), - mRegisterTarget(aRegisterTarget) + mRegisterTarget(aRegisterTarget), mKungFuDeathGrip(aParent->Target()) { NS_ASSERTION(mParent->Subtree(), "Should clone a non-subtree observer!"); mRegisterTarget->AddMutationObserver(this); @@ -195,6 +195,9 @@ protected: // This is different than mTarget when dealing with transient observers. nsINode* mRegisterTarget; nsCOMArray mTransientReceivers; + // While we have transient receivers, keep the original mutation receiver + // alive so it doesn't go away and disconnect all its transient receivers. + nsCOMPtr mKungFuDeathGrip; private: bool mSubtree;