Add support for FetchEvent.clientId
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 21:47:37 +0000 (21:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 21:47:37 +0000 (21:47 +0000)
commit8bbcee2a7d2a1f02cef5d93697690d06e8dd4ad3
treec6a59f6c9ae89294292924a500abf2713610d74d
parentb510756d5fd51f005722f3953dfdcc6ab406197e
Add support for FetchEvent.clientId
https://bugs.webkit.org/show_bug.cgi?id=180052

Patch by Youenn Fablet <youenn@apple.com> on 2017-11-29
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* web-platform-tests/service-workers/service-worker/resources/clients-get-worker.js:
* web-platform-tests/service-workers/service-worker/resources/fetch-event-test-worker.js:

Source/WebCore:

Covered by updated test.

Add script execution context identifier as a FetchOptions parameter.
This is then sent to the service worker process which can then set FetchEvent.clientId appropriately.
If the fetch is for a subresource, clientId is used directly.
If it is a navigation, clientId is set to targetClientId.

* loader/FetchOptions.h:
(WebCore::FetchOptions::encode const):
(WebCore::FetchOptions::decode):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::prepareFetch):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setClientIdentifierIfNeeded):
* loader/cache/CachedResourceRequest.h:
* workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::dispatchFetchEvent):
* workers/service/context/ServiceWorkerFetch.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::postFetchTask):
* workers/service/context/ServiceWorkerThread.h:

Source/WebKit:

Using FetchOption persistency coders for cache API and modernizing IPC FetchOptions decoding.

* WebKit/Shared/WebCoreArgumentCoders.cpp:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::encode):
(WebKit::CacheStorage::Cache::decodeRecordHeader):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225294 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/clients-get-worker.js
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-test-worker.js
Source/WebCore/ChangeLog
Source/WebCore/loader/FetchOptions.h
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp
Source/WebCore/workers/service/context/ServiceWorkerFetch.h
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
Source/WebCore/workers/service/context/ServiceWorkerThread.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp