Add (entirely incorrect) fetching of ServiceWorker scripts.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 16:20:04 +0000 (16:20 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 16:20:04 +0000 (16:20 +0000)
commit0fdbfbba99e3f4bf7c3aa178faab6fcad075c68f
tree339213cc8c9a03ec17c977459454526b0b38ad04
parent2d944629293871900c954ffd211b9df87c7f1e60
Add (entirely incorrect) fetching of ServiceWorker scripts.
https://bugs.webkit.org/show_bug.cgi?id=176179

Reviewed by Andy Estes.

Source/WebCore:

No new tests (Covered by changes to existing tests).

When the Storage process is running the "Update" algorithm and a ServiceWorker script file needs to be fetched, this patch:
  - Messages back to the WebContent process that started the register/update job
  - Executes a FetchLoad in that script context for the script
  - Sends the results back to the Storage process

We don't do anything with the results yet.

Soon.

* WebCore.xcodeproj/project.pbxproj:

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::didFail):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::error const):

* workers/WorkerScriptLoaderClient.h:
(WebCore::WorkerScriptLoaderClient::~WorkerScriptLoaderClient):
(WebCore::WorkerScriptLoaderClient::didReceiveResponse): Deleted.
(WebCore::WorkerScriptLoaderClient::notifyFinished): Deleted.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
* workers/service/ServiceWorkerContainer.h:

* workers/service/ServiceWorkerFetchResult.h: Copied from Source/WebCore/workers/service/server/SWClientConnection.h.
(WebCore::ServiceWorkerFetchResult::encode const):
(WebCore::ServiceWorkerFetchResult::decode):

* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::startScriptFetch):
(WebCore::ServiceWorkerJob::fetchScriptWithContext):
(WebCore::ServiceWorkerJob::didReceiveResponse):
(WebCore::ServiceWorkerJob::notifyFinished):
* workers/service/ServiceWorkerJob.h:
* workers/service/ServiceWorkerJobClient.h:

* workers/service/server/SWClientConnection.cpp:
(WebCore::SWClientConnection::finishedFetchingScript):
(WebCore::SWClientConnection::failedFetchingScript):
(WebCore::SWClientConnection::startScriptFetchForServer):
* workers/service/server/SWClientConnection.h:

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::finishFetchingScriptInServer):
(WebCore::SWServer::startScriptFetch):
(WebCore::SWServer::scriptFetchFinished):
* workers/service/server/SWServer.h:

* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scriptFetchFinished):
(WebCore::SWServerRegistration::runUpdateJob):
(WebCore::SWServerRegistration::startScriptFetchFromMainThread):
(WebCore::SWServerRegistration::startScriptFetchForCurrentJob):
* workers/service/server/SWServerRegistration.h:

Source/WebKit:

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startScriptFetchInClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:

* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::finishFetchingScriptInServer):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

LayoutTests:

* http/tests/workers/service/basic-register-exceptions-expected.txt:
* http/tests/workers/service/basic-register-expected.txt:
* http/tests/workers/service/resources/basic-register-exceptions.js:
* http/tests/workers/service/resources/basic-register.js:
* http/tests/workers/service/resources/registration-task-queue-scheduling-1.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt
LayoutTests/http/tests/workers/service/basic-register-expected.txt
LayoutTests/http/tests/workers/service/resources/basic-register-exceptions.js
LayoutTests/http/tests/workers/service/resources/basic-register.js
LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h
Source/WebCore/workers/WorkerScriptLoaderClient.h
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Source/WebCore/workers/service/ServiceWorkerFetchResult.h [new file with mode: 0644]
Source/WebCore/workers/service/ServiceWorkerJob.cpp
Source/WebCore/workers/service/ServiceWorkerJob.h
Source/WebCore/workers/service/ServiceWorkerJobClient.h
Source/WebCore/workers/service/server/SWClientConnection.cpp
Source/WebCore/workers/service/server/SWClientConnection.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerRegistration.cpp
Source/WebCore/workers/service/server/SWServerRegistration.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in