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

Unified Diff: Source/core/dom/Document.cpp

Issue 1235563004: Apply meta tag referrer policy for preloaded requests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fix Created 5 years, 5 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: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 8668dd20dee17af73c1de393abae62a90f05e65d..51aa6b792f9c514ff2ba5857f3e05e400fca42c6 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -3153,20 +3153,13 @@ void Document::updateViewportDescription()
void Document::processReferrerPolicy(const String& policy)
{
- ASSERT(!policy.isNull());
-
- if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "never"))
- setReferrerPolicy(ReferrerPolicyNever);
- else if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(policy, "always"))
- setReferrerPolicy(ReferrerPolicyAlways);
- else if (equalIgnoringCase(policy, "origin"))
- setReferrerPolicy(ReferrerPolicyOrigin);
- else if (equalIgnoringCase(policy, "origin-when-cross-origin") || equalIgnoringCase(policy, "origin-when-crossorigin"))
- setReferrerPolicy(ReferrerPolicyOriginWhenCrossOrigin);
- else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoringCase(policy, "default"))
- setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade);
- else
+ ReferrerPolicy referrerPolicy;
+ if (!SecurityPolicy::referrerPolicyFromString(policy, &referrerPolicy)) {
addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policy + "' is not one of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-crossorigin', or 'unsafe-url'. This document's referrer policy has been left unchanged."));
+ return;
+ }
+
+ setReferrerPolicy(referrerPolicy);
}
String Document::outgoingReferrer()
« no previous file with comments | « LayoutTests/http/tests/security/resources/referrer-policy-script.php ('k') | Source/core/html/parser/CSSPreloadScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698