The referer header is not set after redirect
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2018 17:15:17 +0000 (17:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2018 17:15:17 +0000 (17:15 +0000)
commit171b167797c66c405e2bf616ce42d76463b2726d
tree3073a11a828494e372dded8d09c7f161c013d6a9
parent9e514a393b24f151e3d69162230d09b9e2f794b4
The referer header is not set after redirect
https://bugs.webkit.org/show_bug.cgi?id=182644
<rdar://problem/37479048>

Patch by Sihui Liu <sihui_liu@apple.com> on 2018-04-03
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline some tests for fetch api as they are passing now.

* web-platform-tests/fetch/api/basic/referrer.any-expected.txt:
* web-platform-tests/fetch/api/basic/referrer.any.worker-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-referrer-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt:

Source/WebCore:

Update referrer policy and recompute referrer in redirection check, so Referer header would be set after it's removed from cross-origin request.

Add support for Referrer-Policy header, so referrer policy would be changed based on redirect response.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::processReferrerPolicy):
* loader/CrossOriginAccessControl.cpp:
(WebCore::updateRequestReferrer):
* loader/CrossOriginAccessControl.h:
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::setReferrerPolicy):
(WebCore::ResourceLoader::referrerPolicy const):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
(WebCore::SubresourceLoader::updateReferrerPolicy):
* loader/SubresourceLoader.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
(WebCore::CachedResourceRequest::updateForAccessControl):
(WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
* platform/ReferrerPolicy.cpp: Added.
(WebCore::parseReferrerPolicy):
* platform/ReferrerPolicy.h:
* platform/network/HTTPHeaderNames.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/referrer.any-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/referrer.any.worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/loader/CrossOriginAccessControl.cpp
Source/WebCore/loader/CrossOriginAccessControl.h
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/platform/ReferrerPolicy.cpp [new file with mode: 0644]
Source/WebCore/platform/ReferrerPolicy.h
Source/WebCore/platform/network/HTTPHeaderNames.in