mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +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();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> adoptedNode;
|
||||
rv = domDoc->AdoptNode(node, getter_AddRefs(adoptedNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult rv;
|
||||
nsINode* adoptedNode = doc->AdoptNode(*aNode, rv);
|
||||
rv.WouldReportJSException();
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
NS_ASSERTION(aParent->OwnerDoc() == doc,
|
||||
"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(),
|
||||
"ownerDocument changed again after adopting!");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue