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

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

Issue 2278823004: Stop supporting legacy keywords in Referrer-Policy header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jochen comment 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/dom/ExecutionContext.cpp
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
index 383a857c449ad438a40386d1d8f4b286523961c5..1bb17be952bfece1ed6796531b23a4516b2446b1 100644
--- a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
+++ b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
@@ -236,7 +236,7 @@ String ExecutionContext::outgoingReferrer() const
return url().strippedForUseAsReferrer();
}
-void ExecutionContext::parseAndSetReferrerPolicy(const String& policies)
+void ExecutionContext::parseAndSetReferrerPolicy(const String& policies, bool supportLegacyKeywords)
{
ReferrerPolicy referrerPolicy = ReferrerPolicyDefault;
@@ -244,13 +244,13 @@ void ExecutionContext::parseAndSetReferrerPolicy(const String& policies)
policies.split(',', true, tokens);
for (const auto& token : tokens) {
ReferrerPolicy currentResult;
- if (SecurityPolicy::referrerPolicyFromString(token, &currentResult)) {
+ if ((supportLegacyKeywords ? SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(token, &currentResult) : SecurityPolicy::referrerPolicyFromString(token, &currentResult))) {
referrerPolicy = currentResult;
}
}
if (referrerPolicy == ReferrerPolicyDefault) {
- addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policies + "' is not one of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-crossorigin', or 'unsafe-url'. The referrer policy has been left unchanged."));
+ addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policies + "' is not one of " + (supportLegacyKeywords ? "'always', 'default', 'never', 'origin-when-crossorigin', " : "") + "'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', or 'unsafe-url'. The referrer policy has been left unchanged."));
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/ExecutionContext.h ('k') | third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698