From 9f32fc6e9ccc759f5bba1b87e9c43f0c8c180f59 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Sun, 24 Mar 2002 17:16:44 +0000 Subject: [PATCH] fix for bug 132681 r=harishd, sr=jst, a=scc performance fix - stop scanning files that are known to be XML for html-like text git-svn-id: svn://10.0.0.236/trunk@117373 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/CNavDTD.cpp | 12 +++++++++++- mozilla/parser/htmlparser/src/CNavDTD.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 1da2455cef2..6362eef18f4 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -341,7 +341,17 @@ CNavDTD::CanParse(CParserContext& aParserContext, } else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kTextJSContentType))) { result=ePrimaryDetect; - } + } + // do this for XML-based content-types so that we don't fall back + // to BufferContainsHTML() for known content types + // see bug 132681 + // this will be cleaned up after moz 1.0 -alecf + else if (aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kRDFTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXULTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLApplicationContentType))) { + result=eUnknownDetect; + } else { //otherwise, look into the buffer to see if you recognize anything... PRBool theBufHasXML=PR_FALSE; diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 1da2455cef2..6362eef18f4 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -341,7 +341,17 @@ CNavDTD::CanParse(CParserContext& aParserContext, } else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kTextJSContentType))) { result=ePrimaryDetect; - } + } + // do this for XML-based content-types so that we don't fall back + // to BufferContainsHTML() for known content types + // see bug 132681 + // this will be cleaned up after moz 1.0 -alecf + else if (aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kRDFTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXULTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLTextContentType)) || + aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLApplicationContentType))) { + result=eUnknownDetect; + } else { //otherwise, look into the buffer to see if you recognize anything... PRBool theBufHasXML=PR_FALSE;