From 091d8a00a7e43f8de24ee4a1b8dba6edf80567c3 Mon Sep 17 00:00:00 2001 From: "pierre%netscape.com" Date: Wed, 10 Feb 1999 09:12:48 +0000 Subject: [PATCH] Fix a crash when interrupting a page load git-svn-id: svn://10.0.0.236/trunk@20238 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsParser.cpp | 38 ++++++++++++---------- mozilla/parser/htmlparser/src/nsParser.cpp | 38 ++++++++++++---------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index f0f64abdeba..642800e4185 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -702,26 +702,28 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD) { nsresult result=NS_OK; if(mParserContext->mParserEnabled) { result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD); - mParserContext->mDTD->WillResumeParse(); - if(NS_OK==result) { - - result=Tokenize(); - result=BuildModel(); + if (mParserContext->mDTD) { + mParserContext->mDTD->WillResumeParse(); + if(NS_OK==result) { + + result=Tokenize(); + result=BuildModel(); - if((!mParserContext->mMultipart) || ((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){ - DidBuildModel(mStreamStatus); - } - 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; - if(NS_ERROR_HTMLPARSER_BLOCK==result) { - EnableParser(PR_FALSE); - result=NS_OK; + if((!mParserContext->mMultipart) || ((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){ + DidBuildModel(mStreamStatus); } - }//if + 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; + if(NS_ERROR_HTMLPARSER_BLOCK==result) { + EnableParser(PR_FALSE); + result=NS_OK; + } + }//if + }//if }//if }//if return result; diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index f0f64abdeba..642800e4185 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -702,26 +702,28 @@ nsresult nsParser::ResumeParse(nsIDTD* aDefaultDTD) { nsresult result=NS_OK; if(mParserContext->mParserEnabled) { result=WillBuildModel(mParserContext->mScanner->GetFilename(),aDefaultDTD); - mParserContext->mDTD->WillResumeParse(); - if(NS_OK==result) { - - result=Tokenize(); - result=BuildModel(); + if (mParserContext->mDTD) { + mParserContext->mDTD->WillResumeParse(); + if(NS_OK==result) { + + result=Tokenize(); + result=BuildModel(); - if((!mParserContext->mMultipart) || ((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){ - DidBuildModel(mStreamStatus); - } - 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; - if(NS_ERROR_HTMLPARSER_BLOCK==result) { - EnableParser(PR_FALSE); - result=NS_OK; + if((!mParserContext->mMultipart) || ((eOnStop==mParserContext->mStreamListenerState) && (NS_OK==result))){ + DidBuildModel(mStreamStatus); } - }//if + 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; + if(NS_ERROR_HTMLPARSER_BLOCK==result) { + EnableParser(PR_FALSE); + result=NS_OK; + } + }//if + }//if }//if }//if return result;