diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp
index 0ee9b3e17e3..9cc2d0d7696 100644
--- a/mozilla/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp
@@ -1006,21 +1006,24 @@ CCommentToken::CCommentToken(const nsAReadableString& aName) : CHTMLToken(eHTMLT
mTextValue.Assign(aName);
}
-// We must test if we have whitespace and >
-static PRBool IsGoodCommentEnd(
+static PRBool IsCommentEnd(
const nsReadingIterator& aCurrent,
const nsReadingIterator& aEnd,
nsReadingIterator& aGt)
{
nsReadingIterator current = aCurrent;
+ PRInt32 dashes = 0;
- while (current != aEnd) {
+ while ((current != aEnd) && (dashes != 2)) {
if (*current == kGreaterThan) {
aGt = current;
return PR_TRUE;
}
- if (!nsString::IsSpace(*current))
- break;
+ if (*current == PRUnichar('-')) {
+ dashes++;
+ } else {
+ dashes = 0;
+ }
++current;
}
@@ -1053,7 +1056,7 @@ nsresult ConsumeStrictComment(nsScanner& aScanner, nsString& aString) {
}
balancedComment = !balancedComment; // We need to match '--' with '--'
- if (balancedComment && IsGoodCommentEnd(current, end, gt)) {
+ if (balancedComment && IsCommentEnd(current, end, gt)) {
// done
current.advance(-2);
if (beginData != current) { // protects from
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
index 0ee9b3e17e3..9cc2d0d7696 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -1006,21 +1006,24 @@ CCommentToken::CCommentToken(const nsAReadableString& aName) : CHTMLToken(eHTMLT
mTextValue.Assign(aName);
}
-// We must test if we have whitespace and >
-static PRBool IsGoodCommentEnd(
+static PRBool IsCommentEnd(
const nsReadingIterator& aCurrent,
const nsReadingIterator& aEnd,
nsReadingIterator& aGt)
{
nsReadingIterator current = aCurrent;
+ PRInt32 dashes = 0;
- while (current != aEnd) {
+ while ((current != aEnd) && (dashes != 2)) {
if (*current == kGreaterThan) {
aGt = current;
return PR_TRUE;
}
- if (!nsString::IsSpace(*current))
- break;
+ if (*current == PRUnichar('-')) {
+ dashes++;
+ } else {
+ dashes = 0;
+ }
++current;
}
@@ -1053,7 +1056,7 @@ nsresult ConsumeStrictComment(nsScanner& aScanner, nsString& aString) {
}
balancedComment = !balancedComment; // We need to match '--' with '--'
- if (balancedComment && IsGoodCommentEnd(current, end, gt)) {
+ if (balancedComment && IsCommentEnd(current, end, gt)) {
// done
current.advance(-2);
if (beginData != current) { // protects from