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

This commit is contained in:
mrbkap%gmail.com 2006-01-19 00:05:21 +00:00
parent 535505b34d
commit 19fbc54999

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;
}
}