diff options
Diffstat (limited to 'parser/html/nsHtml5TreeOperation.cpp')
-rw-r--r-- | parser/html/nsHtml5TreeOperation.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index eb99869121..9adfad34bd 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -257,9 +257,10 @@ nsresult nsHtml5TreeOperation::Append(nsIContent* aNode, nsIContent* aParent, MOZ_ASSERT(aBuilder); MOZ_ASSERT(aBuilder->IsInDocUpdate()); ErrorResult rv; - nsHtml5OtherDocUpdate update(aParent->OwnerDoc(), aBuilder->GetDocument()); + Document* ownerDoc = aParent->OwnerDoc(); + nsHtml5OtherDocUpdate update(ownerDoc, aBuilder->GetDocument()); aParent->AppendChildTo(aNode, false, rv); - if (!rv.Failed()) { + if (!rv.Failed() && !ownerDoc->DOMNotificationsSuspended()) { aNode->SetParserHasNotified(); MutationObservers::NotifyContentAppended(aParent, aNode); } @@ -303,8 +304,10 @@ nsresult nsHtml5TreeOperation::AppendToDocument( return rv.StealNSResult(); } - aNode->SetParserHasNotified(); - MutationObservers::NotifyContentInserted(doc, aNode); + if (!doc->DOMNotificationsSuspended()) { + aNode->SetParserHasNotified(); + MutationObservers::NotifyContentInserted(doc, aNode); + } NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(), "Someone forgot to block scripts"); @@ -930,6 +933,7 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, nsresult operator()(const opGetShadowRootFromHost& aOperation) { nsIContent* root = nsContentUtils::AttachDeclarativeShadowRoot( *aOperation.mHost, aOperation.mShadowRootMode, + aOperation.mShadowRootIsClonable, aOperation.mShadowRootDelegatesFocus); if (root) { *aOperation.mFragHandle = root; |