[Beacon][NetworkSession] Support CORS-preflighting on redirects
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 23:23:58 +0000 (23:23 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 23:23:58 +0000 (23:23 +0000)
commit96ee37dbc9e7897199ca1db30aa8fe0d98375d82
treead4042e35b26a2e387d9a3322264c767168d9fc7
parent660bd01304d7ee76f24d8a4a029c2127362e06e4
[Beacon][NetworkSession] Support CORS-preflighting on redirects
https://bugs.webkit.org/show_bug.cgi?id=175386
<rdar://problem/33801370>

Reviewed by Youenn Fablet.

Source/WebCore:

Export a couple of WebCore symbols so I can use them in WebKit2.

Tests: http/wpt/beacon/cors/cors-preflight-redirect-failure.html
       http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin.html
       http/wpt/beacon/cors/cors-preflight-redirect-success.html

* loader/CrossOriginAccessControl.h:
* page/SecurityOrigin.h:

Source/WebKit:

Add support to Beacon for doing CORS-preflighting upon redirect to a different
domain.

* NetworkProcess/NetworkCORSPreflightChecker.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::~PingLoad):
(WebKit::PingLoad::loadRequest):
(WebKit::PingLoad::securityOrigin const):
(WebKit::PingLoad::willPerformHTTPRedirection):
(WebKit::PingLoad::didReceiveResponseNetworkSession):
(WebKit::PingLoad::needsCORSPreflight const):
(WebKit::PingLoad::doCORSPreflight):
* NetworkProcess/PingLoad.h:

LayoutTests:

Add layout test coverage.

* http/wpt/beacon/cors/cors-preflight-redirect-failure-expected.txt: Added.
* http/wpt/beacon/cors/cors-preflight-redirect-failure.html: Added.
* http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin-expected.txt: Added.
* http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin.html: Added.
* http/wpt/beacon/cors/cors-preflight-redirect-success-expected.txt: Added.
* http/wpt/beacon/cors/cors-preflight-redirect-success.html: Added.
* http/wpt/beacon/resources/beacon-preflight.py:
(main):
* http/wpt/beacon/resources/redirect.py: Added.
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
LayoutTests/http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
LayoutTests/http/wpt/beacon/cors/cors-preflight-blob-failure.html
LayoutTests/http/wpt/beacon/cors/cors-preflight-blob-success.html
LayoutTests/http/wpt/beacon/cors/cors-preflight-cookie.html
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-failure-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-failure.html [new file with mode: 0644]
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin.html [new file with mode: 0644]
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-success-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/beacon/cors/cors-preflight-redirect-success.html [new file with mode: 0644]
LayoutTests/http/wpt/beacon/resources/beacon-preflight.py
LayoutTests/http/wpt/beacon/resources/redirect.py [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/CrossOriginAccessControl.h
Source/WebCore/page/SecurityOrigin.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.h
Source/WebKit/NetworkProcess/PingLoad.cpp
Source/WebKit/NetworkProcess/PingLoad.h