Bug 672438 - Notify only if AppendChildTo succeeds. r=hsivonen

This commit is contained in:
Mats Palmgren 2011-07-20 22:22:27 +02:00
parent 64a2c57937
commit 24126c8471
2 changed files with 7 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class nsHtml5PendingNotification {
nsHtml5PendingNotification(nsIContent* aParent)
: mParent(aParent),
mChildCount(aParent->GetChildCount())
mChildCount(aParent->GetChildCount() - 1)
{
MOZ_COUNT_CTOR(nsHtml5PendingNotification);
}

View File

@ -210,8 +210,10 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
if (NS_LIKELY(executorDoc == parentDoc)) {
// the usual case. the parent is in the parser's doc
aBuilder->PostPendingAppendNotification(aParent, aNode);
rv = aParent->AppendChildTo(aNode, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
aBuilder->PostPendingAppendNotification(aParent, aNode);
}
return rv;
}
@ -220,8 +222,9 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
PRUint32 childCount = aParent->GetChildCount();
rv = aParent->AppendChildTo(aNode, PR_FALSE);
nsNodeUtils::ContentAppended(aParent, aNode, childCount);
if (NS_SUCCEEDED(rv)) {
nsNodeUtils::ContentAppended(aParent, aNode, childCount);
}
parentDoc->EndUpdate(UPDATE_CONTENT_MODEL);
return rv;
}