diff --git a/htmlparser/src/nsParser.cpp b/htmlparser/src/nsParser.cpp
index bf0e7b2c06c..8f375b1c2be 100644
--- a/htmlparser/src/nsParser.cpp
+++ b/htmlparser/src/nsParser.cpp
@@ -474,6 +474,8 @@ PRInt32 nsParser::Parse(fstream& aStream,PRBool aVerifyEnabled){
CParserContext* pc=new CParserContext(new CScanner(kUnknownFilename,aStream,PR_FALSE),&aStream,0);
PushContext(*pc);
+ pc->mSourceType="text/html";
+
mParserContext->mScanner->Eof();
if(eValidDetect==AutoDetectContentType(mParserContext->mScanner->GetBuffer(),
mParserContext->mSourceType)) {
diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp
index bf0e7b2c06c..8f375b1c2be 100644
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -474,6 +474,8 @@ PRInt32 nsParser::Parse(fstream& aStream,PRBool aVerifyEnabled){
CParserContext* pc=new CParserContext(new CScanner(kUnknownFilename,aStream,PR_FALSE),&aStream,0);
PushContext(*pc);
+ pc->mSourceType="text/html";
+
mParserContext->mScanner->Eof();
if(eValidDetect==AutoDetectContentType(mParserContext->mScanner->GetBuffer(),
mParserContext->mSourceType)) {