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

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

Issue 698973008: Referrer Policy: Distinguish "default" from "no referrer when downgrade" [2/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 | « Source/core/dom/Document.h ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 19637bd05b71d5d8c4252d7bedfa57fb6266f920..ece3ad357e441e31d3b0a2ec63740864c965192b 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -496,7 +496,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
, m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
- , m_didSetReferrerPolicy(false)
, m_referrerPolicy(ReferrerPolicyDefault)
, m_directionSetOnDocumentElement(false)
, m_writingModeSetOnDocumentElement(false)
@@ -3162,7 +3161,7 @@ void Document::processReferrerPolicy(const String& policy)
} else if (equalIgnoringCase(policy, "origin")) {
setReferrerPolicy(ReferrerPolicyOrigin);
} else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoringCase(policy, "default")) {
- setReferrerPolicy(ReferrerPolicyDefault);
+ setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade);
} else {
addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policy + "' is not one of 'no-referrer', 'origin', 'no-referrer-when-downgrade', or 'unsafe-url'. Defaulting to 'no-referrer'."));
setReferrerPolicy(ReferrerPolicyNever);
@@ -3172,9 +3171,9 @@ void Document::processReferrerPolicy(const String& policy)
void Document::setReferrerPolicy(ReferrerPolicy referrerPolicy)
{
// FIXME: Can we adopt the CSP referrer policy merge algorithm? Or does the web rely on being able to modify the referrer policy in-flight?
- if (m_didSetReferrerPolicy)
+ UseCounter::count(this, UseCounter::SetReferrerPolicy);
+ if (m_referrerPolicy != ReferrerPolicyDefault)
UseCounter::count(this, UseCounter::ResetReferrerPolicy);
- m_didSetReferrerPolicy = true;
m_referrerPolicy = referrerPolicy;
}
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698