Bounce ServiceWorker jobs to the Storage Process.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 18:52:43 +0000 (18:52 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 18:52:43 +0000 (18:52 +0000)
commit1322fe1f5054fabf6bbc7e91bdbf24519a3c8f27
treed3922b22608547fcc243af3048297b3fe45ba375
parent0598f9b86b07da108f7ce3c123aeb2c228499482
Bounce ServiceWorker jobs to the Storage Process.
https://bugs.webkit.org/show_bug.cgi?id=175650

Reviewed by Andy Estes.

LayoutTests/imported/w3c:

Now that the serviceWorker.register() call is asynchronous, update a whole bunch of test results.

* web-platform-tests/FileAPI/historical.https-expected.txt:
* web-platform-tests/background-fetch/interfaces-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-add.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-delete.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-keys.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-matchAll.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-keys.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-match.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage.https-expected.txt:
* web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt:
* web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt:

Source/WebCore:

No new tests (Covered by both changes and consistencies in existing tests)

This lays the groundwork for the SW job queue being in the StorageProcess by actually
setting up some objects for IPC communication and actually sending things over the wire.

The main point of IPC is the WebCore abstract base class "SWServer::Connection"

A collection of them will soon be managed by the SWServer itself in the StorageProcess.

That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.

Currently, any job that we try to schedule still immediately rejects (though now it does
so asynchronously instead of synchronously).

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
(WebCore::ExceptionData::toException const):
(WebCore::ExceptionData::encode const):
(WebCore::ExceptionData::decode):

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::scheduleJob):
* workers/service/ServiceWorkerContainer.h:

* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::failedWithException):
(WebCore::ServiceWorkerJob::data const):
* workers/service/ServiceWorkerJob.h:

* workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
(WebCore::ServiceWorkerJobData::encode const):
(WebCore::ServiceWorkerJobData::decode):

* workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.

* workers/service/ServiceWorkerProvider.h:

* workers/service/ServiceWorkerRegistrationParameters.h:

* workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
(WebCore::SWServer::Connection::scheduleJob):
(WebCore::SWServer::Connection::jobRejected):
* workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
(WebCore::SWServer::Connection::~Connection):

Source/WebKit:

* CMakeLists.txt:
* DerivedSources.make:
* WebKit.xcodeproj/project.pbxproj:

* Platform/Logging.h:

* StorageProcess/StorageToWebProcessConnection.cpp:
(WebKit::StorageToWebProcessConnection::didReceiveMessage):
(WebKit::StorageToWebProcessConnection::didClose):
(WebKit::StorageToWebProcessConnection::establishSWServerConnection):
(WebKit::StorageToWebProcessConnection::removeSWServerConnection):
(WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
* StorageProcess/StorageToWebProcessConnection.h:
* StorageProcess/StorageToWebProcessConnection.messages.in:

* WebProcess/Storage/WebSWServerConnection.cpp: Added.
(WebKit::WebSWServerConnection::WebSWServerConnection):
(WebKit::WebSWServerConnection::~WebSWServerConnection):
(WebKit::WebSWServerConnection::disconnectedFromWebProcess):
(WebKit::WebSWServerConnection::scheduleJob):
(WebKit::WebSWServerConnection::scheduleStorageJob):
* WebProcess/Storage/WebSWServerConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerJob.h.
(WebKit::WebSWServerConnection::create):
(WebKit::WebSWServerConnection::identifier const):
* WebProcess/Storage/WebSWServerConnection.messages.in: Copied from Source/WebKit/StorageProcess/StorageToWebProcessConnection.messages.in.

* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
(WebKit::WebServiceWorkerProvider::scheduleJob): Deleted.
* WebProcess/Storage/WebServiceWorkerProvider.h:

* WebProcess/Storage/WebToStorageProcessConnection.cpp:
(WebKit::WebToStorageProcessConnection::didReceiveMessage):
(WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
* WebProcess/Storage/WebToStorageProcessConnection.h:

LayoutTests:

Service worker tests will always be dumpAsText and always be asynchronous.

* http/tests/workers/service/basic-register.html:
* http/tests/workers/service/resources/basic-register.js:
* http/tests/workers/service/resources/sw-test-pre.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
75 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-register.html
LayoutTests/http/tests/workers/service/resources/basic-register.js
LayoutTests/http/tests/workers/service/resources/sw-test-pre.js [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-add.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-delete.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-keys.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-matchAll.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-keys.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-match.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/ExceptionData.h [new file with mode: 0644]
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Source/WebCore/workers/service/ServiceWorkerJob.cpp
Source/WebCore/workers/service/ServiceWorkerJob.h
Source/WebCore/workers/service/ServiceWorkerJobData.h [new file with mode: 0644]
Source/WebCore/workers/service/ServiceWorkerJobType.h [new file with mode: 0644]
Source/WebCore/workers/service/ServiceWorkerProvider.h
Source/WebCore/workers/service/ServiceWorkerRegistrationParameters.h
Source/WebCore/workers/service/server/SWServer.cpp [new file with mode: 0644]
Source/WebCore/workers/service/server/SWServer.h [new file with mode: 0644]
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/DerivedSources.make
Source/WebKit/Platform/Logging.h
Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp
Source/WebKit/StorageProcess/StorageToWebProcessConnection.h
Source/WebKit/StorageProcess/StorageToWebProcessConnection.messages.in
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/Storage/WebSWServerConnection.cpp [new file with mode: 0644]
Source/WebKit/WebProcess/Storage/WebSWServerConnection.h [new file with mode: 0644]
Source/WebKit/WebProcess/Storage/WebSWServerConnection.messages.in [new file with mode: 0644]
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h