bug 296212: If the very last character in a document is an &, it gets lost (in both view-source and regular content). r=jst sr=bzbarsky a=chofmann
git-svn-id: svn://10.0.0.236/trunk@174096 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=2 et tw=78: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -1037,7 +1038,7 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,
|
||||
IF_FREE(aToken, mTokenAllocator);
|
||||
}
|
||||
else {
|
||||
if (mIsFinalChunk && result == kEOF) {
|
||||
if (!aScanner.IsIncremental() && result == kEOF) {
|
||||
result=NS_OK; // Use as much of the entity as you can get.
|
||||
}
|
||||
AddToken(aToken,result,&mTokenDeque,theAllocator);
|
||||
@@ -1047,6 +1048,13 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,
|
||||
// Oops, we're actually looking at plain text...
|
||||
result = ConsumeText(aToken,aScanner);
|
||||
}
|
||||
else if (result == kEOF && !aScanner.IsIncremental()) {
|
||||
// If the last character in the file is an &, consume it as text.
|
||||
result = ConsumeText(aToken, aScanner);
|
||||
if (aToken) {
|
||||
aToken->SetInError(PR_TRUE);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user