Index: Source/core/html/HTMLAnchorElement.cpp |
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp |
index 39f192d84e4ac50818eb37c0b48f1ae38e4fb75f..445423960a30666e3695a96cbb62aafd7ed5febc 100644 |
--- a/Source/core/html/HTMLAnchorElement.cpp |
+++ b/Source/core/html/HTMLAnchorElement.cpp |
@@ -36,7 +36,9 @@ |
#include "core/loader/FrameLoaderClient.h" |
#include "core/loader/PingLoader.h" |
#include "core/page/ChromeClient.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/network/NetworkHints.h" |
+#include "platform/weborigin/SecurityPolicy.h" |
namespace blink { |
@@ -348,6 +350,12 @@ void HTMLAnchorElement::handleClick(Event* event) |
ResourceRequest request(completedURL); |
request.setUIStartTime(event->uiCreateTime()); |
request.setInputPerfMetricReportPolicy(InputToLoadPerfMetricReportPolicy::ReportLink); |
+ |
+ ReferrerPolicy policy; |
+ if (RuntimeEnabledFeatures::referrerPolicyAttributeEnabled() && hasAttribute(referrerpolicyAttr) && SecurityPolicy::referrerPolicyFromString(fastGetAttribute(referrerpolicyAttr), &policy) && !hasRel(RelationNoReferrer)) { |
+ request.setHTTPReferrer(SecurityPolicy::generateReferrer(policy, completedURL, document().outgoingReferrer())); |
+ } |
+ |
if (hasAttribute(downloadAttr)) { |
request.setRequestContext(WebURLRequest::RequestContextDownload); |
bool isSameOrigin = completedURL.protocolIsData() || document().securityOrigin()->canRequest(completedURL); |