Bug 1837769 - Associate element with form only if intended parent in same tree. r=dom-core,avandolder
nsHTML5TreeOperation::SetFormElement should only associate an element with the form, if "the intended parent is in the same tree as the element pointed to by the form element pointer". See https://html.spec.whatwg.org/#creating-and-inserting-nodes:parser-inserted-flag Differential Revision: https://phabricator.services.mozilla.com/D216052
This commit is contained in:
@@ -753,14 +753,15 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
|
||||
if (mBuilder) {
|
||||
nsHtml5TreeOperation::SetFormElement(
|
||||
static_cast<nsIContent*>(content),
|
||||
static_cast<nsIContent*>(aFormElement));
|
||||
static_cast<nsIContent*>(aFormElement),
|
||||
static_cast<nsIContent*>(aIntendedParent));
|
||||
} else {
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(mozilla::fallible);
|
||||
if (MOZ_UNLIKELY(!treeOp)) {
|
||||
MarkAsBrokenAndRequestSuspensionWithoutBuilder(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
opSetFormElement operation(content, aFormElement);
|
||||
opSetFormElement operation(content, aFormElement, aIntendedParent);
|
||||
treeOp->Init(mozilla::AsVariant(operation));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user