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

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

Issue 2221833003: Remove WTF::toASCIILowerUnchecked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
index 80fb27723277624078175f2086bb88d9564133ca..37133201437ceb9d9055f0e861b4c03beb5efdd7 100644
--- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
+++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
@@ -119,13 +119,11 @@ static bool startsMultiLineCommentAt(const String& string, size_t start)
static bool startsOpeningScriptTagAt(const String& string, size_t start)
{
- return start + 6 < string.length() && string[start] == '<'
- && WTF::toASCIILowerUnchecked(string[start + 1]) == 's'
- && WTF::toASCIILowerUnchecked(string[start + 2]) == 'c'
- && WTF::toASCIILowerUnchecked(string[start + 3]) == 'r'
- && WTF::toASCIILowerUnchecked(string[start + 4]) == 'i'
- && WTF::toASCIILowerUnchecked(string[start + 5]) == 'p'
- && WTF::toASCIILowerUnchecked(string[start + 6]) == 't';
+ if (start + 6 >= string.length())
+ return false;
+ // TODO(esprehn): StringView should probably have startsWith.
+ StringView script("<script");
+ return equalIgnoringASCIICase(StringView(string, start, script.length()), script);
}
// If other files need this, we should move this to core/html/parser/HTMLParserIdioms.h

Powered by Google App Engine
This is Rietveld 408576698