diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp
index 4cd2eef67f7..1604cac17ef 100644
--- a/mozilla/htmlparser/src/nsParser.cpp
+++ b/mozilla/htmlparser/src/nsParser.cpp
@@ -1060,13 +1060,16 @@ nsresult nsParser::OnStartRequest(nsIURI* aURL, const char *aSourceType)
mParserContext->mDTD=0;
#ifdef NECKO
nsresult rv;
- char* contentType;
+ char* contentType = nsnull;
rv = channel->GetContentType(&contentType);
- if (NS_FAILED(rv)) {
- NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
+ if (NS_SUCCEEDED(rv))
+ {
+ mParserContext->mSourceType = contentType;
+ nsCRT::free(contentType);
}
- mParserContext->mSourceType = contentType;
- nsCRT::free(contentType);
+ else
+ NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
+
#else
mParserContext->mSourceType=aSourceType;
#endif
diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index 4cd2eef67f7..1604cac17ef 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -1060,13 +1060,16 @@ nsresult nsParser::OnStartRequest(nsIURI* aURL, const char *aSourceType)
mParserContext->mDTD=0;
#ifdef NECKO
nsresult rv;
- char* contentType;
+ char* contentType = nsnull;
rv = channel->GetContentType(&contentType);
- if (NS_FAILED(rv)) {
- NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
+ if (NS_SUCCEEDED(rv))
+ {
+ mParserContext->mSourceType = contentType;
+ nsCRT::free(contentType);
}
- mParserContext->mSourceType = contentType;
- nsCRT::free(contentType);
+ else
+ NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
+
#else
mParserContext->mSourceType=aSourceType;
#endif