Don't create extra parser contexts once the parser has been terminated. Also make sure to clean up any extra parser contexts if they do get created. bug 323441, r=sicking sr=jst

This commit is contained in:
mrbkap%gmail.com 2006-02-01 18:57:09 +00:00
Родитель e624f8f622
Коммит 6917a6e3d9
1 изменённых файлов: 15 добавлений и 4 удалений

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

@ -299,11 +299,17 @@ nsParser::~nsParser()
}
#endif
#ifdef DEBUG_mrbkap
NS_ASSERTION(!mParserContext || !mParserContext->mPrevContext,
"Leaking parsercontexts");
#ifdef DEBUG
if (mParserContext && mParserContext->mPrevContext) {
NS_WARNING("Extra parser contexts still on the parser stack");
}
#endif
delete mParserContext;
while (mParserContext) {
CParserContext *pc = mParserContext->mPrevContext;
delete mParserContext;
mParserContext = pc;
}
if (mFlags & NS_PARSER_FLAG_PENDING_CONTINUE_EVENT) {
NS_ASSERTION(mEventQueue != nsnull, "Event queue is null");
@ -1343,6 +1349,11 @@ nsParser::Parse(const nsAString& aSourceBuffer,
{
nsresult result = NS_OK;
// Don't bother if we're never going to parse this.
if (mInternalState == NS_ERROR_HTMLPARSER_STOPPARSING) {
return result;
}
if (!aLastCall && aSourceBuffer.IsEmpty()) {
// Nothing is being passed to the parser so return
// immediately. mUnusedInput will get processed when