Fix for bug 47903 (WRONG_DOCUMENT_ERR not being thrown). r=sicking, sr=bz.

git-svn-id: svn://10.0.0.236/trunk@215687 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%propagandism.org
2006-11-22 18:35:05 +00:00
parent 8b34f4bfed
commit 104eb64087
13 changed files with 174 additions and 291 deletions

View File

@@ -3153,25 +3153,21 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
nsCOMPtr<nsIDOMDocument> doc(do_QueryInterface(mHTMLDocument));
doc->GetDoctype(getter_AddRefs(oldDocType));
nsCOMPtr<nsIDOMDOMImplementation> domImpl;
rv = doc->GetImplementation(getter_AddRefs(domImpl));
if (NS_FAILED(rv) || !domImpl) {
return rv;
}
if (name.IsEmpty()) {
name.AssignLiteral("HTML");
}
rv = domImpl->CreateDocumentType(name, publicId, systemId,
getter_AddRefs(docType));
if (NS_FAILED(rv) || !docType) {
return rv;
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(name);
if (!nameAtom) {
return NS_ERROR_OUT_OF_MEMORY;
}
rv = NS_NewDOMDocumentType(getter_AddRefs(docType),
mDocument->NodeInfoManager(), nsnull,
nameAtom, nsnull, nsnull, publicId, systemId,
EmptyString());
NS_ENSURE_SUCCESS(rv, rv);
if (oldDocType) {
// If we already have a doctype we replace the old one.
nsCOMPtr<nsIDOMNode> tmpNode;