From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- parser/html/nsHtml5TreeOperation.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'parser/html/nsHtml5TreeOperation.cpp') 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; -- cgit v1.2.3