Index: src/parsing/scanner.cc |
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc |
index 6a9b32e63461f3b12e334546d8b94db6c48d49d7..26356c19259c5936a22e413d0e1c2ed7e0319a52 100644 |
--- a/src/parsing/scanner.cc |
+++ b/src/parsing/scanner.cc |
@@ -42,6 +42,7 @@ Scanner::Scanner(UnicodeCache* unicode_cache) |
octal_pos_(Location::invalid()), |
decimal_with_leading_zero_pos_(Location::invalid()), |
found_html_comment_(false), |
+ allow_html_comments_(false), |
allow_harmony_exponentiation_operator_(false) { |
bookmark_current_.literal_chars = &bookmark_current_literal_; |
bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_; |
@@ -329,7 +330,7 @@ bool Scanner::SkipWhiteSpace() { |
Advance(); |
if (c0_ == '-') { |
Advance(); |
- if (c0_ == '>') { |
+ if (c0_ == '>' && !allow_html_comments_) { |
// Treat the rest of the line as a comment. |
SkipSingleLineComment(); |
// Continue skipping white space after the comment. |
@@ -454,7 +455,7 @@ Token::Value Scanner::ScanHtmlComment() { |
Advance(); |
if (c0_ == '-') { |
Advance(); |
- if (c0_ == '-') { |
+ if (c0_ == '-' && !allow_html_comments_) { |
vogelheim
2016/05/27 08:08:49
nitpick: It seems more logical to check this at th
mike3
2016/05/27 15:53:22
Maybe, but it's good taste. I was suffering from t
|
found_html_comment_ = true; |
return SkipSingleLineComment(); |
} |
@@ -564,7 +565,8 @@ void Scanner::Scan() { |
Advance(); |
if (c0_ == '-') { |
Advance(); |
- if (c0_ == '>' && has_line_terminator_before_next_) { |
+ if (c0_ == '>' && has_line_terminator_before_next_ && |
+ !allow_html_comments_) { |
// For compatibility with SpiderMonkey, we skip lines that |
// start with an HTML comment end '-->'. |
token = SkipSingleLineComment(); |