Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 8f8c1da762686cec4b5140d95b4212945cdd75bb https://github.com/WebKit/WebKit/commit/8f8c1da762686cec4b5140d95b4212945cdd75bb Author: Youenn Fablet <youe...@gmail.com> Date: 2023-04-11 (Tue, 11 Apr 2023)
Changed paths: M LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controlled-dedicatedworker-postMessage.https-expected.txt M LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controlled-iframe-postMessage.https-expected.txt M Source/WebCore/workers/service/SWClientConnection.cpp M Source/WebCore/workers/service/SWClientConnection.h M Source/WebCore/workers/service/ServiceWorkerContainer.cpp M Source/WebCore/workers/service/WorkerSWClientConnection.cpp M Source/WebCore/workers/service/WorkerSWClientConnection.h M Source/WebCore/workers/service/server/SWServer.cpp M Source/WebCore/workers/service/server/SWServer.h M Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp M Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h M Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in M Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp M Source/WebKit/WebProcess/Storage/WebSWClientConnection.h M Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in Log Message: ----------- Finalize postMessage support to being created service worker clients https://bugs.webkit.org/show_bug.cgi?id=255203 rdar://problem/107802408 Reviewed by Chris Dumez. We change the way service worker client postMessage is done to fully align with the spec. Whenever posting a message to a service worker client, we go to network process. Previously, we were directly going to the client web process. We are now checking whether the client is a being created client. A being created client is a client registered in network process when receiving a navigation or main script load. The client, when fully created, is updating its data by registering itself through IPC. At this point, the client is no longer a being created client. A client is a being created client if SWServer:: m_clientPendingMessagesById has an entry with the client ID. As long as the client is a being created client, we store the message until the client is created in the web process. When the client is registering itself, we remove the entry in SWServer:: m_clientPendingMessagesById and send all pending messages. This allows direct support of workers since we reuse the normal post message process. This also gets us closer to spec, in particular: - We ensure message ordering is always preserved. - We ensure we do not overbuffer messages. Covered by rebased newly added WPT tests. * LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controlled-dedicatedworker-postMessage.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/controlled-iframe-postMessage.https-expected.txt: * Source/WebCore/dom/Document.cpp: (WebCore::m_isNonRenderedPlaceholder): * Source/WebCore/workers/service/SWClientConnection.cpp: (WebCore::postMessageToContainer): (WebCore::SWClientConnection::postMessageToServiceWorkerClient): * Source/WebCore/workers/service/SWClientConnection.h: * Source/WebCore/workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ServiceWorkerContainer): (WebCore::ServiceWorkerContainer::startMessages): (WebCore::ServiceWorkerContainer::postMessage): (WebCore::ServiceWorkerContainer::addEventListener): * Source/WebCore/workers/service/WorkerSWClientConnection.cpp: (WebCore::WorkerSWClientConnection::getServiceWorkerClientPendingMessages): Deleted. * Source/WebCore/workers/service/WorkerSWClientConnection.h: * Source/WebCore/workers/service/server/SWServer.cpp: (WebCore::SWServer::registerServiceWorkerClient): (WebCore::SWServer::postMessageToServiceWorkerClient): (WebCore::SWServer::addServiceWorkerClientPendingMessage): Deleted. * Source/WebCore/workers/service/server/SWServer.h: * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::controlClient): (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient): (WebKit::WebSWServerConnection::registerServiceWorkerClient): (WebKit::WebSWServerConnection::registerServiceWorkerClientInternal): (WebKit::WebSWServerConnection::getServiceWorkerClientPendingMessages): Deleted. * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h: * Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::getServiceWorkerClientPendingMessages): Deleted. * Source/WebKit/WebProcess/Storage/WebSWClientConnection.h: * Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in: Canonical link: https://commits.webkit.org/262818@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes