Add ServiceWorkerJob.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Aug 2017 19:28:26 +0000 (19:28 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Aug 2017 19:28:26 +0000 (19:28 +0000)
commit4dc8690081f9befee09531eb855f02b26e5d0de4
tree2ee1d5a6ed36bff6651f3064f8b61451272bfb7b
parent9824ddb57200346305a97a3fd758eba770042cb5
Add ServiceWorkerJob.
https://bugs.webkit.org/show_bug.cgi?id=175241

Reviewed by Tim Horton.

Source/WebCore:

Test: http/tests/workers/service/basic-register.html

This patch does a few things:
- Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
- Adds a ServiceWorkerProvider interface for WebKit to implement
- Actually creates a job for service worker registration and "schedules" it,
  though it always immediately errors out the promise.

Actually queuing jobs and executing asynchronously is coming up soon.

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

* dom/Document.cpp:
(WebCore::Document::sessionID const):
* dom/Document.h:

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

* workers/ServiceWorkerJob.cpp: Added.
(WebCore::ServiceWorkerJob::ServiceWorkerJob):
(WebCore::ServiceWorkerJob::~ServiceWorkerJob):
(WebCore::ServiceWorkerJob::failedWithException):
* workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
(WebCore::ServiceWorkerJob::createRegisterJob):
(WebCore::ServiceWorkerJob::identifier const):

* workers/ServiceWorkerJobClient.h: Added.
(WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):

* workers/ServiceWorkerProvider.cpp: Added.
(WebCore::ServiceWorkerProvider::singleton):
(WebCore::ServiceWorkerProvider::setSharedProvider):
* workers/ServiceWorkerProvider.h: Added.
* workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
* workers/ServiceWorkerRegistrationParameters.cpp: Added.
* workers/ServiceWorkerRegistrationParameters.h: Added.

Source/WebKit:

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

* WebProcess/Storage/WebServiceWorkerProvider.cpp: Added.
(WebKit::WebServiceWorkerProvider::singleton):
(WebKit::WebServiceWorkerProvider::WebServiceWorkerProvider):
(WebKit::WebServiceWorkerProvider::scheduleJob):
* WebProcess/Storage/WebServiceWorkerProvider.h: Added.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

LayoutTests:

Verifies that the "serviceWorker.register()" job we currently schedule fails as expected.

* http/tests/workers/service/basic-register-expected.txt: Added.
* http/tests/workers/service/basic-register.html: Added.
* http/tests/workers/service/resources/basic-register.js: Added.
* http/tests/workers/service/resources/empty-worker.js: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-register-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/basic-register.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/basic-register.js [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/empty-worker.js [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/workers/ServiceWorkerContainer.cpp
Source/WebCore/workers/ServiceWorkerContainer.h
Source/WebCore/workers/ServiceWorkerJob.cpp [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerJob.h [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerJobClient.h [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerProvider.cpp [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerProvider.h [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerRegistrationOptions.h [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerRegistrationParameters.h [new file with mode: 0644]
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp [new file with mode: 0644]
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h [new file with mode: 0644]
Source/WebKit/WebProcess/WebProcess.cpp