From baca310fede46c54de0794ed7ac2919d77e2c266 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 29 Jan 2018 23:10:51 -0500 Subject: [PATCH] Bug 1432186 part 9. Remove nsIDOMNode::CloneNode. r=mccr8 MozReview-Commit-ID: 3x3wJ9H38Wx --- dom/base/nsDocument.cpp | 9 ++++++--- dom/base/nsINode.h | 13 ------------- dom/interfaces/core/nsIDOMNode.idl | 2 -- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index f313ab5bd213..7917b673e92b 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -10116,12 +10116,15 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) // Make document use different container during cloning. RefPtr originalShell = mDocumentContainer.get(); SetContainer(static_cast(aCloneContainer)); - nsCOMPtr clonedNode; - nsresult rv = thisAsDoc->CloneNode(true, 1, getter_AddRefs(clonedNode)); + ErrorResult rv; + nsCOMPtr clonedNode = thisAsDoc->CloneNode(true, rv); SetContainer(originalShell); RefPtr clonedDoc; - if (NS_SUCCEEDED(rv)) { + if (rv.Failed()) { + // Don't return yet; we need to reset mCreatingStaticClone + rv.SuppressException(); + } else { nsCOMPtr tmp = do_QueryInterface(clonedNode); if (tmp) { clonedDoc = static_cast(tmp.get()); diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 92de03089ed5..466e103162f0 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -2301,19 +2301,6 @@ ToCanonicalSupports(nsINode* aPointer) { \ *aResult = nsINode::HasChildNodes(); \ return NS_OK; \ - } \ - NS_IMETHOD CloneNode(bool aDeep, uint8_t aArgc, nsIDOMNode** aResult) __VA_ARGS__ override \ - { \ - if (aArgc == 0) { \ - aDeep = true; \ - } \ - mozilla::ErrorResult rv; \ - nsCOMPtr clone = nsINode::CloneNode(aDeep, rv); \ - if (rv.Failed()) { \ - return rv.StealNSResult(); \ - } \ - *aResult = clone.forget().take()->AsDOMNode(); \ - return NS_OK; \ } #define NS_FORWARD_NSIDOMNODE_TO_NSINODE \ diff --git a/dom/interfaces/core/nsIDOMNode.idl b/dom/interfaces/core/nsIDOMNode.idl index faf96e87aa6f..e76747358f77 100644 --- a/dom/interfaces/core/nsIDOMNode.idl +++ b/dom/interfaces/core/nsIDOMNode.idl @@ -41,6 +41,4 @@ interface nsIDOMNode : nsISupports // Modified in DOM Level 2: readonly attribute nsIDOMDocument ownerDocument; boolean hasChildNodes(); - // Modified in DOM Level 4: - [optional_argc] nsIDOMNode cloneNode([optional] in boolean deep); };