Bug 1393806 part 2. Remove the XPCOM version of Document.adoptNode/importNode. r=peterv

These don't play nice with ErrorResult error propagation, and don't really have a reason to exist anyway.

MozReview-Commit-ID: DlEs19LA4dT
This commit is contained in:
Boris Zbarsky 2017-09-13 13:34:55 -04:00
Родитель f23f66c56c
Коммит 5451f626bd
3 изменённых файлов: 7 добавлений и 61 удалений

Просмотреть файл

@ -6830,31 +6830,6 @@ nsIDocument::GetCharacterSet(nsAString& aCharacterSet) const
CopyASCIItoUTF16(charset, aCharacterSet);
}
NS_IMETHODIMP
nsDocument::ImportNode(nsIDOMNode* aImportedNode,
bool aDeep,
uint8_t aArgc,
nsIDOMNode** aResult)
{
if (aArgc == 0) {
aDeep = true;
}
*aResult = nullptr;
nsCOMPtr<nsINode> imported = do_QueryInterface(aImportedNode);
NS_ENSURE_TRUE(imported, NS_ERROR_UNEXPECTED);
ErrorResult rv;
nsCOMPtr<nsINode> result = nsIDocument::ImportNode(*imported, aDeep, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
NS_ADDREF(*aResult = result->AsDOMNode());
return NS_OK;
}
already_AddRefed<nsINode>
nsIDocument::ImportNode(nsINode& aNode, bool aDeep, ErrorResult& rv) const
{
@ -7839,24 +7814,6 @@ nsDOMAttributeMap::BlastSubtreeToPieces(nsINode *aNode)
}
}
NS_IMETHODIMP
nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
{
*aResult = nullptr;
nsCOMPtr<nsINode> adoptedNode = do_QueryInterface(aAdoptedNode);
NS_ENSURE_TRUE(adoptedNode, NS_ERROR_UNEXPECTED);
ErrorResult rv;
nsINode* result = nsIDocument::AdoptNode(*adoptedNode, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
NS_ADDREF(*aResult = result->AsDOMNode());
return NS_OK;
}
nsINode*
nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
{

Просмотреть файл

@ -1521,20 +1521,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!");

Просмотреть файл

@ -52,10 +52,6 @@ interface nsIDOMDocument : nsIDOMNode
raises(DOMException);
nsIDOMNodeList getElementsByTagName(in DOMString tagname);
// Introduced in DOM Level 2:
[optional_argc] nsIDOMNode importNode(in nsIDOMNode importedNode,
[optional] in boolean deep)
raises(DOMException);
// Introduced in DOM Level 2:
nsIDOMElement createElementNS(in DOMString namespaceURI,
[Null(Stringify)] in DOMString qualifiedName)
@ -75,9 +71,6 @@ interface nsIDOMDocument : nsIDOMNode
readonly attribute DOMString documentURI;
// Alias introduced for all documents in recent DOM standards
readonly attribute DOMString URL;
// Introduced in DOM Level 3:
nsIDOMNode adoptNode(in nsIDOMNode source)
raises(DOMException);
/**
* Create a range