Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 10051ef2013ae5fc4ab0aedea7ccb0667ae277e2
      
https://github.com/WebKit/WebKit/commit/10051ef2013ae5fc4ab0aedea7ccb0667ae277e2
  Author: Youenn Fablet <you...@apple.com>
  Date:   2025-05-16 (Fri, 16 May 2025)

  Changed paths:
    M LayoutTests/http/tests/workers/service/resultingClientId-worker.js
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebCore/workers/service/server/SWServer.h

  Log Message:
  -----------
  Process swapping a service worker client should reuse 
SWServer::unregisterServiceWorkerClient
https://bugs.webkit.org/show_bug.cgi?id=292868
rdar://151102931

Reviewed by Per Arne Vollan.

When process-swapping, we were using a specific code path to remove the past 
identifier (with the past process ID) before populating the maps with the new 
identifier (with the new process ID).
We missed updating m_clientsByRegistrableDomain.

For that reason, we are now instead using the regular service worekr client 
unregister code path (from unregisterServiceWorkerClient).
Since we do not want to update the service worker registrations given this is 
just a replacement of clients, we introduce 
SWServer::unregisterServiceWorkerClientInternal,
which will always clear all map entries but will only update service worker 
registrations if asked to do so.

We call unregisterServiceWorkerClientInternal from the process-swapping code 
path (without updating service worker registrations),
as well as from the regular SWServer::unregisterServiceWorkerClient code path 
(with updating service worker registrations).

We update the test to make sure that using the resultingClientId allows post 
messaging to the context.

* LayoutTests/http/tests/workers/service/resultingClientId-worker.js:
(onmessage.async e):
(onfetch.async e.const.text.html.body.script.onload.async navigator):
(onfetch.async e):
* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::registerServiceWorkerClient):
(WebCore::SWServer::gatherClientData):
(WebCore::SWServer::unregisterServiceWorkerClientInternal):
(WebCore::SWServer::unregisterServiceWorkerClient):
* Source/WebCore/workers/service/server/SWServer.h:

Canonical link: https://commits.webkit.org/294997@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