Add support for unregistering a service worker
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Oct 2017 18:28:54 +0000 (18:28 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Oct 2017 18:28:54 +0000 (18:28 +0000)
commit6deb032e4c366387e799c9ef116bbe8732682360
treee4fb92a7c809cc764c51cdda4ef0a8f028ec5ae4
parent0ef660181f6b54fcd70aeac064ac1c4728af46a1
Add support for unregistering a service worker
https://bugs.webkit.org/show_bug.cgi?id=178735

Reviewed by Brady Eidson.

Source/WebCore:

Add support for unregistering a service worker:
- https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister

Test: http/tests/workers/service/basic-unregister.https.html

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
* workers/service/ServiceWorkerJob.h:
* workers/service/ServiceWorkerJobClient.h:
* workers/service/ServiceWorkerJobData.h:
(WebCore::ServiceWorkerJobData::encode const):
(WebCore::ServiceWorkerJobData::decode):
* workers/service/ServiceWorkerJobType.h:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::containerForScriptExecutionContext):
(WebCore::ServiceWorkerRegistration::unregister):
* workers/service/server/SWClientConnection.cpp:
(WebCore::SWClientConnection::registrationJobResolvedInServer):
(WebCore::SWClientConnection::unregistrationJobResolvedInServer):
* workers/service/server/SWClientConnection.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::resolveRegistationJob):
(WebCore::SWServer::resolveUnregistrationJob):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::scriptContextStarted):
(WebCore::SWServerRegistration::startNextJob):
(WebCore::SWServerRegistration::runUnregisterJob):
(WebCore::SWServerRegistration::resolveWithRegistrationOnMainThread):
(WebCore::SWServerRegistration::resolveWithUnregistrationResultOnMainThread):
(WebCore::SWServerRegistration::resolveCurrentRegistrationJob):
(WebCore::SWServerRegistration::resolveCurrentUnregistrationJob):
* workers/service/server/SWServerRegistration.h:

Source/WebKit:

Add support for unregistering a service worker:
- https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
(WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

LayoutTests:

Add layout test coverage.

* http/tests/workers/service/basic-unregister.https-expected.txt: Added.
* http/tests/workers/service/basic-unregister.https.html: Added.
* http/tests/workers/service/resources/basic-unregister.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-unregister.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/basic-unregister.https.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/basic-unregister.js [new file with mode: 0644]
Source/WebCore/ChangeLog
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/ServiceWorkerJobClient.h
Source/WebCore/workers/service/ServiceWorkerJobData.h
Source/WebCore/workers/service/ServiceWorkerJobType.h
Source/WebCore/workers/service/ServiceWorkerRegistration.cpp
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/WebProcess/Storage/WebSWClientConnection.messages.in