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

Unified Diff: Source/core/html/HTMLFrameOwnerElement.cpp

Issue 1328183002: Implement referrerpolicy attr for iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update webexposed tests Created 5 years, 3 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 | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLIFrameElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFrameOwnerElement.cpp
diff --git a/Source/core/html/HTMLFrameOwnerElement.cpp b/Source/core/html/HTMLFrameOwnerElement.cpp
index 1833cc61cb2a899e2bb4319a450b82f0a8fdb14b..c5e86452bda6fdf90a35d11a7361475580564615 100644
--- a/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -34,6 +34,7 @@
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
#include "core/plugins/PluginView.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/weborigin/SecurityOrigin.h"
namespace blink {
@@ -261,7 +262,15 @@ bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
if (document().frame()->host()->subframeCount() >= FrameHost::maxNumberOfFrames)
return false;
- return parentFrame->loader().client()->createFrame(FrameLoadRequest(&document(), url, "_self", CheckContentSecurityPolicy), frameName, this);
+ FrameLoadRequest frameLoadRequest(&document(), url, "_self", CheckContentSecurityPolicy);
+
+ if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled()) {
+ ReferrerPolicy policy = referrerPolicyAttribute();
+ if (policy != ReferrerPolicyDefault)
+ frameLoadRequest.resourceRequest().setHTTPReferrer(SecurityPolicy::generateReferrer(policy, url, document().outgoingReferrer()));
+ }
+
+ return parentFrame->loader().client()->createFrame(frameLoadRequest, frameName, this);
}
DEFINE_TRACE(HTMLFrameOwnerElement)
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLIFrameElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698