Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 687b1d8c28edad817a19de884599ba26cbf4923d
      
https://github.com/WebKit/WebKit/commit/687b1d8c28edad817a19de884599ba26cbf4923d
  Author: Youenn Fablet <[email protected]>
  Date:   2025-06-23 (Mon, 23 Jun 2025)

  Changed paths:
    M LayoutTests/http/tests/workers/service/resultingClientId.https.html
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
    M Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
    M Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h

  Log Message:
  -----------
  SWServer is being registered a client with a potentially wrong origin in case 
of load transfer
rdar://153775893
https://bugs.webkit.org/show_bug.cgi?id=294836

Reviewed by Chris Dumez.

In case of navigation redirection and process swap, we would reuse the original 
request URL to register the client.
This could trigger a mismatch as the client origin is with the most recent 
request URL.

The consequence is that we would register a client with an ID and an origin A.
And we would later on register a client with an ID and an origin B.

This is breaking the model in SWServer and would trigger a desynchronization of 
the internal maps, leading to a nullptr crash in 
SWServer::forEachClientForOrigin.

To prevent this, we update 
WebSWServerConnection::transferServiceWorkerLoadToNewWebProcess to use the most 
recent URL and not the original one.

Covered by updated test in debug with added assertion.

* LayoutTests/http/tests/workers/service/resultingClientId.https.html:
* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::validateClientOrigin):
(WebCore::SWServer::registerServiceWorkerClient):
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::transferToNewWebProcess):
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h:

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



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

Reply via email to