bug 323736: Handle bogus comments that start with </ as invalid comments, per HTML5 and to have compatibility with other browsers. r+sr=jst

git-svn-id: svn://10.0.0.236/trunk@187790 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2006-01-19 00:05:21 +00:00
parent 02be14268b
commit 8349a92ef5

View File

@@ -1242,13 +1242,16 @@ CCommentToken::ConsumeStrictComment(nsScanner& aScanner)
lt = current;
lt.advance(-2); // <!
current.advance(-1);
// Regular comment must start with <!--
if (current != end && *current == kMinus &&
if (*current == kExclamation &&
++current != end && *current == kMinus &&
++current != end && *current == kMinus &&
++current != end) {
nsScannerIterator currentEnd = end;
PRBool balancedComment = PR_FALSE;
static NS_NAMED_LITERAL_STRING(dashes, "--");
NS_NAMED_LITERAL_STRING(dashes, "--");
beginData = current;
while (FindInReadable(dashes, current, currentEnd)) {
@@ -1265,10 +1268,10 @@ CCommentToken::ConsumeStrictComment(nsScanner& aScanner)
aScanner.BindSubstring(mCommentDecl, lt, ++gt);
aScanner.SetPosition(gt);
return NS_OK;
} else {
// Continue after the last '--'
currentEnd = end;
}
// Continue after the last '--'
currentEnd = end;
}
}