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

Unified Diff: third_party/WebKit/Source/core/dom/ExecutionContext.cpp

Issue 2674973006: Move parsing of referrer policy header values to SecurityPolicy (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/ExecutionContext.cpp
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
index 60a65d4167ebcc6bf180365b6f94d7729ee9ce0e..149cd19ff7be676ed587f3f375502f10e036290a 100644
--- a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
+++ b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
@@ -193,22 +193,13 @@ String ExecutionContext::outgoingReferrer() const {
void ExecutionContext::parseAndSetReferrerPolicy(const String& policies,
bool supportLegacyKeywords) {
- ReferrerPolicy referrerPolicy = ReferrerPolicyDefault;
-
- Vector<String> tokens;
- policies.split(',', true, tokens);
- for (const auto& token : tokens) {
- ReferrerPolicy currentResult;
- if ((supportLegacyKeywords
- ? SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(
- token, &currentResult)
- : SecurityPolicy::referrerPolicyFromString(token,
- &currentResult))) {
- referrerPolicy = currentResult;
- }
- }
+ ReferrerPolicy referrerPolicy;
- if (referrerPolicy == ReferrerPolicyDefault) {
+ if (!SecurityPolicy::referrerPolicyFromHeaderValue(
+ policies,
+ supportLegacyKeywords ? SupportReferrerPolicyLegacyKeywords
+ : DoNotSupportReferrerPolicyLegacyKeywords,
+ &referrerPolicy)) {
addConsoleMessage(ConsoleMessage::create(
RenderingMessageSource, ErrorMessageLevel,
"Failed to set referrer policy: The value '" + policies +
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698