From 81de7a518e2fc86f2464af5db802f3f87dea2200 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Thu, 13 Jan 2005 03:05:12 +0000 Subject: [PATCH] bug 274786: We lose a trailing <, SetInError(PR_TRUE); + + // Note: We know here that the scanner is not incremental since if + // this peek fails, then we've already masked over a kEOF coming from + // the Consume() call above. + return NS_OK; } - NS_ENSURE_SUCCESS(result, result); if(kGreaterThan != aChar) { //look for '>' result = ConsumeAttributes(aChar, aToken, aScanner); @@ -866,8 +881,12 @@ nsresult nsHTMLTokenizer::ConsumeEndTag(PRUnichar aChar,CToken*& aToken,nsScanne result = aScanner.Peek(aChar); if (NS_FAILED(result)) { aToken->SetInError(PR_TRUE); + + // Note: We know here that the scanner is not incremental since if + // this peek fails, then we've already masked over a kEOF coming from + // the Consume() call above. + return NS_OK; } - NS_ENSURE_SUCCESS(result, result); if(kGreaterThan != aChar) { result = ConsumeAttributes(aChar, aToken, aScanner); diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp index b36f79914b4..6278b7490f8 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp @@ -1417,7 +1417,7 @@ nsresult CCommentToken::ConsumeQuirksComment(nsScanner& aScanner) // wait for more content, and try again. // XXX For performance reasons we should cache where we were, and // continue from there for next call - return kEOF; // not really an nsresult, but... + return kEOF; } // If you're here, then we're in a special state. @@ -1469,7 +1469,14 @@ nsresult CCommentToken::ConsumeQuirksComment(nsScanner& aScanner) return NS_OK; } - return kEOF; // not really an nsresult, but... + if (!aScanner.IsIncremental()) { + // This isn't a comment at all, go back to the < and consume as text. + aScanner.SetPosition(lt, PR_FALSE, PR_TRUE); + return kNotAComment; + } + + // Wait for more data... + return kEOF; } /*