Issue #2135 - Bug 1393806/Part 1: Change nsNodeUtils cloning/adopting stuff to use an ErrorResult for errors

This will allow us to propagate out more informative errors in some cases.
This commit is contained in:
FranklinDM 2023-03-04 17:05:41 +08:00 committed by roytam1
commit e65a864a3e
6 changed files with 100 additions and 103 deletions

View file

@ -321,10 +321,11 @@ nsXBLBinding::GenerateAnonymousContent()
if (hasContent) {
nsIDocument* doc = mBoundElement->OwnerDoc();
nsCOMPtr<nsINode> clonedNode;
nsCOMArray<nsINode> nodesWithProperties;
nsNodeUtils::Clone(content, true, doc->NodeInfoManager(),
nodesWithProperties, getter_AddRefs(clonedNode));
IgnoredErrorResult rv;
nsCOMPtr<nsINode> clonedNode =
nsNodeUtils::Clone(content, true, doc->NodeInfoManager(), nullptr, rv);
// FIXME: Bug 1399558, Why is this code OK assuming that nsNodeUtils::Clone
// never fails?
mContent = clonedNode->AsElement();
// Search for <xbl:children> elements in the XBL content. In the presence