Source/WebCore:
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 07:36:59 +0000 (07:36 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2018 07:36:59 +0000 (07:36 +0000)
commit8c917f21de20c1ba56786dfce9fe5ea741435f7c
tree1af468c2587d5affd2962a9ed7af728b753a47b5
parenta973279b8ed2667a454493de4998bac1f0de2b6b
Source/WebCore:
Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=184763

Patch by Youenn Fablet <youenn@apple.com> on 2018-04-23
Reviewed by Chris Dumez.

No change of behavior yet since we do not use these parameters in NetworkProcess yet.

Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.

Allow getting the original headers from a SubresourceLoader.
This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::startLoadingBlobURL):
(WebCore::FetchLoader::start):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
(WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
* loader/ResourceLoaderOptions.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::originalHeaders const):
* loader/SubresourceLoader.h:
* loader/ThreadableLoader.cpp:
(WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
(WebCore::ThreadableLoaderOptions::isolatedCopy const):
* loader/ThreadableLoader.h:
* page/EventSource.cpp:
(WebCore::EventSource::connect):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createRequest):

Source/WebCore/PAL:
Implement Same-Site cookies
https://bugs.webkit.org/show_bug.cgi?id=159464
<rdar://problem/27196358>

Reviewed by Brent Fulgham.

Forward declare some SPI.

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:
Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=184763

Patch by Youenn Fablet <youenn@apple.com> on 2018-04-23
Reviewed by Chris Dumez.

Set all required NetworkResourceLoadParameters for asynchronous loads.
This includes preflight policy, CSP response headers, SecurityOrigin and content blockers identifier.

Update NetworkLoadChecker to handle preflight policy.
This is not needed right now since sync XHR and ping loads are using the default ConsiderPreflight policy.
But this will be needed for XHR/fetch/EventSource loads.

* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
(WebKit::NetworkLoadChecker::checkRedirection):
(WebKit::NetworkLoadChecker::validateResponse):
(WebKit::NetworkLoadChecker::checkCORSRequest):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::create):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):

Source/WebKitLegacy/mac:
Implement Same-Site cookies
https://bugs.webkit.org/show_bug.cgi?id=159464
<rdar://problem/27196358>

Reviewed by Brent Fulgham.

Pass the Same-Site info through the strategy.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::cookiesForDOM):
(WebPlatformStrategies::setCookiesFromDOM):
(WebPlatformStrategies::cookieRequestHeaderFieldValue):
(WebPlatformStrategies::getRawCookies):

Source/WebKitLegacy/win:
Implement Same-Site cookies
https://bugs.webkit.org/show_bug.cgi?id=159464
<rdar://problem/27196358>

Reviewed by Brent Fulgham.

Pass the Same-Site info through the strategy.

* WebCoreSupport/WebPlatformStrategies.cpp:
(WebPlatformStrategies::cookiesForDOM):
(WebPlatformStrategies::setCookiesFromDOM):
(WebPlatformStrategies::cookieRequestHeaderFieldValue):
(WebPlatformStrategies::getRawCookies):
* WebCoreSupport/WebPlatformStrategies.h:

LayoutTests:
Implement Same-Site cookies
https://bugs.webkit.org/show_bug.cgi?id=159464
<rdar://problem/27196358>

Reviewed by Brent Fulgham.

Add tests. These tests are skipped on all ports for now, including Mac and iOS. We will
look to subsequently enable the tests for Mac and iOS once we have CFNetwork support for
Same-Site cookies.

The following tests and utilities were taken in whole or in part from Blink:
    http/tests/cookies/resources/echo-json.php
    http/tests/cookies/resources/post-cookies-onmessage.php
    http/tests/cookies/resources/post-cookies-to-opener.php
    http/tests/cookies/resources/testharness-helpers.js
    http/tests/cookies/same-site/popup-cross-site-post.html
    http/tests/cookies/same-site/popup-cross-site.html
    http/tests/cookies/same-site/popup-same-site-post.html
    http/tests/cookies/same-site/popup-same-site.html

The following files were derived from tests taken from Blink:
    http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
    http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html

