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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp

Issue 2148423003: Use StringView for equalIgnoringCase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK is silly. 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/frame/csp/CSPDirectiveList.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
index 245406797f870f5a89c6da873b8231efe25a0444..ea4ffe40346258b946f66a33cc375fdf4d5f744a 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -811,13 +811,15 @@ void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value
const UChar* begin = position;
skipWhile<UChar, isNotASCIISpace>(position, end);
+ StringView token(begin, position - begin);
+
// value1
// ^
- if (equalIgnoringCase("allow", begin, position - begin)) {
+ if (equalIgnoringCase("allow", token)) {
m_reflectedXSSDisposition = AllowReflectedXSS;
- } else if (equalIgnoringCase("filter", begin, position - begin)) {
+ } else if (equalIgnoringCase("filter", token)) {
m_reflectedXSSDisposition = FilterReflectedXSS;
- } else if (equalIgnoringCase("block", begin, position - begin)) {
+ } else if (equalIgnoringCase("block", token)) {
m_reflectedXSSDisposition = BlockReflectedXSS;
} else {
m_reflectedXSSDisposition = ReflectedXSSInvalid;
@@ -857,17 +859,19 @@ void CSPDirectiveList::parseReferrer(const String& name, const String& value)
const UChar* begin = position;
skipWhile<UChar, isNotASCIISpace>(position, end);
+ StringView token(begin, position - begin);
+
// value1
// ^
- if (equalIgnoringCase("unsafe-url", begin, position - begin)) {
+ if (equalIgnoringCase("unsafe-url", token)) {
m_referrerPolicy = ReferrerPolicyAlways;
- } else if (equalIgnoringCase("no-referrer", begin, position - begin)) {
+ } else if (equalIgnoringCase("no-referrer", token)) {
m_referrerPolicy = ReferrerPolicyNever;
- } else if (equalIgnoringCase("no-referrer-when-downgrade", begin, position - begin)) {
+ } else if (equalIgnoringCase("no-referrer-when-downgrade", token)) {
m_referrerPolicy = ReferrerPolicyDefault;
- } else if (equalIgnoringCase("origin", begin, position - begin)) {
+ } else if (equalIgnoringCase("origin", token)) {
m_referrerPolicy = ReferrerPolicyOrigin;
- } else if (equalIgnoringCase("origin-when-cross-origin", begin, position - begin) || equalIgnoringCase("origin-when-crossorigin", begin, position - begin)) {
+ } else if (equalIgnoringCase("origin-when-cross-origin", token) || equalIgnoringCase("origin-when-crossorigin", token)) {
m_referrerPolicy = ReferrerPolicyOriginWhenCrossOrigin;
} else {
m_policy->reportInvalidReferrer(value);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698