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

Unified Diff: Source/core/css/CSSParser.cpp

Issue 18345005: Reporting unterminated comments in CSS. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser.cpp
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index 796162de1413454a8f11eb9559f2339d29a61ee4..63f4985f1b3bc2c8b5277d6e41a0f856b0f58336 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -10681,6 +10681,7 @@ restartAfterComment:
case CharacterSlash:
// Ignore comments. They are not even considered as white spaces.
if (*currentCharacter<SrcCharacterType>() == '*') {
+ const CSSParserLocation startLocation = currentLocation();
if (m_sourceDataHandler) {
unsigned startOffset = (is8BitSource() ? currentCharacter<LChar>() - m_dataStart8.get() : currentCharacter<UChar>() - m_dataStart16.get()) - 1; // Start with a slash.
m_sourceDataHandler->startComment(startOffset - m_parsedTextPrefixLength);
@@ -10692,6 +10693,7 @@ restartAfterComment:
if (*currentCharacter<SrcCharacterType>() == '\0') {
// Unterminated comments are simply ignored.
currentCharacter<SrcCharacterType>() -= 2;
+ reportError(startLocation, UnterminatedCommentError);
break;
}
++currentCharacter<SrcCharacterType>();
@@ -11139,6 +11141,11 @@ void CSSParser::reportError(const CSSParserLocation& location, ErrorType error)
builder.appendLiteral("Invalid CSS keyframe selector: ");
break;
+ case UnterminatedCommentError:
+ content.setLength(0);
+ builder.appendLiteral("Unterminated CSS comment");
+ break;
+
default:
builder.appendLiteral("Unexpected CSS token: ");
}
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698