| Index: Source/core/html/HTMLAnchorElement.cpp
|
| diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
|
| index 59c3697985672a09cd15bb8b49d6d8e2cf86a226..716274c128629aed1c793f96e7da5c3c537c8d94 100644
|
| --- a/Source/core/html/HTMLAnchorElement.cpp
|
| +++ b/Source/core/html/HTMLAnchorElement.cpp
|
| @@ -38,6 +38,7 @@
|
| #include "core/page/Chrome.h"
|
| #include "core/page/ChromeClient.h"
|
| #include "platform/network/NetworkHints.h"
|
| +#include "platform/weborigin/ReferrerPolicy.h"
|
|
|
| namespace blink {
|
|
|
| @@ -358,8 +359,22 @@ void HTMLAnchorElement::handleClick(Event* event)
|
| request.setRequestContext(WebURLRequest::RequestContextHyperlink);
|
| FrameLoadRequest frameRequest(&document(), request, getAttribute(targetAttr));
|
| frameRequest.setTriggeringEvent(event);
|
| - if (hasRel(RelationNoReferrer))
|
| - frameRequest.setShouldSendReferrer(NeverSendReferrer);
|
| +
|
| + // TODO(burnik): Most of this section should be reused for any other type of navigation and resource loading.
|
| + // Inherit the policy from the document.
|
| + ReferrerPolicy referrerPolicyForRequest = document().referrerPolicy();
|
| + // We keep it strict. If there is a rel attribute saying 'noreferrer', that takes precedence.
|
| + if (hasRel(RelationNoReferrer)) {
|
| + referrerPolicyForRequest = ReferrerPolicyNever;
|
| + } else if (hasAttribute(referrerAttr)) {
|
| + const AtomicString& referrerPolicy = fastGetAttribute(referrerAttr);
|
| + if (!ParseReferrerPolicy(referrerPolicy.string(), &referrerPolicyForRequest)) {
|
| + // TODO(burnik): Possibly add a warning to the console?
|
| + ASSERT(referrerPolicyForRequest == document().referrerPolicy());
|
| + }
|
| + }
|
| +
|
| + frameRequest.setReferrerPolicyForRequest(referrerPolicyForRequest);
|
| frame->loader().load(frameRequest);
|
| }
|
| }
|
|
|