From 974467d75c7c04b09a6dd229aedcd1304034fc7e Mon Sep 17 00:00:00 2001 From: "harishd%netscape.com" Date: Mon, 14 Jan 2002 23:42:53 +0000 Subject: [PATCH] Fixing regressions: In order to update the expat buffer position correctly do not block after processing a start element. b=119399, r=heikki, sr=jst. Update the expat buffer position if we're blocked after processing the end element. b=119727, r=heikki, sr=jst --- expat/xmlparse/xmlparse.c | 1 + htmlparser/src/nsExpatDriver.cpp | 13 ++++--------- parser/expat/lib/xmlparse.c | 1 + parser/htmlparser/src/nsExpatDriver.cpp | 13 ++++--------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c index 32445383afdd..d3033c3a8cc1 100644 --- a/expat/xmlparse/xmlparse.c +++ b/expat/xmlparse/xmlparse.c @@ -1500,6 +1500,7 @@ doContent(XML_Parser parser, } endElementHandler(handlerArg, tag->name.str); if (blocked) { + *eventPP = s = next; /* fix bug 119727 */ return XML_ERROR_PARSER_BLOCKED; } } diff --git a/htmlparser/src/nsExpatDriver.cpp b/htmlparser/src/nsExpatDriver.cpp index a6769f9535a9..a51569398f69 100644 --- a/htmlparser/src/nsExpatDriver.cpp +++ b/htmlparser/src/nsExpatDriver.cpp @@ -378,15 +378,10 @@ nsExpatDriver::HandleStartElement(const PRUnichar *aValue, NS_ASSERTION(mSink, "content sink not found!"); if (mSink){ - nsresult result = mSink->HandleStartElement(aValue, aAtts, - XML_GetSpecifiedAttributeCount(mExpatParser) / 2, - XML_GetIdAttributeIndex(mExpatParser), - XML_GetCurrentLineNumber(mExpatParser)); - - if (result == NS_ERROR_HTMLPARSER_BLOCK) { - mInternalState = NS_ERROR_HTMLPARSER_BLOCK; - XML_BlockParser(mExpatParser); - } + mSink->HandleStartElement(aValue, aAtts, + XML_GetSpecifiedAttributeCount(mExpatParser) / 2, + XML_GetIdAttributeIndex(mExpatParser), + XML_GetCurrentLineNumber(mExpatParser)); } return NS_OK; } diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c index 32445383afdd..d3033c3a8cc1 100644 --- a/parser/expat/lib/xmlparse.c +++ b/parser/expat/lib/xmlparse.c @@ -1500,6 +1500,7 @@ doContent(XML_Parser parser, } endElementHandler(handlerArg, tag->name.str); if (blocked) { + *eventPP = s = next; /* fix bug 119727 */ return XML_ERROR_PARSER_BLOCKED; } } diff --git a/parser/htmlparser/src/nsExpatDriver.cpp b/parser/htmlparser/src/nsExpatDriver.cpp index a6769f9535a9..a51569398f69 100644 --- a/parser/htmlparser/src/nsExpatDriver.cpp +++ b/parser/htmlparser/src/nsExpatDriver.cpp @@ -378,15 +378,10 @@ nsExpatDriver::HandleStartElement(const PRUnichar *aValue, NS_ASSERTION(mSink, "content sink not found!"); if (mSink){ - nsresult result = mSink->HandleStartElement(aValue, aAtts, - XML_GetSpecifiedAttributeCount(mExpatParser) / 2, - XML_GetIdAttributeIndex(mExpatParser), - XML_GetCurrentLineNumber(mExpatParser)); - - if (result == NS_ERROR_HTMLPARSER_BLOCK) { - mInternalState = NS_ERROR_HTMLPARSER_BLOCK; - XML_BlockParser(mExpatParser); - } + mSink->HandleStartElement(aValue, aAtts, + XML_GetSpecifiedAttributeCount(mExpatParser) / 2, + XML_GetIdAttributeIndex(mExpatParser), + XML_GetCurrentLineNumber(mExpatParser)); } return NS_OK; }