* TestExpectations: Skip on all ports for now.
* http/tests/cookies/resources/cookie-utilities.js: Added.
(createCookie):
(setBaseDocumentWhenFetchingDOMCookies):
(setDOMCookie):
* http/tests/cookies/resources/cookie-utility.php:
* http/tests/cookies/resources/echo-json.php: Added.
* http/tests/cookies/resources/post-cookies-onmessage.php: Added.
* http/tests/cookies/resources/post-cookies-to-opener.php: Added.
* http/tests/cookies/resources/testharness-helpers.js: Added.
(clearKnownCookies):
* http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html: Added.
* http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html: Added.
* http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html: Added.
* http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe-expected.txt: Added.
* http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html: Added.
* http/tests/cookies/same-site/fetch-in-about-blank-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-about-blank-page.html: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-iframe-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-page.html: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-service-worker-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-worker-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-cross-origin-worker.html: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-page-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-page.html: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-service-worker-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-worker-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-same-origin-worker.html: Added.
* http/tests/cookies/same-site/popup-cross-site-expected.txt: Added.
* http/tests/cookies/same-site/popup-cross-site-post-expected.txt: Added.
* http/tests/cookies/same-site/popup-cross-site-post.html: Added.
* http/tests/cookies/same-site/popup-cross-site.html: Added.
* http/tests/cookies/same-site/popup-same-site-expected.txt: Added.
* http/tests/cookies/same-site/popup-same-site-post-expected.txt: Added.
* http/tests/cookies/same-site/popup-same-site-post.html: Added.
* http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect-expected.txt: Added.
* http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html: Added.
* http/tests/cookies/same-site/popup-same-site-via-same-site-redirect-expected.txt: Added.
* http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html: Added.
* http/tests/cookies/same-site/popup-same-site.html: Added.
* http/tests/cookies/same-site/resources/click-hyperlink.php: Added.
* http/tests/cookies/same-site/resources/echo-iframe-src.php: Added.
* http/tests/cookies/same-site/resources/fetch-after-navigating-iframe-in-cross-origin-page.php: Added.
* http/tests/cookies/same-site/resources/fetch-after-top-level-navigation-from-cross-origin-page.php: Added.
* http/tests/cookies/same-site/resources/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.php: Added.
* http/tests/cookies/same-site/resources/fetch-in-cross-origin-iframe.html: Added.
* http/tests/cookies/same-site/resources/fetch-in-cross-origin-service-worker.html: Added.
* http/tests/cookies/same-site/resources/fetch-in-cross-origin-worker.js: Added.
(async.checkResult):
* http/tests/cookies/same-site/resources/fetch-in-same-origin-service-worker.php: Added.
* http/tests/cookies/same-site/resources/fetch-in-same-origin-worker.js: Added.
(async.checkResult):
* http/tests/cookies/same-site/resources/passthrough-service-worker.js: Added.
* platform/mac-wk1/TestExpectations: Skip the Service Worker tests as they are not supported in LegacyWebKit.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@230944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
112 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/cookies/resources/cookie-utilities.js [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/cookie-utility.php
LayoutTests/http/tests/cookies/resources/echo-json.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/post-cookies-onmessage.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/post-cookies-to-opener.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/testharness-helpers.js [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-about-blank-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-about-blank-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-service-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-cross-origin-worker.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-page.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-service-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/fetch-in-same-origin-worker.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-cross-site-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-cross-site-post-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-cross-site-post.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-cross-site.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-post-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-post.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-via-same-site-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/popup-same-site.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/click-hyperlink.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/echo-iframe-src.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-after-navigating-iframe-in-cross-origin-page.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-navigation-from-cross-origin-page.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-in-cross-origin-iframe.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-in-cross-origin-service-worker.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-in-cross-origin-worker.js [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-in-same-origin-service-worker.php [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/fetch-in-same-origin-worker.js [new file with mode: 0644]
LayoutTests/http/tests/cookies/same-site/resources/passthrough-service-worker.js [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/loader/CookieJar.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/SecurityPolicy.cpp
Source/WebCore/page/SecurityPolicy.h
Source/WebCore/platform/CookiesStrategy.h
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h
Source/WebCore/platform/network/PlatformCookieJar.h
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/platform/network/ResourceRequestBase.h
Source/WebCore/platform/network/SameSiteInfo.cpp [new file with mode: 0644]
Source/WebCore/platform/network/SameSiteInfo.h [new file with mode: 0644]
Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
Source/WebCore/platform/network/curl/CookieJarCurl.cpp
Source/WebCore/platform/network/curl/CookieJarCurl.h
Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp
Source/WebCore/platform/network/curl/CookieJarCurlDatabase.h
Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/network/soup/CookieJarSoup.cpp
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
Source/WebCore/xml/XSLTProcessor.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoader.h
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h
Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h