Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b4ee52d5126b7b02101c8c03963124d016ce063b
      
https://github.com/WebKit/WebKit/commit/b4ee52d5126b7b02101c8c03963124d016ce063b
  Author: Youenn Fablet <you...@apple.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/dom/ScriptExecutionContext.cpp
    M Source/WebCore/workers/service/SWClientConnection.h
    M Source/WebCore/workers/service/ServiceWorker.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/WebCore/workers/service/server/SWServerWorker.cpp
    M Source/WebCore/workers/service/server/SWServerWorker.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/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h

  Log Message:
  -----------
  REGRESSION(299181@main): [ macOS wk2 ] 2x http/wpt/service-workers/ 
(layout-tests) tests are constant failures
rdar://159292159
https://bugs.webkit.org/show_bug.cgi?id=297974

Reviewed by Brady Eidson.

We were using registrations as a way to send worker state update from network 
process to web processes.
But, it is possible for a web process to have a worker but no registration.
This happens in the failing tests as registrations get GCed.

To fix the issue, instead of relying on registrations, we now register web 
process connections to SWServerWorker.
When a SWServerWorker state is updated, it will have the full list of web 
processes to send updates to.

This list of web processes is either web processes that have a 
ServiceWorkerRegistration of the given service worker, or web processes that 
have a ServiceWorker of the given service worker.
The former is needed as a registration may get updated to have a new service 
worker, which may be updated before the web process has time to create the 
ServiceWorker object.
The latter is needed if the ServiceWorkerRegistration of a ServiceWorker gets 
collected or if the ServiceWorker is created without any 
ServiceWorkerRegistration (for instance as part of MessageEventSource).

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::applyToSWClientConnection):
(WebCore::ScriptExecutionContext::registerServiceWorker):
(WebCore::ScriptExecutionContext::unregisterServiceWorker):
* Source/WebCore/workers/service/SWClientConnection.h:
* Source/WebCore/workers/service/WorkerSWClientConnection.cpp:
(WebCore::WorkerSWClientConnection::registerServiceWorkerInServer):
(WebCore::WorkerSWClientConnection::unregisterServiceWorkerInServer):
* Source/WebCore/workers/service/WorkerSWClientConnection.h:
* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::registerServiceWorkerInServer):
(WebCore::SWServer::Connection::unregisterServiceWorkerInServer):
(WebCore::SWServer::registerServiceWorkerConnection):
(WebCore::SWServer::unregisterServiceWorkerConnection):
* Source/WebCore/workers/service/server/SWServer.h:
* Source/WebCore/workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::setState):
(WebCore::SWServerWorker::registerServiceWorkerConnection):
(WebCore::SWServerWorker::unregisterServiceWorkerConnection):
* Source/WebCore/workers/service/server/SWServerWorker.h:
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
* Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::registerServiceWorkerInServer):
(WebKit::WebSWClientConnection::unregisterServiceWorkerInServer):
* Source/WebKit/WebProcess/Storage/WebSWClientConnection.h:
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::registerServiceWorker):
(WebKit::WebProcess::runegisterServiceWorker):
* Source/WebKit/WebProcess/WebProcess.h:

Canonical link: https://commits.webkit.org/299839@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to