Chromium Code Reviews| Index: Source/core/html/HTMLAnchorElement.cpp |
| diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp |
| index 59c3697985672a09cd15bb8b49d6d8e2cf86a226..b4cbd8fba5dde58623250013e4749a29d73d64d5 100644 |
| --- a/Source/core/html/HTMLAnchorElement.cpp |
| +++ b/Source/core/html/HTMLAnchorElement.cpp |
| @@ -358,8 +358,29 @@ void HTMLAnchorElement::handleClick(Event* event) |
| request.setRequestContext(WebURLRequest::RequestContextHyperlink); |
| FrameLoadRequest frameRequest(&document(), request, getAttribute(targetAttr)); |
| frameRequest.setTriggeringEvent(event); |
| - if (hasRel(RelationNoReferrer)) |
| - frameRequest.setShouldSendReferrer(NeverSendReferrer); |
|
Mike West
2015/05/20 07:56:41
Is `ShouldSendReferrer` actually used after this p
burnik
2015/05/20 08:27:56
I think it should be removed completely. Yesterday
burnik
2015/05/20 13:45:18
Done.
|
| + // We keep it strict. If there is a rel attribute saying 'noreferrer', that takes precedence. |
| + if (hasRel(RelationNoReferrer)) { |
| + frameRequest.setReferrerPolicyForRequest(ReferrerPolicyNever); |
| + } else if (hasAttribute(referrerAttr)) { |
| + const AtomicString& referrerPolicy = fastGetAttribute(referrerAttr); |
| + ReferrerPolicy referrerPolicyForRequest = ReferrerPolicyNoReferrerWhenDowngrade; |
|
Mike West
2015/05/20 07:56:41
Nit: You can pull this out of the `if`, set `refer
burnik
2015/05/20 08:27:55
Yes, I've seen it earlier, this initial approach w
|
| + |
| + // FIXME: This string parsing should be implemented in one place and |
|
Mike West
2015/05/20 07:56:41
Nit: s/FIXME/TODO(burnik)/
burnik
2015/05/20 08:27:55
Done.
|
| + // not duplicated from |blink::Document::processReferrerPolicy|. |
|
Mike West
2015/05/20 07:56:41
Perhaps you could extract this out to a method in
burnik
2015/05/20 08:27:55
Yes, the FIXME(TODO) actually instructs me to do s
|
| + if (equalIgnoringCase(referrerPolicy, "no-referrer") || equalIgnoringCase(referrerPolicy, "never")) |
| + referrerPolicyForRequest = ReferrerPolicyNever; |
| + else if (equalIgnoringCase(referrerPolicy, "unsafe-url") || equalIgnoringCase(referrerPolicy, "always")) |
| + referrerPolicyForRequest = ReferrerPolicyAlways; |
| + else if (equalIgnoringCase(referrerPolicy, "origin")) |
| + referrerPolicyForRequest = ReferrerPolicyOrigin; |
| + else if (equalIgnoringCase(referrerPolicy, "origin-when-cross-origin") || equalIgnoringCase(referrerPolicy, "origin-when-crossorigin")) |
| + referrerPolicyForRequest = ReferrerPolicyOriginWhenCrossOrigin; |
| + else if (equalIgnoringCase(referrerPolicy, "no-referrer-when-downgrade") || equalIgnoringCase(referrerPolicy, "default")) |
| + referrerPolicyForRequest = ReferrerPolicyNoReferrerWhenDowngrade; |
| + |
| + frameRequest.setReferrerPolicyForRequest(referrerPolicyForRequest); |
| + } |
| + |
| frame->loader().load(frameRequest); |
| } |
| } |