Bug 1953720 - In SetHTML create the inert document by inherting from the current document. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D241363
This commit is contained in:
Tom Schuster
2025-03-14 12:22:56 +00:00
parent 7507c4ce14
commit f269ef0615
3 changed files with 2 additions and 24 deletions

View File

@@ -5378,7 +5378,7 @@ void Element::SetHTML(const nsAString& aInnerHTML,
ElementCreationOptionsOrString options;
RefPtr<DocumentFragment> fragment;
if (doc->IsHTMLDocument()) {
inertDoc = nsContentUtils::CreateInertHTMLDocument(nullptr);
inertDoc = nsContentUtils::CreateInertHTMLDocument(doc);
if (!inertDoc) {
aError = NS_ERROR_FAILURE;
return;
@@ -5392,7 +5392,7 @@ void Element::SetHTML(const nsAString& aInnerHTML,
} else {
MOZ_ASSERT(doc->IsXMLDocument());
inertDoc = nsContentUtils::CreateInertXMLDocument(nullptr);
inertDoc = nsContentUtils::CreateInertXMLDocument(doc);
if (!inertDoc) {
aError = NS_ERROR_FAILURE;
return;