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

Unified Diff: Source/core/html/track/vtt/VTTTokenizer.cpp

Issue 97103002: Fix corner-cases for WebVTT tokenizer escape handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 | « LayoutTests/media/track/track-webvtt-tc022-entities-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/vtt/VTTTokenizer.cpp
diff --git a/Source/core/html/track/vtt/VTTTokenizer.cpp b/Source/core/html/track/vtt/VTTTokenizer.cpp
index 9c9c3f451a7724486fea1fa3bf07194962c73786..9dd82a4657527a2ff9832e402c549a55a552daf7 100644
--- a/Source/core/html/track/vtt/VTTTokenizer.cpp
+++ b/Source/core/html/track/vtt/VTTTokenizer.cpp
@@ -141,13 +141,21 @@ bool VTTTokenizer::nextToken(VTTToken& token)
} else if (isASCIIAlphanumeric(cc)) {
buffer.append(static_cast<LChar>(cc));
WEBVTT_ADVANCE_TO(EscapeState);
+ } else if (cc == '<') {
+ result.append(buffer);
+ return emitToken(VTTToken::StringToken(result.toString()));
} else if (cc == kEndOfFileMarker) {
result.append(buffer);
return advanceAndEmitToken(source, VTTToken::StringToken(result.toString()));
} else {
- if (!equalLiteral(buffer, "&"))
- result.append(buffer);
+ result.append(buffer);
buffer.clear();
+
+ if (cc == '&') {
+ buffer.append(static_cast<LChar>(cc));
+ WEBVTT_ADVANCE_TO(EscapeState);
+ }
+ result.append(cc);
WEBVTT_ADVANCE_TO(DataState);
}
}
« no previous file with comments | « LayoutTests/media/track/track-webvtt-tc022-entities-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698