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

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

Issue 2445823002: Remove CSP referrer directive (Closed)
Patch Set: remove unused test file Created 4 years, 2 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 99a69abd80c5d91dbfa50940d6349e3128c9d305..2a50566ab9cd193f484417431ba01d408297276e 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -52,8 +52,6 @@ CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy,
m_headerType(type),
m_headerSource(source),
m_hasSandboxPolicy(false),
- m_didSetReferrerPolicy(false),
- m_referrerPolicy(ReferrerPolicyDefault),
m_strictMixedContentCheckingEnforced(false),
m_upgradeInsecureRequests(false),
m_treatAsPublicAddress(false),
@@ -1070,54 +1068,6 @@ void CSPDirectiveList::enableInsecureRequestsUpgrade(const String& name,
m_policy->reportValueForEmptyDirective(name, value);
}
-void CSPDirectiveList::parseReferrer(const String& name, const String& value) {
- m_didSetReferrerPolicy = true;
-
- if (value.isEmpty()) {
- m_policy->reportInvalidReferrer(value);
- m_referrerPolicy = ReferrerPolicyNever;
- return;
- }
-
- Vector<UChar> characters;
- value.appendTo(characters);
-
- const UChar* position = characters.data();
- const UChar* end = position + characters.size();
-
- skipWhile<UChar, isASCIISpace>(position, end);
- const UChar* begin = position;
- skipWhile<UChar, isNotASCIISpace>(position, end);
-
- StringView token(begin, position - begin);
-
- // value1
- // ^
- if (equalIgnoringCase("unsafe-url", token)) {
- m_referrerPolicy = ReferrerPolicyAlways;
- } else if (equalIgnoringCase("no-referrer", token)) {
- m_referrerPolicy = ReferrerPolicyNever;
- } else if (equalIgnoringCase("no-referrer-when-downgrade", token)) {
- m_referrerPolicy = ReferrerPolicyDefault;
- } else if (equalIgnoringCase("origin", token)) {
- m_referrerPolicy = ReferrerPolicyOrigin;
- } else if (equalIgnoringCase("origin-when-cross-origin", token) ||
- equalIgnoringCase("origin-when-crossorigin", token)) {
- m_referrerPolicy = ReferrerPolicyOriginWhenCrossOrigin;
- } else {
- m_policy->reportInvalidReferrer(value);
- return;
- }
-
- skipWhile<UChar, isASCIISpace>(position, end);
- if (position == end)
- return;
-
- // value1 value2
- // ^
- m_policy->reportInvalidReferrer(value);
-}
-
void CSPDirectiveList::addDirective(const String& name, const String& value) {
ASSERT(!name.isEmpty());
@@ -1160,8 +1110,6 @@ void CSPDirectiveList::addDirective(const String& name, const String& value) {
setCSPDirective<SourceListDirective>(name, value, m_formAction);
} else if (equalIgnoringCase(name, ContentSecurityPolicy::PluginTypes)) {
setCSPDirective<MediaListDirective>(name, value, m_pluginTypes);
- } else if (equalIgnoringCase(name, ContentSecurityPolicy::Referrer)) {
- parseReferrer(name, value);
} else if (equalIgnoringCase(
name, ContentSecurityPolicy::UpgradeInsecureRequests)) {
enableInsecureRequestsUpgrade(name, value);

Powered by Google App Engine
This is Rietveld 408576698