Ensure DNT is set for redirections handled in NetworkProcess
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Apr 2018 18:51:46 +0000 (18:51 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Apr 2018 18:51:46 +0000 (18:51 +0000)
commit253ce090b22b8cd26ac9137c69d61031ea35d7d5
treea140e3261695cee469c5186c3bfa829b059b82ca
parent5e4f22c1bf3c08f087a472cc0c475f120967461b
Ensure DNT is set for redirections handled in NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=184890

Reviewed by Ryosuke Niwa.

Source/WebKit:

Compute whether DNT header should be set on requests based on:
- request has a DNT header
- session is ephemeral (aka private browsing mode)
In both cases, we ensure a DNT header is added for any request triggered by a redirection.

Covered by http/wpt/fetch/dnt-header-after-redirection.html.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::check):
(WebKit::NetworkLoadChecker::prepareRedirectedRequest):
* NetworkProcess/NetworkLoadChecker.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::willPerformHTTPRedirection):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):

LayoutTests:

* http/wpt/fetch/dnt-header-after-redirection-expected.txt: Added.
* http/wpt/fetch/dnt-header-after-redirection.html: Added.
* http/wpt/fetch/resources/dnt-status.py: Added.
* http/wpt/fetch/resources/redirect.py: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/fetch/dnt-header-after-redirection-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/fetch/dnt-header-after-redirection.html [new file with mode: 0644]
LayoutTests/http/wpt/fetch/resources/dnt-status.py [new file with mode: 0644]
LayoutTests/http/wpt/fetch/resources/redirect.py [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp
Source/WebKit/NetworkProcess/NetworkLoadChecker.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/PingLoad.cpp