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

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2075053003: Add basic Referrer-Policy support for Documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add crbug for TODO Created 4 years, 6 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/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 98043161ced3d6f7e13f09d89c9b864899bb2490..7a7ef0287647b31e51be1d441fc14782ce0f089e 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -85,6 +85,7 @@
#include "core/xml/parser/XMLDocumentParser.h"
#include "platform/Logging.h"
#include "platform/PluginScriptForbiddenScope.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/ScriptForbiddenScope.h"
#include "platform/TraceEvent.h"
#include "platform/UserGestureIndicator.h"
@@ -514,6 +515,16 @@ void FrameLoader::didBeginDocument()
OriginTrialContext::addTokensFromHeader(m_frame->document(), m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
}
+ if (m_documentLoader && RuntimeEnabledFeatures::referrerPolicyHeaderEnabled()) {
+ String referrerPolicyHeader = m_documentLoader->response().httpHeaderField(HTTPNames::Referrer_Policy);
+ if (!referrerPolicyHeader.isNull()) {
+ ReferrerPolicy referrerPolicy = parseReferrerPolicyHeader(referrerPolicyHeader);
Mike West 2016/06/21 07:40:03 Could you call `Document::processReferrerPolicy(re
estark 2016/06/21 17:41:33 Hmm. If I put the new parsing code in Document::pr
Mike West 2016/06/22 18:57:04 I trust your judgement. I think it's probably reas
+ if (referrerPolicy != ReferrerPolicyDefault) {
+ m_frame->document()->setReferrerPolicy(referrerPolicy);
+ }
+ }
+ }
+
client()->didCreateNewDocument();
}

Powered by Google App Engine
This is Rietveld 408576698