Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9eb3fbd1532c39dd1c3288a94d70e478651b8451
      
https://github.com/WebKit/WebKit/commit/9eb3fbd1532c39dd1c3288a94d70e478651b8451
  Author: Ben Nham <[email protected]>
  Date:   2026-08-05 (Wed, 05 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ServiceWorkerBasic.mm

  Log Message:
  -----------
  Shared/service workers don't run in same process after COOP-induced BCG switch
https://bugs.webkit.org/show_bug.cgi?id=321021
rdar://182280016

Reviewed by Ryosuke Niwa.

When Site Isolation is off, we sometimes don't consider the WebProcess that 
hosts the webpage as a
candidate for running same-origin shared and service workers. This is 
unintended.

This occurs because we only record the process => site association at 
provisional load time, not
commit time. In the case of a forced process swap due to a COOP response header:

1. Process A performs the provisional load, and records the process => site 
mapping.
2. We handle the COOP response header and force a BCG and process switch.
3. Process B continues the load and commits, but we never record a process => 
site mapping for this
new process.

To fix this, record the process => site mapping at commit time.

This only needs to occur when Site Isolation is off; when Site Isolation is on, 
we were already
recording the process => site mapping via a different path (in
didStartUsingProcessForSiteIsolation).

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ServiceWorkerBasic.mm

* Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _webContentProcessInfo]):
(+[WKProcessPool _webContentProcessInfoForTesting]):
* Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
(WebKit::WebProcessProxy::didCommitMainFrameLoadWithoutSiteIsolation):
(WebKit::WebProcessProxy::updateSiteForMainFrameNavigation):
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ServiceWorkerBasic.mm:
((ServiceWorkers, SharedWorkerReusesProcessAfterCOOPProcessSwap)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to