Make sure documents have a content type at creation time. Bug 311218,

r=sicking, sr=jst


git-svn-id: svn://10.0.0.236/trunk@195015 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-04-21 01:24:44 +00:00
parent 7c492342cc
commit fe80ff3c7a
6 changed files with 23 additions and 7 deletions

View File

@@ -325,7 +325,8 @@ IdAndNameHashInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
// bother initializing members to 0.
nsHTMLDocument::nsHTMLDocument()
: mCompatMode(eCompatibility_NavQuirks),
: nsDocument("text/html"),
mCompatMode(eCompatibility_NavQuirks),
mDefaultNamespaceID(kNameSpaceID_None)
{
@@ -1922,6 +1923,12 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
return NS_OK;
}
if (!aContentType.EqualsLiteral("text/html") &&
!aContentType.EqualsLiteral("text/plain")) {
NS_WARNING("Unsupported type; fix the caller");
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
nsresult rv = NS_OK;
// Note: We want to use GetDocumentFromContext here because this document