StrictDTD WIP and fixed mode regression
git-svn-id: svn://10.0.0.236/trunk@68210 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e6386cfe84
commit
6792920069
@ -175,6 +175,13 @@ CNavDTD::CNavDTD() : nsIDTD(),
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNavDTD::ReleaseTable(void) {
|
||||
if(gHTMLElements) {
|
||||
delete gHTMLElements;
|
||||
gHTMLElements=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method recycles the nodes on a nodestack.
|
||||
* NOTE: Unlike recycleNode(), we force the usecount
|
||||
@ -308,7 +315,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
||||
}
|
||||
else {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
result=(eParseMode_strict==aParserContext.mParseMode) ? eValidDetect : ePrimaryDetect;
|
||||
result=(eDTDMode_strict==aParserContext.mDTDMode) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
@ -321,7 +328,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
result=(eParseMode_strict==aParserContext.mParseMode) ? eValidDetect : ePrimaryDetect;
|
||||
result=(eDTDMode_strict==aParserContext.mDTDMode) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
else result=eValidDetect;
|
||||
}
|
||||
@ -350,9 +357,9 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
|
||||
mLineNumber=1;
|
||||
mHasOpenScript=PR_FALSE;
|
||||
mHasOpenNoXXX=0;
|
||||
mParseMode=aParserContext.mParseMode;
|
||||
mDTDMode=aParserContext.mDTDMode;
|
||||
mParserCommand=aParserContext.mParserCommand;
|
||||
mStyleHandlingEnabled=(eParseMode_quirks==mParseMode);
|
||||
mStyleHandlingEnabled=(eDTDMode_quirks==mDTDMode);
|
||||
mRequestedHead=PR_FALSE;
|
||||
mMimeType=aParserContext.mMimeType;
|
||||
|
||||
@ -661,7 +668,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
//However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.-
|
||||
mMisplacedContent.Push(aToken);
|
||||
aToken->mUseCount++;
|
||||
if(mParseMode==eParseMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
result=HandleToken(theBodyToken,aParser);
|
||||
}
|
||||
@ -1552,7 +1559,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
||||
{
|
||||
//This is special NAV-QUIRKS code that allows users
|
||||
//to use </BR>, even though that isn't a legitimate tag.
|
||||
if(eParseMode_quirks==mParseMode) {
|
||||
if(eDTDMode_quirks==mDTDMode) {
|
||||
// Use recycler and pass the token thro' HandleToken() to fix bugs like 32782.
|
||||
CHTMLToken* theToken = (CHTMLToken*)mTokenRecycler->CreateTokenOfType(eToken_start,theChildTag);
|
||||
result=HandleToken(theToken,mParser);
|
||||
@ -1588,8 +1595,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
||||
// If the bit kHandleStrayTag is set then we automatically open up a matching
|
||||
// start tag ( compatibility ). Currently this bit is set on P tag.
|
||||
// This also fixes Bug: 22623
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) &&
|
||||
mParseMode!=eParseMode_noquirks) {
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) && mDTDMode!=eDTDMode_strict) {
|
||||
// Oh boy!! we found a "stray" tag. Nav4.x and IE introduce line break in
|
||||
// such cases. So, let's simulate that effect for compatibility.
|
||||
// Ex. <html><body>Hello</P>There</body></html>
|
||||
@ -1899,7 +1905,7 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
|
||||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,mParseMode):NS_OK;
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,mDTDMode):NS_OK;
|
||||
mNodeRecycler->RecycleNode(theNode,mTokenRecycler);
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
@ -3139,7 +3145,7 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC
|
||||
}
|
||||
|
||||
|
||||
if(eParseMode_quirks==mParseMode) {
|
||||
if(eDTDMode_quirks==mDTDMode) {
|
||||
|
||||
#if 0
|
||||
|
||||
@ -3444,7 +3450,7 @@ nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
|
||||
nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
|
||||
nsresult result=NS_OK;
|
||||
if(!mTokenizer) {
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,mParseMode,mDocType,mParserCommand);
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,mDTDMode,mDocType,mParserCommand);
|
||||
}
|
||||
aTokenizer=mTokenizer;
|
||||
return result;
|
||||
|
||||
@ -476,6 +476,8 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
||||
|
||||
nsresult DoFragment(PRBool aFlag);
|
||||
|
||||
static void ReleaseTable(void);
|
||||
|
||||
protected:
|
||||
|
||||
nsresult CollectAttributes(nsCParserNode& aNode,eHTMLTags aTag,PRInt32 aCount);
|
||||
@ -514,7 +516,7 @@ protected:
|
||||
eHTMLTags mSkipTarget;
|
||||
nsDeque mSharedNodes;
|
||||
nsresult mDTDState;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
eParserDocType mDocType;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -317,11 +317,6 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
*/
|
||||
nsresult HandleStartToken(CToken* aToken);
|
||||
nsresult HandleEndToken(CToken* aToken);
|
||||
nsresult HandleEntityToken(CToken* aToken);
|
||||
nsresult HandleCommentToken(CToken* aToken);
|
||||
nsresult HandleAttributeToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(const nsIParserNode *aNode);
|
||||
nsresult HandleProcessingInstructionToken(CToken* aToken);
|
||||
nsresult HandleDocTypeDeclToken(CToken* aToken);
|
||||
|
||||
|
||||
@ -329,36 +324,6 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
//these cover methods mimic the sink, and are used
|
||||
//by the parser to manage its context-stack.
|
||||
//*************************************************
|
||||
|
||||
/**
|
||||
* The next set of method open given HTML elements of
|
||||
* various types.
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param node to be opened in content sink.
|
||||
* @return error code representing error condition-- usually 0.
|
||||
*/
|
||||
nsresult OpenHTML(const nsIParserNode *aNode);
|
||||
nsresult OpenHead(const nsIParserNode *aNode);
|
||||
nsresult OpenBody(const nsIParserNode *aNode);
|
||||
nsresult OpenForm(const nsIParserNode *aNode);
|
||||
nsresult OpenMap(const nsIParserNode *aNode);
|
||||
nsresult OpenFrameset(const nsIParserNode *aNode);
|
||||
nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,nsEntryStack* aStyleStack=0);
|
||||
|
||||
/**
|
||||
* The next set of methods close the given HTML element.
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param HTML (node) to be opened in content sink.
|
||||
* @return error code - 0 if all went well.
|
||||
*/
|
||||
nsresult CloseHTML(const nsIParserNode *aNode);
|
||||
nsresult CloseHead(const nsIParserNode *aNode);
|
||||
nsresult CloseBody(const nsIParserNode *aNode);
|
||||
nsresult CloseForm(const nsIParserNode *aNode);
|
||||
nsresult CloseMap(const nsIParserNode *aNode);
|
||||
nsresult CloseFrameset(const nsIParserNode *aNode);
|
||||
|
||||
/**
|
||||
* The special purpose methods automatically close
|
||||
@ -370,15 +335,7 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aClosedByStartTag);
|
||||
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aClosedByStartTag);
|
||||
|
||||
/**
|
||||
* Causes leaf to be added to sink at current vector pos.
|
||||
* @update gess5/11/98
|
||||
* @param aNode is leaf node to be added.
|
||||
* @return error code - 0 if all went well.
|
||||
*/
|
||||
nsresult AddLeaf(const nsIParserNode *aNode);
|
||||
nsresult AddHeadLeaf(nsIParserNode *aNode);
|
||||
|
||||
static void ReleaseTable(void);
|
||||
|
||||
protected:
|
||||
|
||||
@ -414,7 +371,7 @@ protected:
|
||||
eHTMLTags mSkipTarget;
|
||||
nsDeque mSharedNodes;
|
||||
nsresult mDTDState;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
|
||||
PRUint32 mComputedCRC32;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -50,7 +50,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
|
||||
mPrevContext=0;
|
||||
mListener=aListener;
|
||||
NS_IF_ADDREF(mListener);
|
||||
mParseMode=eParseMode_unknown;
|
||||
mDTDMode=eDTDMode_unknown;
|
||||
mAutoDetectStatus=aStatus;
|
||||
mTransferBuffer=0;
|
||||
mDTD=aDTD;
|
||||
@ -82,7 +82,7 @@ CParserContext::CParserContext(const CParserContext &aContext) : mMimeType() {
|
||||
mListener=aContext.mListener;
|
||||
NS_IF_ADDREF(mListener);
|
||||
|
||||
mParseMode=aContext.mParseMode;
|
||||
mDTDMode=aContext.mDTDMode;
|
||||
mAutoDetectStatus=aContext.mAutoDetectStatus;
|
||||
mTransferBuffer=aContext.mTransferBuffer;
|
||||
mDTD=aContext.mDTD;
|
||||
|
||||
@ -58,13 +58,12 @@ public:
|
||||
PRBool aCopyUnused=PR_FALSE);
|
||||
|
||||
CParserContext( const CParserContext& aContext);
|
||||
|
||||
~CParserContext();
|
||||
|
||||
void SetMimeType(const nsString& aMimeType);
|
||||
|
||||
CParserContext* mPrevContext;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserDocType mDocType;
|
||||
nsAutoString mMimeType;
|
||||
|
||||
|
||||
@ -354,24 +354,6 @@ eHTMLTags nsEntryStack::Last() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
*
|
||||
* @update harishd 04/04/99
|
||||
* @update gess 04/21/99
|
||||
*/
|
||||
PRInt32 nsEntryStack::GetTopmostIndexOf(eHTMLTags aTag) const {
|
||||
int theIndex=0;
|
||||
for(theIndex=mCount-1;theIndex>0;theIndex--){
|
||||
if(aTag==TagAt(theIndex))
|
||||
return theIndex;
|
||||
}
|
||||
return kNotFound;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************
|
||||
Now define the dtdcontext class
|
||||
***************************************************************/
|
||||
@ -379,13 +361,16 @@ CNodeRecycler* nsDTDContext::mNodeRecycler=0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess9/10/98
|
||||
* @update gess 04.21.2000
|
||||
*/
|
||||
nsDTDContext::nsDTDContext() : mStack() {
|
||||
|
||||
MOZ_COUNT_CTOR(nsDTDContext);
|
||||
mResidualStyleCount=0;
|
||||
mContextTopIndex=0;
|
||||
mTableStates=0;
|
||||
mHadBody=PR_FALSE;
|
||||
mHadFrameset=PR_TRUE;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
memset(mXTags,0,sizeof(mXTags));
|
||||
@ -399,6 +384,13 @@ nsDTDContext::nsDTDContext() : mStack() {
|
||||
*/
|
||||
nsDTDContext::~nsDTDContext() {
|
||||
MOZ_COUNT_DTOR(nsDTDContext);
|
||||
|
||||
while(mTableStates) {
|
||||
//pop the current state and restore it's predecessor, if any...
|
||||
CTableState *theState=mTableStates;
|
||||
mTableStates=theState->mPrevious;
|
||||
delete theState;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -53,9 +53,6 @@ void DebugDumpContainmentRules2(nsIDTD& theDTD,const char* aFilename,const char*
|
||||
PRUint32 AccumulateCRC(PRUint32 crc_accum, char *data_blk_ptr, int data_blk_size);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
The dtdcontext class defines an ordered list of tags (a context).
|
||||
***************************************************************/
|
||||
|
||||
/***************************************************************
|
||||
First, define the tagstack class
|
||||
@ -131,8 +128,55 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//*********************************************************************************************
|
||||
//*********************************************************************************************
|
||||
/**********************************************************
|
||||
The table state class is used to store info about each
|
||||
table that is opened on the stack. As tables open and
|
||||
close on the context, we update these objects to track
|
||||
what has/hasn't been seen on a per table basis.
|
||||
**********************************************************/
|
||||
class CTableState {
|
||||
public:
|
||||
CTableState(CTableState *aPreviousState=0) {
|
||||
mHasCaption=PR_FALSE;
|
||||
mHasCols=PR_FALSE;
|
||||
mHasTHead=PR_FALSE;
|
||||
mHasTFoot=PR_FALSE;
|
||||
mHasTBody=PR_FALSE;
|
||||
mPrevious=aPreviousState;
|
||||
}
|
||||
|
||||
PRBool CanOpenCaption() {
|
||||
PRBool result=!(mHasCaption || mHasCols || mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenCols() {
|
||||
PRBool result=!(mHasCols || mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenTHead() {
|
||||
PRBool result=!(mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenTFoot() {
|
||||
PRBool result=!(mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool mHasCaption;
|
||||
PRBool mHasCols;
|
||||
PRBool mHasTHead;
|
||||
PRBool mHasTFoot;
|
||||
PRBool mHasTBody;
|
||||
CTableState *mPrevious;
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
The dtdcontext class defines an ordered list of tags (a context).
|
||||
************************************************************************/
|
||||
|
||||
class nsDTDContext {
|
||||
public:
|
||||
@ -168,9 +212,13 @@ public:
|
||||
nsEntryStack mStack; //this will hold a list of tagentries...
|
||||
PRInt32 mResidualStyleCount;
|
||||
PRInt32 mContextTopIndex;
|
||||
PRBool mHadBody;
|
||||
PRBool mHadFrameset;
|
||||
|
||||
static CNodeRecycler* mNodeRecycler;
|
||||
|
||||
CTableState *mTableStates;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
enum { eMaxTags = 100 };
|
||||
eHTMLTags mXTags[eMaxTags];
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
CLASS_EXPORT_HTMLPARS nsHTMLTokenizer : public nsITokenizer {
|
||||
public:
|
||||
nsHTMLTokenizer( PRInt32 aParseMode=eParseMode_quirks,
|
||||
nsHTMLTokenizer( PRInt32 aParseMode=eDTDMode_quirks,
|
||||
eParserDocType aDocType=eHTML3Text,
|
||||
eParserCommands aCommand=eViewNormal);
|
||||
virtual ~nsHTMLTokenizer();
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
@ -280,7 +279,7 @@ void CStartToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CStartToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("<");
|
||||
anOutputString.AppendWithConversion("<");
|
||||
/*
|
||||
* Watch out for Bug 15204
|
||||
*/
|
||||
@ -434,7 +433,7 @@ void CEndToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CEndToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("</");
|
||||
anOutputString.AppendWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
@ -616,7 +615,7 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
|
||||
}
|
||||
//theTermStrPos=theBuffer.Find(aTerminalString,PR_TRUE,theCurrOffset);
|
||||
if(theTermStrPos>kNotFound) {
|
||||
if(aMode!=eParseMode_noquirks && !theLastIteration) {
|
||||
if(aMode!=eDTDMode_strict && !theLastIteration) {
|
||||
if(!aIgnoreComments) {
|
||||
theCurrOffset=theBuffer.Find("<!--",PR_TRUE,theCurrOffset,5);
|
||||
if(theStartCommentPos==kNotFound && theCurrOffset>kNotFound) {
|
||||
@ -961,8 +960,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||
* @return error result
|
||||
*/
|
||||
nsresult CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
nsresult result=(aMode==eParseMode_noquirks) ? ConsumeStrictComment(aChar,aScanner,mTextValue)
|
||||
: ConsumeComment(aChar,aScanner,mTextValue);
|
||||
nsresult result=(aMode==eDTDMode_strict) ? ConsumeStrictComment(aChar,aScanner,mTextValue) : ConsumeComment(aChar,aScanner,mTextValue);
|
||||
|
||||
#if 0
|
||||
if(NS_OK==result) {
|
||||
@ -1744,7 +1742,7 @@ void CEntityToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CEntityToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("&");
|
||||
anOutputString.AppendWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
@ -1945,7 +1943,7 @@ void CSkippedContentToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("$skipped-content");
|
||||
anOutputString.AppendWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -50,15 +50,15 @@ enum eAutoDetectResult {
|
||||
eInvalidDetect
|
||||
};
|
||||
|
||||
enum eParseMode {
|
||||
|
||||
eParseMode_unknown=0,
|
||||
eParseMode_quirks, //pre 5.0 versions
|
||||
eParseMode_noquirks, //raptor versions...)
|
||||
eParseMode_strict,
|
||||
eParseMode_autodetect
|
||||
enum nsDTDMode {
|
||||
eDTDMode_unknown=0,
|
||||
eDTDMode_quirks, //pre 5.0 versions
|
||||
eDTDMode_noquirks, //raptor versions...)
|
||||
eDTDMode_strict,
|
||||
eDTDMode_autodetect
|
||||
};
|
||||
|
||||
|
||||
class nsIParser;
|
||||
class CToken;
|
||||
class nsIDTDDebug;
|
||||
|
||||
@ -192,14 +192,14 @@ class nsIParser : public nsISupports {
|
||||
virtual nsresult EnableParser(PRBool aState) = 0;
|
||||
virtual PRBool IsParserEnabled() = 0;
|
||||
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
|
||||
virtual nsresult Terminate(void) = 0;
|
||||
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect)=0;
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
|
||||
/**
|
||||
* This method gets called when the tokens have been consumed, and it's time
|
||||
@ -216,7 +216,7 @@ class nsIParser : public nsISupports {
|
||||
* @update gess 6/9/98
|
||||
* @return ptr to scanner
|
||||
*/
|
||||
virtual eParseMode GetParseMode(void)=0;
|
||||
virtual nsDTDMode GetParseMode(void)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -427,10 +427,10 @@ nsScanner* nsParser::GetScanner(void){
|
||||
* @update gess 01/04/99
|
||||
* @return parsemode
|
||||
*/
|
||||
eParseMode nsParser::GetParseMode(void){
|
||||
nsDTDMode nsParser::GetParseMode(void){
|
||||
if(mParserContext)
|
||||
return mParserContext->mParseMode;
|
||||
return eParseMode_unknown;
|
||||
return mParserContext->mDTDMode;
|
||||
return eDTDMode_unknown;
|
||||
}
|
||||
|
||||
|
||||
@ -480,10 +480,10 @@ eParseMode nsParser::GetParseMode(void){
|
||||
* @return parsermode (define in nsIParser.h)
|
||||
*/
|
||||
static
|
||||
void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType aDocType) {
|
||||
void DetermineParseMode(nsString& aBuffer,nsDTDMode& aParseMode,eParserDocType aDocType) {
|
||||
const char* theModeStr= PR_GetEnv("PARSE_MODE");
|
||||
|
||||
aParseMode = eParseMode_unknown;
|
||||
aParseMode = eDTDMode_unknown;
|
||||
|
||||
PRInt32 theIndex=aBuffer.Find("DOCTYPE",PR_TRUE,0,10);
|
||||
if(kNotFound<theIndex) {
|
||||
@ -506,13 +506,13 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("XHTML",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eXHTMLText;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
else {
|
||||
theSubIndex=aBuffer.Find("ISO/IEC 15445:",PR_TRUE,theIndex+8,theEnd-(theIndex+8));
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML4Text;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
theMajorVersion=4;
|
||||
theSubIndex+=15;
|
||||
}
|
||||
@ -520,14 +520,14 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("HTML",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML4Text;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
theMajorVersion=3;
|
||||
}
|
||||
else {
|
||||
theSubIndex=aBuffer.Find("HYPERTEXT MARKUP",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML3Text;
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
theSubIndex+=20;
|
||||
}
|
||||
}
|
||||
@ -561,7 +561,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
(aBuffer.Find("LATIN1", PR_TRUE,theStartPos,theCount) >kNotFound) ||
|
||||
(aBuffer.Find("SYMBOLS",PR_TRUE,theStartPos,theCount) >kNotFound) ||
|
||||
(aBuffer.Find("SPECIAL",PR_TRUE,theStartPos,theCount) >kNotFound)) {
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
}
|
||||
|
||||
//one last thing: look for a URI that specifies the strict.dtd
|
||||
@ -570,7 +570,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("STRICT.DTD",PR_TRUE,theStartPos,theCount);
|
||||
if(0<theSubIndex) {
|
||||
//Since we found it, regardless of what's in the descr-text, kick into strict mode.
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
aDocType=eHTML4Text;
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
switch(theMajorVersion) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
if(aDocType!=eXHTMLText){
|
||||
aParseMode=eParseMode_quirks; //be as backward compatible as possible
|
||||
aParseMode=eDTDMode_quirks; //be as backward compatible as possible
|
||||
aDocType=eHTML3Text;
|
||||
}
|
||||
break;
|
||||
@ -587,7 +587,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
//XXX hack -- someday, the next line of code will be criticized
|
||||
//for it's lack of vision...
|
||||
if(theMajorVersion>20) {
|
||||
aParseMode=eParseMode_noquirks;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
break;
|
||||
} //switch
|
||||
@ -601,24 +601,24 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
PRInt32 theIDPos=aBuffer.Find("PublicID",thePos);
|
||||
if(kNotFound==theIDPos)
|
||||
theIDPos=aBuffer.Find("SystemID",thePos);
|
||||
aParseMode=(kNotFound==theIDPos) ? eParseMode_quirks : eParseMode_strict;
|
||||
aParseMode=(kNotFound==theIDPos) ? eDTDMode_quirks : eDTDMode_strict;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(kNotFound<(theIndex=aBuffer.Find("?XML",PR_TRUE,0,128))) {
|
||||
aDocType=eXMLText;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
|
||||
if(theModeStr) {
|
||||
if(0==nsCRT::strcasecmp(theModeStr,"strict"))
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
else {
|
||||
if(eParseMode_unknown==aParseMode) {
|
||||
if(eDTDMode_unknown==aParseMode) {
|
||||
aBuffer.InsertWithConversion("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",0);
|
||||
aDocType=eHTML3Text;
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -709,14 +709,14 @@ nsresult nsParser::CreateCompatibleDTDForDocType(nsIDTD** aDTD, nsString* aDocTy
|
||||
const nsCID* theDTDClassID=0;
|
||||
|
||||
if(aDocTypeStr) {
|
||||
eParseMode theParseMode=eParseMode_unknown;
|
||||
eParserDocType theDocType=ePlainText;
|
||||
nsDTDMode theParseMode=eDTDMode_unknown;
|
||||
eParserDocType theDocType=ePlainText;
|
||||
|
||||
DetermineParseMode(*aDocTypeStr,theParseMode,theDocType);
|
||||
|
||||
switch(theDocType) {
|
||||
case eHTML4Text:
|
||||
if(theParseMode==eParseMode_strict) {
|
||||
if(theParseMode==eDTDMode_strict) {
|
||||
theDTDClassID=&kCOtherDTDCID;
|
||||
break;
|
||||
}
|
||||
@ -750,17 +750,17 @@ nsresult nsParser::CreateCompatibleDTDForDocType(nsIDTD** aDTD, nsString* aDocTy
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
nsresult nsParser::CreateCompatibleDTDForMimeType(nsIDTD** aDTD,const nsString* aMimeType,
|
||||
eParseMode aParseMode)
|
||||
nsDTDMode aParseMode)
|
||||
{
|
||||
nsresult result=NS_OK;
|
||||
const nsCID* theDTDClassID=0;
|
||||
|
||||
if(aMimeType) {
|
||||
|
||||
NS_ASSERTION(aParseMode!=eParseMode_unknown,"DTD selection might require a parsemode");
|
||||
NS_ASSERTION(aParseMode!=eDTDMode_unknown,"DTD selection might require a parsemode");
|
||||
|
||||
if(aMimeType->EqualsWithConversion(kHTMLTextContentType)) {
|
||||
if(aParseMode==eParseMode_strict) {
|
||||
if(aParseMode==eDTDMode_strict) {
|
||||
theDTDClassID=&kCOtherDTDCID;
|
||||
}
|
||||
else {
|
||||
@ -937,7 +937,7 @@ nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
|
||||
if(!tested) {
|
||||
tested=PR_TRUE;
|
||||
eParseMode theParseMode=eParseMode_unknown;
|
||||
eParseMode theParseMode=eDTDMode_unknown;
|
||||
eParserDocType theDocumentType=ePlainText;
|
||||
|
||||
while(*theDocType) {
|
||||
@ -955,7 +955,7 @@ nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
mMinorIteration=-1;
|
||||
|
||||
nsString& theBuffer=mParserContext->mScanner->GetBuffer();
|
||||
DetermineParseMode(theBuffer,mParserContext->mParseMode,mParserContext->mDocType);
|
||||
DetermineParseMode(theBuffer,mParserContext->mDTDMode,mParserContext->mDocType);
|
||||
|
||||
if(PR_TRUE==FindSuitableDTD(*mParserContext,theBuffer)) {
|
||||
mParserContext->mDTD->WillBuildModel( *mParserContext,mSink);
|
||||
@ -1115,7 +1115,7 @@ PRBool nsParser::IsParserEnabled() {
|
||||
* @param aFilename -- const char* containing file to be parsed.
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
|
||||
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode) {
|
||||
|
||||
NS_PRECONDITION(0!=aURL,kNullURL);
|
||||
|
||||
@ -1154,7 +1154,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
|
||||
* @param aStream is the i/o source
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aVerifyEnabled, void* aKey,eParseMode aMode){
|
||||
nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){
|
||||
|
||||
mDTDVerification=aVerifyEnabled;
|
||||
nsresult result=NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1195,7 +1195,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString&
|
||||
aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
|
||||
aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
||||
|
||||
//NOTE: Make sure that updates to this method don't cause
|
||||
// bug #2361 to break again!
|
||||
@ -1275,7 +1275,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
|
||||
* @param aMimeType tells us what kind of stuff you're inserting
|
||||
* @return TRUE if valid, otherwise FALSE
|
||||
*/
|
||||
PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,eParseMode aMode){
|
||||
PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
/************************************************************************************
|
||||
This method works like this:
|
||||
@ -1328,7 +1328,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,eParseMode aMode){
|
||||
nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
nsresult result=NS_OK;
|
||||
nsAutoString theContext;
|
||||
|
||||
@ -165,7 +165,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @update gess 6/9/98
|
||||
* @return ptr to scanner
|
||||
*/
|
||||
virtual eParseMode GetParseMode(void);
|
||||
virtual nsDTDMode GetParseMode(void);
|
||||
|
||||
/**
|
||||
* Retrieve the scanner from the topmost parser context
|
||||
@ -182,7 +182,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param aListener is a listener to forward notifications to
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aEnableVerify=PR_FALSE,void* aKey=0,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* Cause parser to parse input from given stream
|
||||
@ -190,7 +190,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param aStream is the i/o source
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* @update gess5/11/98
|
||||
@ -198,10 +198,10 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param appendTokens tells us whether we should insert tokens inline, or append them.
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
|
||||
/**
|
||||
@ -384,7 +384,7 @@ private:
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
static nsresult CreateCompatibleDTDForMimeType(nsIDTD** aDTD, const nsString* aMimeType,
|
||||
eParseMode aParseMode=eParseMode_unknown);
|
||||
nsDTDMode aParseMode=eDTDMode_unknown);
|
||||
/**
|
||||
* Call this method to determine a DTD for a given command
|
||||
*
|
||||
@ -394,6 +394,7 @@ private:
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
static nsresult CreateCompatibleDTDForCommand(nsIDTD** aDTD, eParserCommands aCommand);
|
||||
|
||||
protected:
|
||||
//*********************************************
|
||||
// And now, some data members...
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nspr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -30,6 +31,7 @@
|
||||
#include "nsLoggingSink.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "CNavDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsXIFDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "CRtfDTD.h"
|
||||
@ -209,10 +211,11 @@ nsParserModule::Shutdown()
|
||||
nsHTMLTokenizer::FreeTokenRecycler();
|
||||
nsXMLTokenizer::FreeTokenRecycler();
|
||||
nsExpatTokenizer::FreeTokenRecycler();
|
||||
// nsTextTokenizer::FreeTokenRecycler();
|
||||
nsDTDContext::FreeNodeRecycler();
|
||||
nsParser::FreeSharedObjects();
|
||||
mInitialized = PR_FALSE;
|
||||
COtherDTD::ReleaseTable();
|
||||
CNavDTD::ReleaseTable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext,
|
||||
|
||||
mDocType=aParserContext.mDocType;
|
||||
mMimeType=aParserContext.mMimeType;
|
||||
mParseMode=aParserContext.mParseMode;
|
||||
mDTDMode=aParserContext.mDTDMode;
|
||||
mParserCommand=aParserContext.mParserCommand;
|
||||
|
||||
static const char* theHeader="<?xml version=\"1.0\"?>";
|
||||
@ -486,7 +486,7 @@ nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) {
|
||||
nsresult result=NS_OK;
|
||||
if(!mTokenizer) {
|
||||
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,eParseMode_quirks,mDocType,mParserCommand);
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,eDTDMode_quirks,mDocType,mParserCommand);
|
||||
}
|
||||
aTokenizer=mTokenizer;
|
||||
return result;
|
||||
|
||||
@ -260,7 +260,7 @@ protected:
|
||||
nsAutoString mKey;
|
||||
nsAutoString mValue;
|
||||
nsAutoString mPopupTag;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
eParserDocType mDocType;
|
||||
nsAutoString mMimeType;
|
||||
|
||||
@ -208,7 +208,7 @@ nsresult nsXMLTokenizer::ConsumeComment(PRUnichar aChar,CToken*& aToken,nsScanne
|
||||
nsAutoString theEmpty;
|
||||
aToken=theRecycler->CreateTokenOfType(eToken_comment,eHTMLTag_comment,theEmpty);
|
||||
if(aToken) {
|
||||
result=aToken->Consume(aChar,aScanner,eParseMode_noquirks);
|
||||
result=aToken->Consume(aChar,aScanner,eDTDMode_strict);
|
||||
AddToken(aToken,result,&mTokenDeque,theRecycler);
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ nsresult nsXMLTokenizer::ConsumeSpecialMarkup(PRUnichar aChar,CToken*& aToken,ns
|
||||
if(isComment) aToken = theRecycler->CreateTokenOfType(eToken_comment,eHTMLTag_comment,theEmpty);
|
||||
|
||||
if(aToken) {
|
||||
result=aToken->Consume(aChar,aScanner,eParseMode_noquirks);
|
||||
result=aToken->Consume(aChar,aScanner,eDTDMode_strict);
|
||||
AddToken(aToken,result,&mTokenDeque,theRecycler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,6 +175,13 @@ CNavDTD::CNavDTD() : nsIDTD(),
|
||||
#endif
|
||||
}
|
||||
|
||||
void CNavDTD::ReleaseTable(void) {
|
||||
if(gHTMLElements) {
|
||||
delete gHTMLElements;
|
||||
gHTMLElements=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method recycles the nodes on a nodestack.
|
||||
* NOTE: Unlike recycleNode(), we force the usecount
|
||||
@ -308,7 +315,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
||||
}
|
||||
else {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
result=(eParseMode_strict==aParserContext.mParseMode) ? eValidDetect : ePrimaryDetect;
|
||||
result=(eDTDMode_strict==aParserContext.mDTDMode) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
@ -321,7 +328,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
result=(eParseMode_strict==aParserContext.mParseMode) ? eValidDetect : ePrimaryDetect;
|
||||
result=(eDTDMode_strict==aParserContext.mDTDMode) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
else result=eValidDetect;
|
||||
}
|
||||
@ -350,9 +357,9 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
|
||||
mLineNumber=1;
|
||||
mHasOpenScript=PR_FALSE;
|
||||
mHasOpenNoXXX=0;
|
||||
mParseMode=aParserContext.mParseMode;
|
||||
mDTDMode=aParserContext.mDTDMode;
|
||||
mParserCommand=aParserContext.mParserCommand;
|
||||
mStyleHandlingEnabled=(eParseMode_quirks==mParseMode);
|
||||
mStyleHandlingEnabled=(eDTDMode_quirks==mDTDMode);
|
||||
mRequestedHead=PR_FALSE;
|
||||
mMimeType=aParserContext.mMimeType;
|
||||
|
||||
@ -661,7 +668,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
//However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.-
|
||||
mMisplacedContent.Push(aToken);
|
||||
aToken->mUseCount++;
|
||||
if(mParseMode==eParseMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
result=HandleToken(theBodyToken,aParser);
|
||||
}
|
||||
@ -1552,7 +1559,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
||||
{
|
||||
//This is special NAV-QUIRKS code that allows users
|
||||
//to use </BR>, even though that isn't a legitimate tag.
|
||||
if(eParseMode_quirks==mParseMode) {
|
||||
if(eDTDMode_quirks==mDTDMode) {
|
||||
// Use recycler and pass the token thro' HandleToken() to fix bugs like 32782.
|
||||
CHTMLToken* theToken = (CHTMLToken*)mTokenRecycler->CreateTokenOfType(eToken_start,theChildTag);
|
||||
result=HandleToken(theToken,mParser);
|
||||
@ -1588,8 +1595,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
||||
// If the bit kHandleStrayTag is set then we automatically open up a matching
|
||||
// start tag ( compatibility ). Currently this bit is set on P tag.
|
||||
// This also fixes Bug: 22623
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) &&
|
||||
mParseMode!=eParseMode_noquirks) {
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) && mDTDMode!=eDTDMode_strict) {
|
||||
// Oh boy!! we found a "stray" tag. Nav4.x and IE introduce line break in
|
||||
// such cases. So, let's simulate that effect for compatibility.
|
||||
// Ex. <html><body>Hello</P>There</body></html>
|
||||
@ -1899,7 +1905,7 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
|
||||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,mParseMode):NS_OK;
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,mDTDMode):NS_OK;
|
||||
mNodeRecycler->RecycleNode(theNode,mTokenRecycler);
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
@ -3139,7 +3145,7 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC
|
||||
}
|
||||
|
||||
|
||||
if(eParseMode_quirks==mParseMode) {
|
||||
if(eDTDMode_quirks==mDTDMode) {
|
||||
|
||||
#if 0
|
||||
|
||||
@ -3444,7 +3450,7 @@ nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
|
||||
nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
|
||||
nsresult result=NS_OK;
|
||||
if(!mTokenizer) {
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,mParseMode,mDocType,mParserCommand);
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,mDTDMode,mDocType,mParserCommand);
|
||||
}
|
||||
aTokenizer=mTokenizer;
|
||||
return result;
|
||||
|
||||
@ -476,6 +476,8 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
||||
|
||||
nsresult DoFragment(PRBool aFlag);
|
||||
|
||||
static void ReleaseTable(void);
|
||||
|
||||
protected:
|
||||
|
||||
nsresult CollectAttributes(nsCParserNode& aNode,eHTMLTags aTag,PRInt32 aCount);
|
||||
@ -514,7 +516,7 @@ protected:
|
||||
eHTMLTags mSkipTarget;
|
||||
nsDeque mSharedNodes;
|
||||
nsresult mDTDState;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
eParserDocType mDocType;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -317,11 +317,6 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
*/
|
||||
nsresult HandleStartToken(CToken* aToken);
|
||||
nsresult HandleEndToken(CToken* aToken);
|
||||
nsresult HandleEntityToken(CToken* aToken);
|
||||
nsresult HandleCommentToken(CToken* aToken);
|
||||
nsresult HandleAttributeToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(const nsIParserNode *aNode);
|
||||
nsresult HandleProcessingInstructionToken(CToken* aToken);
|
||||
nsresult HandleDocTypeDeclToken(CToken* aToken);
|
||||
|
||||
|
||||
@ -329,36 +324,6 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
//these cover methods mimic the sink, and are used
|
||||
//by the parser to manage its context-stack.
|
||||
//*************************************************
|
||||
|
||||
/**
|
||||
* The next set of method open given HTML elements of
|
||||
* various types.
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param node to be opened in content sink.
|
||||
* @return error code representing error condition-- usually 0.
|
||||
*/
|
||||
nsresult OpenHTML(const nsIParserNode *aNode);
|
||||
nsresult OpenHead(const nsIParserNode *aNode);
|
||||
nsresult OpenBody(const nsIParserNode *aNode);
|
||||
nsresult OpenForm(const nsIParserNode *aNode);
|
||||
nsresult OpenMap(const nsIParserNode *aNode);
|
||||
nsresult OpenFrameset(const nsIParserNode *aNode);
|
||||
nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,nsEntryStack* aStyleStack=0);
|
||||
|
||||
/**
|
||||
* The next set of methods close the given HTML element.
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param HTML (node) to be opened in content sink.
|
||||
* @return error code - 0 if all went well.
|
||||
*/
|
||||
nsresult CloseHTML(const nsIParserNode *aNode);
|
||||
nsresult CloseHead(const nsIParserNode *aNode);
|
||||
nsresult CloseBody(const nsIParserNode *aNode);
|
||||
nsresult CloseForm(const nsIParserNode *aNode);
|
||||
nsresult CloseMap(const nsIParserNode *aNode);
|
||||
nsresult CloseFrameset(const nsIParserNode *aNode);
|
||||
|
||||
/**
|
||||
* The special purpose methods automatically close
|
||||
@ -370,15 +335,7 @@ CLASS_EXPORT_HTMLPARS COtherDTD : public nsIDTD {
|
||||
nsresult CloseContainersTo(eHTMLTags aTag,PRBool aClosedByStartTag);
|
||||
nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aClosedByStartTag);
|
||||
|
||||
/**
|
||||
* Causes leaf to be added to sink at current vector pos.
|
||||
* @update gess5/11/98
|
||||
* @param aNode is leaf node to be added.
|
||||
* @return error code - 0 if all went well.
|
||||
*/
|
||||
nsresult AddLeaf(const nsIParserNode *aNode);
|
||||
nsresult AddHeadLeaf(nsIParserNode *aNode);
|
||||
|
||||
static void ReleaseTable(void);
|
||||
|
||||
protected:
|
||||
|
||||
@ -414,7 +371,7 @@ protected:
|
||||
eHTMLTags mSkipTarget;
|
||||
nsDeque mSharedNodes;
|
||||
nsresult mDTDState;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
|
||||
PRUint32 mComputedCRC32;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -50,7 +50,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
|
||||
mPrevContext=0;
|
||||
mListener=aListener;
|
||||
NS_IF_ADDREF(mListener);
|
||||
mParseMode=eParseMode_unknown;
|
||||
mDTDMode=eDTDMode_unknown;
|
||||
mAutoDetectStatus=aStatus;
|
||||
mTransferBuffer=0;
|
||||
mDTD=aDTD;
|
||||
@ -82,7 +82,7 @@ CParserContext::CParserContext(const CParserContext &aContext) : mMimeType() {
|
||||
mListener=aContext.mListener;
|
||||
NS_IF_ADDREF(mListener);
|
||||
|
||||
mParseMode=aContext.mParseMode;
|
||||
mDTDMode=aContext.mDTDMode;
|
||||
mAutoDetectStatus=aContext.mAutoDetectStatus;
|
||||
mTransferBuffer=aContext.mTransferBuffer;
|
||||
mDTD=aContext.mDTD;
|
||||
|
||||
@ -58,13 +58,12 @@ public:
|
||||
PRBool aCopyUnused=PR_FALSE);
|
||||
|
||||
CParserContext( const CParserContext& aContext);
|
||||
|
||||
~CParserContext();
|
||||
|
||||
void SetMimeType(const nsString& aMimeType);
|
||||
|
||||
CParserContext* mPrevContext;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserDocType mDocType;
|
||||
nsAutoString mMimeType;
|
||||
|
||||
|
||||
@ -354,24 +354,6 @@ eHTMLTags nsEntryStack::Last() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
*
|
||||
* @update harishd 04/04/99
|
||||
* @update gess 04/21/99
|
||||
*/
|
||||
PRInt32 nsEntryStack::GetTopmostIndexOf(eHTMLTags aTag) const {
|
||||
int theIndex=0;
|
||||
for(theIndex=mCount-1;theIndex>0;theIndex--){
|
||||
if(aTag==TagAt(theIndex))
|
||||
return theIndex;
|
||||
}
|
||||
return kNotFound;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************
|
||||
Now define the dtdcontext class
|
||||
***************************************************************/
|
||||
@ -379,13 +361,16 @@ CNodeRecycler* nsDTDContext::mNodeRecycler=0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess9/10/98
|
||||
* @update gess 04.21.2000
|
||||
*/
|
||||
nsDTDContext::nsDTDContext() : mStack() {
|
||||
|
||||
MOZ_COUNT_CTOR(nsDTDContext);
|
||||
mResidualStyleCount=0;
|
||||
mContextTopIndex=0;
|
||||
mTableStates=0;
|
||||
mHadBody=PR_FALSE;
|
||||
mHadFrameset=PR_TRUE;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
memset(mXTags,0,sizeof(mXTags));
|
||||
@ -399,6 +384,13 @@ nsDTDContext::nsDTDContext() : mStack() {
|
||||
*/
|
||||
nsDTDContext::~nsDTDContext() {
|
||||
MOZ_COUNT_DTOR(nsDTDContext);
|
||||
|
||||
while(mTableStates) {
|
||||
//pop the current state and restore it's predecessor, if any...
|
||||
CTableState *theState=mTableStates;
|
||||
mTableStates=theState->mPrevious;
|
||||
delete theState;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -53,9 +53,6 @@ void DebugDumpContainmentRules2(nsIDTD& theDTD,const char* aFilename,const char*
|
||||
PRUint32 AccumulateCRC(PRUint32 crc_accum, char *data_blk_ptr, int data_blk_size);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
The dtdcontext class defines an ordered list of tags (a context).
|
||||
***************************************************************/
|
||||
|
||||
/***************************************************************
|
||||
First, define the tagstack class
|
||||
@ -131,8 +128,55 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//*********************************************************************************************
|
||||
//*********************************************************************************************
|
||||
/**********************************************************
|
||||
The table state class is used to store info about each
|
||||
table that is opened on the stack. As tables open and
|
||||
close on the context, we update these objects to track
|
||||
what has/hasn't been seen on a per table basis.
|
||||
**********************************************************/
|
||||
class CTableState {
|
||||
public:
|
||||
CTableState(CTableState *aPreviousState=0) {
|
||||
mHasCaption=PR_FALSE;
|
||||
mHasCols=PR_FALSE;
|
||||
mHasTHead=PR_FALSE;
|
||||
mHasTFoot=PR_FALSE;
|
||||
mHasTBody=PR_FALSE;
|
||||
mPrevious=aPreviousState;
|
||||
}
|
||||
|
||||
PRBool CanOpenCaption() {
|
||||
PRBool result=!(mHasCaption || mHasCols || mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenCols() {
|
||||
PRBool result=!(mHasCols || mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenTHead() {
|
||||
PRBool result=!(mHasTHead || mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool CanOpenTFoot() {
|
||||
PRBool result=!(mHasTFoot || mHasTBody);
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool mHasCaption;
|
||||
PRBool mHasCols;
|
||||
PRBool mHasTHead;
|
||||
PRBool mHasTFoot;
|
||||
PRBool mHasTBody;
|
||||
CTableState *mPrevious;
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
The dtdcontext class defines an ordered list of tags (a context).
|
||||
************************************************************************/
|
||||
|
||||
class nsDTDContext {
|
||||
public:
|
||||
@ -168,9 +212,13 @@ public:
|
||||
nsEntryStack mStack; //this will hold a list of tagentries...
|
||||
PRInt32 mResidualStyleCount;
|
||||
PRInt32 mContextTopIndex;
|
||||
PRBool mHadBody;
|
||||
PRBool mHadFrameset;
|
||||
|
||||
static CNodeRecycler* mNodeRecycler;
|
||||
|
||||
CTableState *mTableStates;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
enum { eMaxTags = 100 };
|
||||
eHTMLTags mXTags[eMaxTags];
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
CLASS_EXPORT_HTMLPARS nsHTMLTokenizer : public nsITokenizer {
|
||||
public:
|
||||
nsHTMLTokenizer( PRInt32 aParseMode=eParseMode_quirks,
|
||||
nsHTMLTokenizer( PRInt32 aParseMode=eDTDMode_quirks,
|
||||
eParserDocType aDocType=eHTML3Text,
|
||||
eParserCommands aCommand=eViewNormal);
|
||||
virtual ~nsHTMLTokenizer();
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
@ -280,7 +279,7 @@ void CStartToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CStartToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("<");
|
||||
anOutputString.AppendWithConversion("<");
|
||||
/*
|
||||
* Watch out for Bug 15204
|
||||
*/
|
||||
@ -434,7 +433,7 @@ void CEndToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CEndToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("</");
|
||||
anOutputString.AppendWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
@ -616,7 +615,7 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
|
||||
}
|
||||
//theTermStrPos=theBuffer.Find(aTerminalString,PR_TRUE,theCurrOffset);
|
||||
if(theTermStrPos>kNotFound) {
|
||||
if(aMode!=eParseMode_noquirks && !theLastIteration) {
|
||||
if(aMode!=eDTDMode_strict && !theLastIteration) {
|
||||
if(!aIgnoreComments) {
|
||||
theCurrOffset=theBuffer.Find("<!--",PR_TRUE,theCurrOffset,5);
|
||||
if(theStartCommentPos==kNotFound && theCurrOffset>kNotFound) {
|
||||
@ -961,8 +960,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||
* @return error result
|
||||
*/
|
||||
nsresult CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
nsresult result=(aMode==eParseMode_noquirks) ? ConsumeStrictComment(aChar,aScanner,mTextValue)
|
||||
: ConsumeComment(aChar,aScanner,mTextValue);
|
||||
nsresult result=(aMode==eDTDMode_strict) ? ConsumeStrictComment(aChar,aScanner,mTextValue) : ConsumeComment(aChar,aScanner,mTextValue);
|
||||
|
||||
#if 0
|
||||
if(NS_OK==result) {
|
||||
@ -1744,7 +1742,7 @@ void CEntityToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CEntityToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("&");
|
||||
anOutputString.AppendWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
@ -1945,7 +1943,7 @@ void CSkippedContentToken::DebugDumpSource(nsOutputStream& out) {
|
||||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::GetSource(nsString& anOutputString){
|
||||
anOutputString.AssignWithConversion("$skipped-content");
|
||||
anOutputString.AppendWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -50,15 +50,15 @@ enum eAutoDetectResult {
|
||||
eInvalidDetect
|
||||
};
|
||||
|
||||
enum eParseMode {
|
||||
|
||||
eParseMode_unknown=0,
|
||||
eParseMode_quirks, //pre 5.0 versions
|
||||
eParseMode_noquirks, //raptor versions...)
|
||||
eParseMode_strict,
|
||||
eParseMode_autodetect
|
||||
enum nsDTDMode {
|
||||
eDTDMode_unknown=0,
|
||||
eDTDMode_quirks, //pre 5.0 versions
|
||||
eDTDMode_noquirks, //raptor versions...)
|
||||
eDTDMode_strict,
|
||||
eDTDMode_autodetect
|
||||
};
|
||||
|
||||
|
||||
class nsIParser;
|
||||
class CToken;
|
||||
class nsIDTDDebug;
|
||||
|
||||
@ -192,14 +192,14 @@ class nsIParser : public nsISupports {
|
||||
virtual nsresult EnableParser(PRBool aState) = 0;
|
||||
virtual PRBool IsParserEnabled() = 0;
|
||||
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,eParseMode aMode=eParseMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
|
||||
|
||||
virtual nsresult Terminate(void) = 0;
|
||||
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect)=0;
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
|
||||
/**
|
||||
* This method gets called when the tokens have been consumed, and it's time
|
||||
@ -216,7 +216,7 @@ class nsIParser : public nsISupports {
|
||||
* @update gess 6/9/98
|
||||
* @return ptr to scanner
|
||||
*/
|
||||
virtual eParseMode GetParseMode(void)=0;
|
||||
virtual nsDTDMode GetParseMode(void)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -427,10 +427,10 @@ nsScanner* nsParser::GetScanner(void){
|
||||
* @update gess 01/04/99
|
||||
* @return parsemode
|
||||
*/
|
||||
eParseMode nsParser::GetParseMode(void){
|
||||
nsDTDMode nsParser::GetParseMode(void){
|
||||
if(mParserContext)
|
||||
return mParserContext->mParseMode;
|
||||
return eParseMode_unknown;
|
||||
return mParserContext->mDTDMode;
|
||||
return eDTDMode_unknown;
|
||||
}
|
||||
|
||||
|
||||
@ -480,10 +480,10 @@ eParseMode nsParser::GetParseMode(void){
|
||||
* @return parsermode (define in nsIParser.h)
|
||||
*/
|
||||
static
|
||||
void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType aDocType) {
|
||||
void DetermineParseMode(nsString& aBuffer,nsDTDMode& aParseMode,eParserDocType aDocType) {
|
||||
const char* theModeStr= PR_GetEnv("PARSE_MODE");
|
||||
|
||||
aParseMode = eParseMode_unknown;
|
||||
aParseMode = eDTDMode_unknown;
|
||||
|
||||
PRInt32 theIndex=aBuffer.Find("DOCTYPE",PR_TRUE,0,10);
|
||||
if(kNotFound<theIndex) {
|
||||
@ -506,13 +506,13 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("XHTML",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eXHTMLText;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
else {
|
||||
theSubIndex=aBuffer.Find("ISO/IEC 15445:",PR_TRUE,theIndex+8,theEnd-(theIndex+8));
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML4Text;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
theMajorVersion=4;
|
||||
theSubIndex+=15;
|
||||
}
|
||||
@ -520,14 +520,14 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("HTML",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML4Text;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
theMajorVersion=3;
|
||||
}
|
||||
else {
|
||||
theSubIndex=aBuffer.Find("HYPERTEXT MARKUP",PR_TRUE,theStartPos,theCount);
|
||||
if(0<=theSubIndex) {
|
||||
aDocType=eHTML3Text;
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
theSubIndex+=20;
|
||||
}
|
||||
}
|
||||
@ -561,7 +561,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
(aBuffer.Find("LATIN1", PR_TRUE,theStartPos,theCount) >kNotFound) ||
|
||||
(aBuffer.Find("SYMBOLS",PR_TRUE,theStartPos,theCount) >kNotFound) ||
|
||||
(aBuffer.Find("SPECIAL",PR_TRUE,theStartPos,theCount) >kNotFound)) {
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
}
|
||||
|
||||
//one last thing: look for a URI that specifies the strict.dtd
|
||||
@ -570,7 +570,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
theSubIndex=aBuffer.Find("STRICT.DTD",PR_TRUE,theStartPos,theCount);
|
||||
if(0<theSubIndex) {
|
||||
//Since we found it, regardless of what's in the descr-text, kick into strict mode.
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
aDocType=eHTML4Text;
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
switch(theMajorVersion) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
if(aDocType!=eXHTMLText){
|
||||
aParseMode=eParseMode_quirks; //be as backward compatible as possible
|
||||
aParseMode=eDTDMode_quirks; //be as backward compatible as possible
|
||||
aDocType=eHTML3Text;
|
||||
}
|
||||
break;
|
||||
@ -587,7 +587,7 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
//XXX hack -- someday, the next line of code will be criticized
|
||||
//for it's lack of vision...
|
||||
if(theMajorVersion>20) {
|
||||
aParseMode=eParseMode_noquirks;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
break;
|
||||
} //switch
|
||||
@ -601,24 +601,24 @@ void DetermineParseMode(nsString& aBuffer,eParseMode& aParseMode,eParserDocType
|
||||
PRInt32 theIDPos=aBuffer.Find("PublicID",thePos);
|
||||
if(kNotFound==theIDPos)
|
||||
theIDPos=aBuffer.Find("SystemID",thePos);
|
||||
aParseMode=(kNotFound==theIDPos) ? eParseMode_quirks : eParseMode_strict;
|
||||
aParseMode=(kNotFound==theIDPos) ? eDTDMode_quirks : eDTDMode_strict;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(kNotFound<(theIndex=aBuffer.Find("?XML",PR_TRUE,0,128))) {
|
||||
aDocType=eXMLText;
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
|
||||
if(theModeStr) {
|
||||
if(0==nsCRT::strcasecmp(theModeStr,"strict"))
|
||||
aParseMode=eParseMode_strict;
|
||||
aParseMode=eDTDMode_strict;
|
||||
}
|
||||
else {
|
||||
if(eParseMode_unknown==aParseMode) {
|
||||
if(eDTDMode_unknown==aParseMode) {
|
||||
aBuffer.InsertWithConversion("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n",0);
|
||||
aDocType=eHTML3Text;
|
||||
aParseMode=eParseMode_quirks;
|
||||
aParseMode=eDTDMode_quirks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -709,14 +709,14 @@ nsresult nsParser::CreateCompatibleDTDForDocType(nsIDTD** aDTD, nsString* aDocTy
|
||||
const nsCID* theDTDClassID=0;
|
||||
|
||||
if(aDocTypeStr) {
|
||||
eParseMode theParseMode=eParseMode_unknown;
|
||||
eParserDocType theDocType=ePlainText;
|
||||
nsDTDMode theParseMode=eDTDMode_unknown;
|
||||
eParserDocType theDocType=ePlainText;
|
||||
|
||||
DetermineParseMode(*aDocTypeStr,theParseMode,theDocType);
|
||||
|
||||
switch(theDocType) {
|
||||
case eHTML4Text:
|
||||
if(theParseMode==eParseMode_strict) {
|
||||
if(theParseMode==eDTDMode_strict) {
|
||||
theDTDClassID=&kCOtherDTDCID;
|
||||
break;
|
||||
}
|
||||
@ -750,17 +750,17 @@ nsresult nsParser::CreateCompatibleDTDForDocType(nsIDTD** aDTD, nsString* aDocTy
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
nsresult nsParser::CreateCompatibleDTDForMimeType(nsIDTD** aDTD,const nsString* aMimeType,
|
||||
eParseMode aParseMode)
|
||||
nsDTDMode aParseMode)
|
||||
{
|
||||
nsresult result=NS_OK;
|
||||
const nsCID* theDTDClassID=0;
|
||||
|
||||
if(aMimeType) {
|
||||
|
||||
NS_ASSERTION(aParseMode!=eParseMode_unknown,"DTD selection might require a parsemode");
|
||||
NS_ASSERTION(aParseMode!=eDTDMode_unknown,"DTD selection might require a parsemode");
|
||||
|
||||
if(aMimeType->EqualsWithConversion(kHTMLTextContentType)) {
|
||||
if(aParseMode==eParseMode_strict) {
|
||||
if(aParseMode==eDTDMode_strict) {
|
||||
theDTDClassID=&kCOtherDTDCID;
|
||||
}
|
||||
else {
|
||||
@ -937,7 +937,7 @@ nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
|
||||
if(!tested) {
|
||||
tested=PR_TRUE;
|
||||
eParseMode theParseMode=eParseMode_unknown;
|
||||
eParseMode theParseMode=eDTDMode_unknown;
|
||||
eParserDocType theDocumentType=ePlainText;
|
||||
|
||||
while(*theDocType) {
|
||||
@ -955,7 +955,7 @@ nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
mMinorIteration=-1;
|
||||
|
||||
nsString& theBuffer=mParserContext->mScanner->GetBuffer();
|
||||
DetermineParseMode(theBuffer,mParserContext->mParseMode,mParserContext->mDocType);
|
||||
DetermineParseMode(theBuffer,mParserContext->mDTDMode,mParserContext->mDocType);
|
||||
|
||||
if(PR_TRUE==FindSuitableDTD(*mParserContext,theBuffer)) {
|
||||
mParserContext->mDTD->WillBuildModel( *mParserContext,mSink);
|
||||
@ -1115,7 +1115,7 @@ PRBool nsParser::IsParserEnabled() {
|
||||
* @param aFilename -- const char* containing file to be parsed.
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,eParseMode aMode) {
|
||||
nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode) {
|
||||
|
||||
NS_PRECONDITION(0!=aURL,kNullURL);
|
||||
|
||||
@ -1154,7 +1154,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
|
||||
* @param aStream is the i/o source
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aVerifyEnabled, void* aKey,eParseMode aMode){
|
||||
nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){
|
||||
|
||||
mDTDVerification=aVerifyEnabled;
|
||||
nsresult result=NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1195,7 +1195,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString&
|
||||
aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
|
||||
aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
||||
|
||||
//NOTE: Make sure that updates to this method don't cause
|
||||
// bug #2361 to break again!
|
||||
@ -1275,7 +1275,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,eParseMode aMode){
|
||||
* @param aMimeType tells us what kind of stuff you're inserting
|
||||
* @return TRUE if valid, otherwise FALSE
|
||||
*/
|
||||
PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,eParseMode aMode){
|
||||
PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
/************************************************************************************
|
||||
This method works like this:
|
||||
@ -1328,7 +1328,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,eParseMode aMode){
|
||||
nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
nsresult result=NS_OK;
|
||||
nsAutoString theContext;
|
||||
|
||||
@ -165,7 +165,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @update gess 6/9/98
|
||||
* @return ptr to scanner
|
||||
*/
|
||||
virtual eParseMode GetParseMode(void);
|
||||
virtual nsDTDMode GetParseMode(void);
|
||||
|
||||
/**
|
||||
* Retrieve the scanner from the topmost parser context
|
||||
@ -182,7 +182,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param aListener is a listener to forward notifications to
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aEnableVerify=PR_FALSE,void* aKey=0,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* Cause parser to parse input from given stream
|
||||
@ -190,7 +190,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param aStream is the i/o source
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
/**
|
||||
* @update gess5/11/98
|
||||
@ -198,10 +198,10 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
|
||||
* @param appendTokens tells us whether we should insert tokens inline, or append them.
|
||||
* @return TRUE if all went well -- FALSE otherwise
|
||||
*/
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,eParseMode aMode=eParseMode_autodetect);
|
||||
virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
|
||||
/**
|
||||
@ -384,7 +384,7 @@ private:
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
static nsresult CreateCompatibleDTDForMimeType(nsIDTD** aDTD, const nsString* aMimeType,
|
||||
eParseMode aParseMode=eParseMode_unknown);
|
||||
nsDTDMode aParseMode=eDTDMode_unknown);
|
||||
/**
|
||||
* Call this method to determine a DTD for a given command
|
||||
*
|
||||
@ -394,6 +394,7 @@ private:
|
||||
* @return NS_OK if succeeded else ERROR.
|
||||
*/
|
||||
static nsresult CreateCompatibleDTDForCommand(nsIDTD** aDTD, eParserCommands aCommand);
|
||||
|
||||
protected:
|
||||
//*********************************************
|
||||
// And now, some data members...
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nspr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -30,6 +31,7 @@
|
||||
#include "nsLoggingSink.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "CNavDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsXIFDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "CRtfDTD.h"
|
||||
@ -209,10 +211,11 @@ nsParserModule::Shutdown()
|
||||
nsHTMLTokenizer::FreeTokenRecycler();
|
||||
nsXMLTokenizer::FreeTokenRecycler();
|
||||
nsExpatTokenizer::FreeTokenRecycler();
|
||||
// nsTextTokenizer::FreeTokenRecycler();
|
||||
nsDTDContext::FreeNodeRecycler();
|
||||
nsParser::FreeSharedObjects();
|
||||
mInitialized = PR_FALSE;
|
||||
COtherDTD::ReleaseTable();
|
||||
CNavDTD::ReleaseTable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext,
|
||||
|
||||
mDocType=aParserContext.mDocType;
|
||||
mMimeType=aParserContext.mMimeType;
|
||||
mParseMode=aParserContext.mParseMode;
|
||||
mDTDMode=aParserContext.mDTDMode;
|
||||
mParserCommand=aParserContext.mParserCommand;
|
||||
|
||||
static const char* theHeader="<?xml version=\"1.0\"?>";
|
||||
@ -486,7 +486,7 @@ nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) {
|
||||
nsresult result=NS_OK;
|
||||
if(!mTokenizer) {
|
||||
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,eParseMode_quirks,mDocType,mParserCommand);
|
||||
result=NS_NewHTMLTokenizer(&mTokenizer,eDTDMode_quirks,mDocType,mParserCommand);
|
||||
}
|
||||
aTokenizer=mTokenizer;
|
||||
return result;
|
||||
|
||||
@ -260,7 +260,7 @@ protected:
|
||||
nsAutoString mKey;
|
||||
nsAutoString mValue;
|
||||
nsAutoString mPopupTag;
|
||||
eParseMode mParseMode;
|
||||
nsDTDMode mDTDMode;
|
||||
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
|
||||
eParserDocType mDocType;
|
||||
nsAutoString mMimeType;
|
||||
|
||||
@ -208,7 +208,7 @@ nsresult nsXMLTokenizer::ConsumeComment(PRUnichar aChar,CToken*& aToken,nsScanne
|
||||
nsAutoString theEmpty;
|
||||
aToken=theRecycler->CreateTokenOfType(eToken_comment,eHTMLTag_comment,theEmpty);
|
||||
if(aToken) {
|
||||
result=aToken->Consume(aChar,aScanner,eParseMode_noquirks);
|
||||
result=aToken->Consume(aChar,aScanner,eDTDMode_strict);
|
||||
AddToken(aToken,result,&mTokenDeque,theRecycler);
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ nsresult nsXMLTokenizer::ConsumeSpecialMarkup(PRUnichar aChar,CToken*& aToken,ns
|
||||
if(isComment) aToken = theRecycler->CreateTokenOfType(eToken_comment,eHTMLTag_comment,theEmpty);
|
||||
|
||||
if(aToken) {
|
||||
result=aToken->Consume(aChar,aScanner,eParseMode_noquirks);
|
||||
result=aToken->Consume(aChar,aScanner,eDTDMode_strict);
|
||||
AddToken(aToken,result,&mTokenDeque,theRecycler);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user