backing out harishd 3:50PM checkin a=mcafee

This commit is contained in:
bienvenu%netscape.com 2000-01-14 06:57:53 +00:00
Родитель 745ea114fe
Коммит d06112b188
24 изменённых файлов: 114 добавлений и 248 удалений

Просмотреть файл

@ -682,7 +682,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
//by forcefully recycling any tokens we might find there.
CToken* theToken=0;
while((theToken=(CToken*)mMisplacedContent.Pop())) {
while(theToken=(CToken*)mMisplacedContent.Pop()) {
mTokenRecycler->RecycleToken(theToken);
}
@ -1327,8 +1327,8 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
theToken->mUseCount++;
// If the token is attributed then save those attributes too.
if(attrCount > 0 && aNode) PushMisplacedAttributes(*aNode,mMisplacedContent,attrCount);
if(attrCount > 0) PushMisplacedAttributes(*aNode,mMisplacedContent,attrCount);
theToken=mTokenizer->PeekToken();
if(theToken) {
@ -1446,7 +1446,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
aToken->SetTypeID(theChildTag=eHTMLTag_img);
break;
//case eHTMLTag_userdefined:
case eHTMLTag_userdefined:
case eHTMLTag_noscript: //HACK XXX! Throw noscript on the floor for now.
isTokenHandled=PR_TRUE;
break;

Просмотреть файл

@ -1283,10 +1283,10 @@ void InitializeElementTable(void) {
Initialize(
/*tag*/ eHTMLTag_userdefined,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_frameset,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*rootnodes,endrootnodes*/ &gInHTML,&gInHTML,
/*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kFlowEntity, (kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kLegalOpen, kBodyPropRange,
/*parent,incl,exclgroups*/ kHTMLContent, (kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kOmitEndTag|kLegalOpen, kBodyPropRange,
/*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown);
}//if
};

Просмотреть файл

@ -284,7 +284,7 @@ nsresult nsHTMLTokenizer::DidTokenize(PRBool aIsFinalChunk)
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner) {
PRUnichar theChar;
CToken* theToken=0;
@ -304,7 +304,7 @@ nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)
if(!mPlainText) {
if(kLessThan==theChar) {
return ConsumeTag(theChar,theToken,aScanner,aFlushTokens);
return ConsumeTag(theChar,theToken,aScanner);
}
else if(kAmpersand==theChar){
return ConsumeEntity(theChar,theToken,aScanner);
@ -340,7 +340,7 @@ nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)
* @param aToken is the out arg holding our new token
* @return error code.
*/
nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner) {
nsresult result=aScanner.GetChar(aChar);
@ -376,7 +376,7 @@ nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner&
default:
if(nsString::IsAlpha(aChar))
result=ConsumeStartTag(aChar,aToken,aScanner,aFlushTokens);
result=ConsumeStartTag(aChar,aToken,aScanner);
else if(kEOF!=aChar) {
// We are not dealing with a tag. So, put back the char
// and leave the decision to ConsumeText().
@ -482,7 +482,7 @@ nsresult nsHTMLTokenizer::ConsumeScriptContent(nsScanner& aScanner,CToken*& aTok
* @param
* @return
*/
nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner) {
PRInt32 theDequeSize=mTokenDeque.GetSize(); //remember this for later in case you have to unwind...
nsresult result=NS_OK;
@ -512,7 +512,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
endTag.Insert("</",0,2);
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_TRUE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_TRUE,aScanner,endTag,mParseMode); //tell new token to finish consuming text...
//endTag.Append(">");
CToken* endToken=theRecycler->CreateTokenOfType(eToken_end,theTag,endTag);
AddToken(textToken,result,&mTokenDeque,theRecycler);

Просмотреть файл

@ -60,7 +60,7 @@ public:
NS_DECL_ISUPPORTS
virtual nsresult WillTokenize(PRBool aIsFinalChunk);
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeToken(nsScanner& aScanner);
virtual nsresult DidTokenize(PRBool aIsFinalChunk);
virtual nsITokenRecycler* GetTokenRecycler(void);
@ -77,8 +77,8 @@ public:
protected:
virtual nsresult ConsumeScriptContent(nsScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeEndTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeAttributes(PRUnichar aChar,CStartToken* aToken,nsScanner& aScanner);
virtual nsresult ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);

Просмотреть файл

@ -505,8 +505,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
* @param aScanner -- controller of underlying input source
* @return error result
*/
nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
nsString& aTerminalString,PRInt32 aMode,PRBool& aFlushTokens){
nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,nsString& aTerminalString,PRInt32 aMode){
PRBool done=PR_FALSE;
nsresult result=NS_OK;
PRUnichar theChar;
@ -558,15 +557,12 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
rpos=theRight.RFindChar('<'); //now scan for the '<'
if(-1<rpos) {
rpos=theRight.RFind(aTerminalString,PR_TRUE);
if(-1<rpos) {
if(-1<rpos && aMode!=eParseMode_noquirks) {
nsAutoString temp(theRight);
temp.Cut(0,rpos);
if(aMode!=eParseMode_noquirks) {
temp.StripWhitespace();
}
temp.StripWhitespace();
PRUnichar ch=temp.CharAt(aTerminalString.Length());
rpos=(ch==kGreaterThan)? rpos:kNotFound;
aFlushTokens=(-1<rpos)?PR_TRUE:PR_FALSE; // We found </SCRIPT>...permit flushing -> Ref: Bug 22485
}
}
done=PRBool(-1<rpos);

Просмотреть файл

@ -226,8 +226,7 @@ class CTextToken: public CHTMLToken {
CTextToken();
CTextToken(const nsString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
nsString& aTerminalString,PRInt32 aMode,PRBool& aFlushTokens);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,nsString& aTerminalString,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};

Просмотреть файл

@ -68,7 +68,7 @@ class nsITokenizer : public nsISupports {
public:
virtual nsresult WillTokenize(PRBool aIsFinalChunk)=0;
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
virtual nsresult ConsumeToken(nsScanner& aScanner)=0;
virtual nsresult DidTokenize(PRBool aIsFinalChunk)=0;
virtual nsITokenRecycler* GetTokenRecycler(void)=0;

Просмотреть файл

@ -601,9 +601,6 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
*/
void nsParser::PushContext(CParserContext& aContext) {
aContext.mPrevContext=mParserContext;
if (mParserContext) {
aContext.mParserEnabled = mParserContext->mParserEnabled;
}
mParserContext=&aContext;
}
@ -970,68 +967,42 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD);
if(mParserContext->mDTD) {
mParserContext->mDTD->WillResumeParse();
if(NS_OK==result) {
nsresult theTokenizerResult=NS_OK;
while(result==NS_OK) {
if(NS_OK==result) {
if(mUnusedInput.Length()>0) {
if(mParserContext->mScanner) {
// -- Ref: Bug# 22485 --
// Insert the unused input into the source buffer
// as if it was read from the input stream.
// Adding Insert() per vidur!!
mParserContext->mScanner->Insert(mUnusedInput);
mUnusedInput.Truncate(0);
}
}
result=Tokenize(aIsFinalChunk);
if(result!=NS_OK) theTokenizerResult=result;
result=BuildModel();
result=Tokenize(aIsFinalChunk);
result=BuildModel();
if(result==NS_ERROR_HTMLPARSER_STOPPARSING) mInternalState=result;
if(result==NS_ERROR_HTMLPARSER_STOPPARSING) mInternalState=result;
// Make sure not to stop parsing too early. Therefore, before shutting down the
// parser, it's important to check whether the input buffer has been scanned to
// completion ( theTokenizerResult should be kEOF ). kEOF -> End of buffer.
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result) && (theTokenizerResult==kEOF))){
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){
DidBuildModel(mStreamStatus);
DidBuildModel(mStreamStatus);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
return mInternalState;
}
// If we're told to block the parser, we disable
// all further parsing (and cache any data coming
// in) until the parser is enabled.
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
return mInternalState;
}
else {
mParserContext->mDTD->WillInterruptParse();
// If we're told to block the parser, we disable
// all further parsing (and cache any data coming
// in) until the parser is enabled.
//PRUint32 b1=NS_ERROR_HTMLPARSER_BLOCK;
else if(NS_ERROR_HTMLPARSER_BLOCK==result) {
mParserContext->mDTD->WillInterruptParse();
result=EnableParser(PR_FALSE);
break;
if(NS_ERROR_HTMLPARSER_BLOCK==result) {
result=EnableParser(PR_FALSE);
}
// If we're at the end of the current scanner buffer,
// we interrupt parsing and wait for the next one
else if (theTokenizerResult==kEOF) {
mParserContext->mDTD->WillInterruptParse();
break;
}
}//while
}//if
}//if
}//if
else {
@ -1466,8 +1437,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
nsITokenizer* theTokenizer=0;
nsresult result=mParserContext->mDTD->GetTokenizer(theTokenizer);
if(theTokenizer){
PRBool flushTokens=PR_FALSE;
if(theTokenizer){
MOZ_TIMER_START(mTokenizeTime);
@ -1475,21 +1445,15 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
while(NS_SUCCEEDED(result)) {
mParserContext->mScanner->Mark();
++mMinorIteration;
result=theTokenizer->ConsumeToken(*mParserContext->mScanner,flushTokens);
if(NS_FAILED(result)) {
result=theTokenizer->ConsumeToken(*mParserContext->mScanner);
if(!NS_SUCCEEDED(result)) {
mParserContext->mScanner->RewindToMark();
if(kEOF==result) {
if(kEOF==result){
result=NS_OK;
break;
}
else if(NS_ERROR_HTMLPARSER_STOPPARSING==result){
else if(NS_ERROR_HTMLPARSER_STOPPARSING==result)
return Terminate();
}
}
else if(flushTokens) {
// Flush tokens on seeing </SCRIPT> -- Ref: Bug# 22485 --
// Also remember to update the marked position.
mParserContext->mScanner->Mark();
break;
}
}
DidTokenize(aIsFinalChunk);

Просмотреть файл

@ -231,22 +231,6 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){
return 0;
}
/**
* Insert data to our underlying input buffer as
* if it were read from an input stream.
*
* @update harishd 01/12/99
* @return error code
*/
PRBool nsScanner::Insert(const nsString& aBuffer) {
PRInt32 theLen=aBuffer.Length();
mBuffer.Insert(aBuffer,mOffset,theLen);
mTotalRead+=theLen;
return PR_TRUE;
}
/**
* Append data to our underlying input buffer as

Просмотреть файл

@ -261,16 +261,6 @@ class nsScanner {
PRBool Append(const PRUnichar* aBuffer, PRUint32 aLen);
/**
*
*
* @update harishd 01/12/99
* @param
* @return
*/
PRBool Insert(const nsString& aBuffer);
/**
*
*
@ -341,7 +331,7 @@ class nsScanner {
nsString mBuffer;
nsString mFilename;
PRUint32 mOffset;
PRUint32 mMarkPos;
PRUint32 mMarkPos;
PRUint32 mTotalRead;
PRBool mOwnsStream;
PRBool mIncremental;

Просмотреть файл

@ -145,8 +145,8 @@ nsXMLTokenizer::~nsXMLTokenizer(){
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
nsresult nsXMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens) {
return nsHTMLTokenizer::ConsumeToken(aScanner,aFlushTokens);
nsresult nsXMLTokenizer::ConsumeToken(nsScanner& aScanner) {
return nsHTMLTokenizer::ConsumeToken(aScanner);
}

Просмотреть файл

@ -59,7 +59,7 @@ public:
NS_DECL_ISUPPORTS
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeToken(nsScanner& aScanner);
virtual nsITokenRecycler* GetTokenRecycler(void);
static void FreeTokenRecycler(void);

Просмотреть файл

@ -682,7 +682,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
//by forcefully recycling any tokens we might find there.
CToken* theToken=0;
while((theToken=(CToken*)mMisplacedContent.Pop())) {
while(theToken=(CToken*)mMisplacedContent.Pop()) {
mTokenRecycler->RecycleToken(theToken);
}
@ -1327,8 +1327,8 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
theToken->mUseCount++;
// If the token is attributed then save those attributes too.
if(attrCount > 0 && aNode) PushMisplacedAttributes(*aNode,mMisplacedContent,attrCount);
if(attrCount > 0) PushMisplacedAttributes(*aNode,mMisplacedContent,attrCount);
theToken=mTokenizer->PeekToken();
if(theToken) {
@ -1446,7 +1446,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
aToken->SetTypeID(theChildTag=eHTMLTag_img);
break;
//case eHTMLTag_userdefined:
case eHTMLTag_userdefined:
case eHTMLTag_noscript: //HACK XXX! Throw noscript on the floor for now.
isTokenHandled=PR_TRUE;
break;

Просмотреть файл

@ -1283,10 +1283,10 @@ void InitializeElementTable(void) {
Initialize(
/*tag*/ eHTMLTag_userdefined,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_frameset,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*rootnodes,endrootnodes*/ &gInHTML,&gInHTML,
/*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kFlowEntity, (kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kLegalOpen, kBodyPropRange,
/*parent,incl,exclgroups*/ kHTMLContent, (kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kOmitEndTag|kLegalOpen, kBodyPropRange,
/*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown);
}//if
};

Просмотреть файл

@ -284,7 +284,7 @@ nsresult nsHTMLTokenizer::DidTokenize(PRBool aIsFinalChunk)
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner) {
PRUnichar theChar;
CToken* theToken=0;
@ -304,7 +304,7 @@ nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)
if(!mPlainText) {
if(kLessThan==theChar) {
return ConsumeTag(theChar,theToken,aScanner,aFlushTokens);
return ConsumeTag(theChar,theToken,aScanner);
}
else if(kAmpersand==theChar){
return ConsumeEntity(theChar,theToken,aScanner);
@ -340,7 +340,7 @@ nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)
* @param aToken is the out arg holding our new token
* @return error code.
*/
nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner) {
nsresult result=aScanner.GetChar(aChar);
@ -376,7 +376,7 @@ nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner&
default:
if(nsString::IsAlpha(aChar))
result=ConsumeStartTag(aChar,aToken,aScanner,aFlushTokens);
result=ConsumeStartTag(aChar,aToken,aScanner);
else if(kEOF!=aChar) {
// We are not dealing with a tag. So, put back the char
// and leave the decision to ConsumeText().
@ -482,7 +482,7 @@ nsresult nsHTMLTokenizer::ConsumeScriptContent(nsScanner& aScanner,CToken*& aTok
* @param
* @return
*/
nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens) {
nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner) {
PRInt32 theDequeSize=mTokenDeque.GetSize(); //remember this for later in case you have to unwind...
nsresult result=NS_OK;
@ -512,7 +512,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
endTag.Insert("</",0,2);
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_TRUE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_TRUE,aScanner,endTag,mParseMode); //tell new token to finish consuming text...
//endTag.Append(">");
CToken* endToken=theRecycler->CreateTokenOfType(eToken_end,theTag,endTag);
AddToken(textToken,result,&mTokenDeque,theRecycler);

Просмотреть файл

@ -60,7 +60,7 @@ public:
NS_DECL_ISUPPORTS
virtual nsresult WillTokenize(PRBool aIsFinalChunk);
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeToken(nsScanner& aScanner);
virtual nsresult DidTokenize(PRBool aIsFinalChunk);
virtual nsITokenRecycler* GetTokenRecycler(void);
@ -77,8 +77,8 @@ public:
protected:
virtual nsresult ConsumeScriptContent(nsScanner& aScanner,CToken*& aToken);
virtual nsresult ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeEndTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);
virtual nsresult ConsumeAttributes(PRUnichar aChar,CStartToken* aToken,nsScanner& aScanner);
virtual nsresult ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner);

Просмотреть файл

@ -505,8 +505,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
* @param aScanner -- controller of underlying input source
* @return error result
*/
nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
nsString& aTerminalString,PRInt32 aMode,PRBool& aFlushTokens){
nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,nsString& aTerminalString,PRInt32 aMode){
PRBool done=PR_FALSE;
nsresult result=NS_OK;
PRUnichar theChar;
@ -558,15 +557,12 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
rpos=theRight.RFindChar('<'); //now scan for the '<'
if(-1<rpos) {
rpos=theRight.RFind(aTerminalString,PR_TRUE);
if(-1<rpos) {
if(-1<rpos && aMode!=eParseMode_noquirks) {
nsAutoString temp(theRight);
temp.Cut(0,rpos);
if(aMode!=eParseMode_noquirks) {
temp.StripWhitespace();
}
temp.StripWhitespace();
PRUnichar ch=temp.CharAt(aTerminalString.Length());
rpos=(ch==kGreaterThan)? rpos:kNotFound;
aFlushTokens=(-1<rpos)?PR_TRUE:PR_FALSE; // We found </SCRIPT>...permit flushing -> Ref: Bug 22485
}
}
done=PRBool(-1<rpos);

Просмотреть файл

@ -226,8 +226,7 @@ class CTextToken: public CHTMLToken {
CTextToken();
CTextToken(const nsString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
nsString& aTerminalString,PRInt32 aMode,PRBool& aFlushTokens);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,nsString& aTerminalString,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};

Просмотреть файл

@ -68,7 +68,7 @@ class nsITokenizer : public nsISupports {
public:
virtual nsresult WillTokenize(PRBool aIsFinalChunk)=0;
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
virtual nsresult ConsumeToken(nsScanner& aScanner)=0;
virtual nsresult DidTokenize(PRBool aIsFinalChunk)=0;
virtual nsITokenRecycler* GetTokenRecycler(void)=0;

Просмотреть файл

@ -601,9 +601,6 @@ nsresult nsParser::DidBuildModel(nsresult anErrorCode) {
*/
void nsParser::PushContext(CParserContext& aContext) {
aContext.mPrevContext=mParserContext;
if (mParserContext) {
aContext.mParserEnabled = mParserContext->mParserEnabled;
}
mParserContext=&aContext;
}
@ -970,68 +967,42 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD, PRBool aIsFinalChunk) {
result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD);
if(mParserContext->mDTD) {
mParserContext->mDTD->WillResumeParse();
if(NS_OK==result) {
nsresult theTokenizerResult=NS_OK;
while(result==NS_OK) {
if(NS_OK==result) {
if(mUnusedInput.Length()>0) {
if(mParserContext->mScanner) {
// -- Ref: Bug# 22485 --
// Insert the unused input into the source buffer
// as if it was read from the input stream.
// Adding Insert() per vidur!!
mParserContext->mScanner->Insert(mUnusedInput);
mUnusedInput.Truncate(0);
}
}
result=Tokenize(aIsFinalChunk);
if(result!=NS_OK) theTokenizerResult=result;
result=BuildModel();
result=Tokenize(aIsFinalChunk);
result=BuildModel();
if(result==NS_ERROR_HTMLPARSER_STOPPARSING) mInternalState=result;
if(result==NS_ERROR_HTMLPARSER_STOPPARSING) mInternalState=result;
// Make sure not to stop parsing too early. Therefore, before shutting down the
// parser, it's important to check whether the input buffer has been scanned to
// completion ( theTokenizerResult should be kEOF ). kEOF -> End of buffer.
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result) && (theTokenizerResult==kEOF))){
if((!mParserContext->mMultipart) || (mInternalState==NS_ERROR_HTMLPARSER_STOPPARSING) ||
((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){
DidBuildModel(mStreamStatus);
DidBuildModel(mStreamStatus);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: nsParser::ResumeParse(), this=%p\n", this));
MOZ_TIMER_STOP(mParseTime);
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
MOZ_TIMER_LOG(("Parse Time (this=%p): ", this));
MOZ_TIMER_PRINT(mParseTime);
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("DTD Time: "));
MOZ_TIMER_PRINT(mDTDTime);
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
return mInternalState;
}
// If we're told to block the parser, we disable
// all further parsing (and cache any data coming
// in) until the parser is enabled.
MOZ_TIMER_LOG(("Tokenize Time: "));
MOZ_TIMER_PRINT(mTokenizeTime);
return mInternalState;
}
else {
mParserContext->mDTD->WillInterruptParse();
// If we're told to block the parser, we disable
// all further parsing (and cache any data coming
// in) until the parser is enabled.
//PRUint32 b1=NS_ERROR_HTMLPARSER_BLOCK;
else if(NS_ERROR_HTMLPARSER_BLOCK==result) {
mParserContext->mDTD->WillInterruptParse();
result=EnableParser(PR_FALSE);
break;
if(NS_ERROR_HTMLPARSER_BLOCK==result) {
result=EnableParser(PR_FALSE);
}
// If we're at the end of the current scanner buffer,
// we interrupt parsing and wait for the next one
else if (theTokenizerResult==kEOF) {
mParserContext->mDTD->WillInterruptParse();
break;
}
}//while
}//if
}//if
}//if
else {
@ -1466,8 +1437,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
nsITokenizer* theTokenizer=0;
nsresult result=mParserContext->mDTD->GetTokenizer(theTokenizer);
if(theTokenizer){
PRBool flushTokens=PR_FALSE;
if(theTokenizer){
MOZ_TIMER_START(mTokenizeTime);
@ -1475,21 +1445,15 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
while(NS_SUCCEEDED(result)) {
mParserContext->mScanner->Mark();
++mMinorIteration;
result=theTokenizer->ConsumeToken(*mParserContext->mScanner,flushTokens);
if(NS_FAILED(result)) {
result=theTokenizer->ConsumeToken(*mParserContext->mScanner);
if(!NS_SUCCEEDED(result)) {
mParserContext->mScanner->RewindToMark();
if(kEOF==result) {
if(kEOF==result){
result=NS_OK;
break;
}
else if(NS_ERROR_HTMLPARSER_STOPPARSING==result){
else if(NS_ERROR_HTMLPARSER_STOPPARSING==result)
return Terminate();
}
}
else if(flushTokens) {
// Flush tokens on seeing </SCRIPT> -- Ref: Bug# 22485 --
// Also remember to update the marked position.
mParserContext->mScanner->Mark();
break;
}
}
DidTokenize(aIsFinalChunk);

Просмотреть файл

@ -231,22 +231,6 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){
return 0;
}
/**
* Insert data to our underlying input buffer as
* if it were read from an input stream.
*
* @update harishd 01/12/99
* @return error code
*/
PRBool nsScanner::Insert(const nsString& aBuffer) {
PRInt32 theLen=aBuffer.Length();
mBuffer.Insert(aBuffer,mOffset,theLen);
mTotalRead+=theLen;
return PR_TRUE;
}
/**
* Append data to our underlying input buffer as

Просмотреть файл

@ -261,16 +261,6 @@ class nsScanner {
PRBool Append(const PRUnichar* aBuffer, PRUint32 aLen);
/**
*
*
* @update harishd 01/12/99
* @param
* @return
*/
PRBool Insert(const nsString& aBuffer);
/**
*
*
@ -341,7 +331,7 @@ class nsScanner {
nsString mBuffer;
nsString mFilename;
PRUint32 mOffset;
PRUint32 mMarkPos;
PRUint32 mMarkPos;
PRUint32 mTotalRead;
PRBool mOwnsStream;
PRBool mIncremental;

Просмотреть файл

@ -145,8 +145,8 @@ nsXMLTokenizer::~nsXMLTokenizer(){
* @param anErrorCode: arg that will hold error condition
* @return new token or null
*/
nsresult nsXMLTokenizer::ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens) {
return nsHTMLTokenizer::ConsumeToken(aScanner,aFlushTokens);
nsresult nsXMLTokenizer::ConsumeToken(nsScanner& aScanner) {
return nsHTMLTokenizer::ConsumeToken(aScanner);
}

Просмотреть файл

@ -59,7 +59,7 @@ public:
NS_DECL_ISUPPORTS
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);
virtual nsresult ConsumeToken(nsScanner& aScanner);
virtual nsITokenRecycler* GetTokenRecycler(void);
static void FreeTokenRecycler(void);