if (aDoctype) { nsCOMPtr<nsIDOMDocument> owner; aDoctype->GetOwnerDocument(getter_AddRefs(owner)); if (owner) { return NS_ERROR_DOM_WRONG_DOCUMENT_ERR; } }
nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI,                                     const nsAString& aQualifiedName,                                     nsIDOMDocumentType* aDoctype,                                     nsIDOMDocument** aReturn){    NS_ENSURE_ARG_POINTER(aReturn);    *aReturn = nsnull;  return NS_NewDOMDocument(aReturn, aNamespaceURI, aQualifiedName, aDoctype,                           mBaseURI);}