mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 01:57:30 +09:00
Issue #2135 - Bug 1393806/Part 2: Modify AdoptNodeIntoOwnerDoc to use the non-XPCOM version of document.AdoptNode
* Unlike the original patch, this does not remove the XPCOM version of Document.adoptNode/importNode to avoid breaking other applications that might be using those functions.
This commit is contained in:
parent
e65a864a3e
commit
3062964d28
1 changed files with 7 additions and 11 deletions
|
|
@ -1563,20 +1563,16 @@ AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
|
||||||
|
|
||||||
nsIDocument *doc = aParent->OwnerDoc();
|
nsIDocument *doc = aParent->OwnerDoc();
|
||||||
|
|
||||||
nsresult rv;
|
ErrorResult rv;
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc, &rv);
|
nsINode* adoptedNode = doc->AdoptNode(*aNode, rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
rv.WouldReportJSException();
|
||||||
|
if (NS_WARN_IF(rv.Failed())) {
|
||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode, &rv);
|
return rv.StealNSResult();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> adoptedNode;
|
|
||||||
rv = domDoc->AdoptNode(node, getter_AddRefs(adoptedNode));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
NS_ASSERTION(aParent->OwnerDoc() == doc,
|
NS_ASSERTION(aParent->OwnerDoc() == doc,
|
||||||
"ownerDoc chainged while adopting");
|
"ownerDoc chainged while adopting");
|
||||||
NS_ASSERTION(adoptedNode == node, "Uh, adopt node changed nodes?");
|
NS_ASSERTION(adoptedNode == aNode, "Uh, adopt node changed nodes?");
|
||||||
NS_ASSERTION(aParent->OwnerDoc() == aNode->OwnerDoc(),
|
NS_ASSERTION(aParent->OwnerDoc() == aNode->OwnerDoc(),
|
||||||
"ownerDocument changed again after adopting!");
|
"ownerDocument changed again after adopting!");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue