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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp

Issue 2576373002: Fix HTML parser CDATA edge-case and sync state names with spec (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp
index df3edccc5f1c001da795603f76356eb650a02c1b..3c104d59676d7ec1096b1385b217733311ebf4a8 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp
@@ -1495,7 +1495,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) {
HTML_BEGIN_STATE(CDATASectionState) {
if (cc == ']')
- HTML_ADVANCE_TO(CDATASectionRightSquareBracketState);
+ HTML_ADVANCE_TO(CDATASectionBracketState);
else if (cc == kEndOfFileMarker)
HTML_RECONSUME_IN(DataState);
else {
@@ -1505,19 +1505,22 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) {
}
END_STATE()
- HTML_BEGIN_STATE(CDATASectionRightSquareBracketState) {
+ HTML_BEGIN_STATE(CDATASectionBracketState) {
if (cc == ']')
- HTML_ADVANCE_TO(CDATASectionDoubleRightSquareBracketState);
+ HTML_ADVANCE_TO(CDATASectionEndState);
else {
bufferCharacter(']');
HTML_RECONSUME_IN(CDATASectionState);
}
}
- HTML_BEGIN_STATE(CDATASectionDoubleRightSquareBracketState) {
- if (cc == '>')
+ HTML_BEGIN_STATE(CDATASectionEndState) {
+ if (cc == ']') {
+ bufferCharacter(']');
+ HTML_ADVANCE_TO(CDATASectionEndState);
+ } else if (cc == '>') {
HTML_ADVANCE_TO(DataState);
- else {
+ } else {
bufferCharacter(']');
bufferCharacter(']');
HTML_RECONSUME_IN(CDATASectionState);
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698