Add initial implementation for serviceWorker.postMessage()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Oct 2017 21:22:54 +0000 (21:22 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Oct 2017 21:22:54 +0000 (21:22 +0000)
commitbf94b9faf9fc7211e3af8cc78d2180d907a740d3
tree14c5e22bc5e6e023ccde552fa7227ce43e256b1b
parentc47f59060a0a300a13cd3a038595e1e037625038
Add initial implementation for serviceWorker.postMessage()
https://bugs.webkit.org/show_bug.cgi?id=178534

Reviewed by Youenn Fablet.

Source/WebCore:

Add initial implementation for serviceWorker.postMessage():
- https://w3c.github.io/ServiceWorker/#service-worker-postmessage

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

* CMakeLists.txt:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSExtendableMessageEvent.cpp: Added.
(WebCore::JSExtendableMessageEvent::data const):
* bindings/js/WebCoreBuiltinNames.h:
* dom/Document.h:
* dom/EventNames.in:
* dom/MessagePortChannel.h:
* dom/ScriptExecutionContext.h:
* workers/WorkerGlobalScope.h:
* workers/service/ExtendableEvent.cpp:
(WebCore::ExtendableEvent::ExtendableEvent):
(WebCore::ExtendableEvent::~ExtendableEvent):
* workers/service/ExtendableEvent.h:
* workers/service/ExtendableMessageEvent.cpp: Added.
(WebCore::ExtendableMessageEvent::create):
(WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
(WebCore::ExtendableMessageEvent::~ExtendableMessageEvent):
* workers/service/ExtendableMessageEvent.h: Added.
* workers/service/ExtendableMessageEvent.idl: Added.
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::ServiceWorker):
(WebCore::ServiceWorker::postMessage):
(WebCore::ServiceWorker::state const):
(WebCore::ServiceWorker::scriptExecutionContext const):
* workers/service/ServiceWorker.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::controller const):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::thread):
* workers/service/ServiceWorkerGlobalScope.h:
(isType):
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
* workers/service/context/ServiceWorkerThread.h:
* workers/service/server/SWClientConnection.h:

Source/WebKit:

Add initial implementation for serviceWorker.postMessage():
- https://w3c.github.io/ServiceWorker/#service-worker-postmessage

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

LayoutTests:

Add layout test coverage.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223922 268f45cc-cd09-0410-ab3c-d52691b4dbfc
42 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-ServiceWorker-postMessage.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/basic-ServiceWorker-postMessage.https.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage-worker.js [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage.js [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/dom/Document.h
Source/WebCore/dom/EventNames.in
Source/WebCore/dom/MessagePortChannel.h
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebCore/workers/service/ExtendableEvent.cpp
Source/WebCore/workers/service/ExtendableEvent.h
Source/WebCore/workers/service/ExtendableMessageEvent.cpp [new file with mode: 0644]
Source/WebCore/workers/service/ExtendableMessageEvent.h [new file with mode: 0644]
Source/WebCore/workers/service/ExtendableMessageEvent.idl [new file with mode: 0644]
Source/WebCore/workers/service/ServiceWorker.cpp
Source/WebCore/workers/service/ServiceWorker.h
Source/WebCore/workers/service/ServiceWorker.idl
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp
Source/WebCore/workers/service/ServiceWorkerGlobalScope.h
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
Source/WebCore/workers/service/context/ServiceWorkerThread.h
Source/WebCore/workers/service/server/SWClientConnection.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/ServiceWorkerContextManager.cpp
Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h
Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.messages.in
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h