diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index 6c419b97a74..00865dfed13 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -2322,9 +2322,19 @@ nsParser::DetectMetaTag(const char* aBytes,
if (!FindCharInReadable('<', currPos, end))
break; // no tag found in this buffer
- if (GetNextChar(currPos, end) == '!' &&
- GetNextChar(currPos, end) == '-' &&
- GetNextChar(currPos, end) == '-') {
+ if (GetNextChar(currPos, end) == '!') {
+ if (GetNextChar(currPos, end) != '-' ||
+ GetNextChar(currPos, end) != '-') {
+ // If we only see a .
+ if (!FindCharInReadable('>', currPos, end)) {
+ return PR_FALSE; // No more tags to follow.
+ }
+
+ // Continue searching for a meta tag following this "comment".
+ ++currPos;
+ continue;
+ }
+
// Found MDO (