Bug 451053. Move nsMutationGuard into a shared location and use it to assert some invariants. r+sr=sicking

This commit is contained in:
Boris Zbarsky
2008-09-05 13:39:19 -04:00
parent 39787023fa
commit 6eabf8f654
6 changed files with 93 additions and 75 deletions

View File

@@ -1701,9 +1701,6 @@ nsStaticContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
}
//----------------------------------------------------------------------
PRUint32 nsMutationGuard::sMutationCount = 0;
nsGenericElement::nsDOMSlots::nsDOMSlots(PtrBits aFlags)
: nsINode::nsSlots(aFlags),
mBindingParent(nsnull)
@@ -5162,6 +5159,10 @@ TryMatchingElementsInSubtree(nsINode* aRoot,
nsIContent * const * kidSlot = aRoot->GetChildArray();
nsIContent * const * end = kidSlot + count;
#ifdef DEBUG
nsMutationGuard debugMutationGuard;
#endif
PRBool continueIteration = PR_TRUE;
for (; kidSlot != end; ++kidSlot) {
nsIContent* kid = *kidSlot;
@@ -5223,6 +5224,11 @@ TryMatchingElementsInSubtree(nsINode* aRoot,
/* Make sure to clean this up */
prevSibling->~RuleProcessorData();
}
#ifdef DEBUG
NS_ASSERTION(!debugMutationGuard.Mutated(0), "Unexpected mutations happened");
#endif
return continueIteration;
}