Bug 601236, better scoping for mozAutoDocUpdate to remove some assertions, r=sicking, a=sicking

This commit is contained in:
Olli Pettay 2010-10-09 13:10:29 +03:00
Родитель be061d3a63
Коммит 2a5a29c3f3
1 изменённых файлов: 22 добавлений и 20 удалений

Просмотреть файл

@ -661,28 +661,30 @@ nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationE
return NS_OK;
}
nsCOMPtr<nsIContent> child = mChild;
nsMutationGuard::DidMutate();
mozAutoDocUpdate updateBatch(GetOwnerDoc(), UPDATE_CONTENT_MODEL, aNotify);
nsMutationGuard guard;
{
nsCOMPtr<nsIContent> child = mChild;
nsMutationGuard::DidMutate();
mozAutoDocUpdate updateBatch(GetOwnerDoc(), UPDATE_CONTENT_MODEL, aNotify);
nsMutationGuard guard;
mozAutoSubtreeModified subtree(nsnull, nsnull);
if (aNotify &&
nsContentUtils::HasMutationListeners(mChild,
NS_EVENT_BITS_MUTATION_NODEREMOVED,
this)) {
mozAutoRemovableBlockerRemover blockerRemover(GetOwnerDoc());
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEREMOVED);
mutation.mRelatedNode =
do_QueryInterface(static_cast<nsIAttribute*>(this));
subtree.UpdateTarget(GetOwnerDoc(), this);
nsEventDispatcher::Dispatch(mChild, nsnull, &mutation);
}
if (guard.Mutated(0) && mChild != child) {
return NS_OK;
}
mozAutoSubtreeModified subtree(nsnull, nsnull);
if (aNotify &&
nsContentUtils::HasMutationListeners(mChild,
NS_EVENT_BITS_MUTATION_NODEREMOVED,
this)) {
mozAutoRemovableBlockerRemover blockerRemover(GetOwnerDoc());
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEREMOVED);
mutation.mRelatedNode =
do_QueryInterface(static_cast<nsIAttribute*>(this));
subtree.UpdateTarget(GetOwnerDoc(), this);
nsEventDispatcher::Dispatch(mChild, nsnull, &mutation);
doRemoveChild();
}
if (guard.Mutated(0) && mChild != child) {
return NS_OK;
}
doRemoveChild();
nsString nullString;
SetDOMStringToNull(nullString);