Add Internals.terminateServiceWorker, and the ability to restart service workers...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Dec 2017 19:45:41 +0000 (19:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Dec 2017 19:45:41 +0000 (19:45 +0000)
commit78a26a7718a152982fe13df7c07d0eaff9976b96
treec5048d34df8b86221ef921617b12a5d4d665e816
parent19f89a7d713a248195563ccd6e163300c4a4f851
Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
https://bugs.webkit.org/show_bug.cgi?id=180170

Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/workers/service/postmessage-after-terminate.https.html

* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObject::~ActiveDOMObject):

* testing/Internals.cpp:
(WebCore::Internals::terminateServiceWorker):
* testing/Internals.h:
* testing/Internals.idl:

* workers/service/SWClientConnection.h:

* workers/service/ServiceWorker.idl:

* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
(WebCore::SWContextManager::terminateWorker):
* workers/service/context/SWContextManager.h:

* workers/service/context/ServiceWorkerThreadProxy.h:

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::workerByID const):
(WebCore::SWServer::Connection::syncTerminateWorker):
(WebCore::SWServer::installContextData):
(WebCore::SWServer::invokeRunServiceWorker):
(WebCore::SWServer::terminateWorker):
(WebCore::SWServer::syncTerminateWorker):
(WebCore::SWServer::terminateWorkerInternal):
(WebCore::SWServer::workerContextTerminated):
* workers/service/server/SWServer.h:
(WebCore::SWServer::workerByID const): Deleted.

* workers/service/server/SWServerToContextConnection.h:

* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::contextData const):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::isRunning const):
(WebCore::SWServerWorker::isTerminating const):
(WebCore::SWServerWorker::setState):
(WebCore::SWServerWorker::server):

Source/WebKit:

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

* StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::syncTerminateWorker):
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:

* StorageProcess/StorageToWebProcessConnection.cpp:
(WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):

* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::syncTerminateWorker):
* WebProcess/Storage/WebSWClientConnection.h:

* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::terminateWorker):
(WebKit::WebSWContextManagerConnection::syncTerminateWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

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

Source/WTF:

* wtf/CompletionHandler.h:
(WTF::CompletionHandler<Out):

LayoutTests:

* http/tests/workers/service/postmessage-after-terminate.https-expected.txt: Added.
* http/tests/workers/service/postmessage-after-terminate.https.html: Added.
* http/tests/workers/service/resources/basic-ServiceWorker-postMessage.js:
(then):
* http/tests/workers/service/resources/postmessage-after-terminate.js: Copied from LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage.js.
(then):
* http/tests/workers/service/resources/postmessage-echo-worker.js: Renamed from LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage-worker.js.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/postmessage-after-terminate.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/postmessage-after-terminate.https.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage.js
LayoutTests/http/tests/workers/service/resources/postmessage-after-terminate.js [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/postmessage-echo-worker.js [moved from LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage-worker.js with 100% similarity]
Source/WTF/ChangeLog
Source/WTF/wtf/CompletionHandler.h
Source/WebCore/ChangeLog
Source/WebCore/dom/ActiveDOMObject.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/workers/service/SWClientConnection.h
Source/WebCore/workers/service/ServiceWorker.idl
Source/WebCore/workers/service/context/SWContextManager.cpp
Source/WebCore/workers/service/context/SWContextManager.h
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerToContextConnection.h
Source/WebCore/workers/service/server/SWServerWorker.cpp
Source/WebCore/workers/service/server/SWServerWorker.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/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h
Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h