Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fdc110d65b5f351867640dc68c02bf90ecc7272
      
https://github.com/WebKit/WebKit/commit/4fdc110d65b5f351867640dc68c02bf90ecc7272
  Author: Sihui Liu <[email protected]>
  Date:   2026-08-06 (Thu, 06 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] WebProcessProxy::m_sharedProcessDomains only tracks the 
first domain loaded in shared process
https://bugs.webkit.org/show_bug.cgi?id=321137
rdar://183490258

Reviewed by Ryosuke Niwa.

Under Site Isolation with the shared process enabled, 
WebProcessProxy::m_sharedProcessDomains was
only populated when a shared process was first created for a 
BrowsingContextGroup. When the same
shared process went on to host additional sites -- either because another site 
was admitted to the
group's already-assigned shared process, or because the process was reused for 
a site via
BrowsingContextGroup::ensureProcessForSite -- those domains were never added, 
so the set held at
most one domain no matter how many sites the process actually hosted.

Two independent checks consult this set, and the incomplete record broke both 
in opposite
directions:
- WebProcessPool::processForSite's process-cache reuse check refuses to reuse a 
cached shared
process that hosts a domain needing isolation. Since the recorded set couldn't 
see domains
admitted after the first, a cached process holding a domain with recorded user 
interaction could
still be reused.
- WebProcessProxy::allowsFirstPartyAccess() denies access for a hosted domain 
that isn't in the
recorded set. Legitimately-hosted-but-unrecorded domains were therefore wrongly 
denied first-party
access (e.g. for badging).

Record every domain as it is admitted to a shared process, not just the first, 
and clear the set
whenever a process is (re)assigned as a shared process for a 
BrowsingContextGroup so that domains
recorded for a previous group's use of the process don't leak into the new 
assignment's isolation
decisions.

* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::sharedProcessForSite):
(WebKit::BrowsingContextGroup::ensureProcessForSite):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didStartUsingProcessForSiteIsolation):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, 
SharedProcessWebProcessCacheSharedProcessForSiteWithUserInteraction)):
Updated expectation for the expected behavior after change.

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



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

Reply via email to