Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: src/parsing/scanner.cc

Issue 2009963002: [modules] Disable HTML-like comments Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update attribute/method name Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« src/parsing/scanner.h ('K') | « src/parsing/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698