Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 105b0b17d2379e30e2783968c57639d9baa4e089
      
https://github.com/WebKit/WebKit/commit/105b0b17d2379e30e2783968c57639d9baa4e089
  Author: Ryosuke Niwa <[email protected]>
  Date:   2025-09-25 (Thu, 25 Sep 2025)

  Changed paths:
    M Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp
    M Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
    M Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
    M Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
    M Source/WebKit/NetworkProcess/NetworkProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkProcess.h
    M Source/WebKit/NetworkProcess/NetworkProcess.messages.in
    M Source/WebKit/UIProcess/BrowsingContextGroup.cpp
    M Source/WebKit/UIProcess/BrowsingContextGroup.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  Isolate a website into its own process when ITP informs of user interaction 
when shared process is enabled
https://bugs.webkit.org/show_bug.cgi?id=298805
rdar://160978534

Reviewed by Ben Nham.

When ITP database has a record of user interactions with a given site, isolate 
the site into its own process
even when shared process is enabled for site isolation. To do this, we 
enumerate the set of all sites that
have had user interactions in 
WebsiteDataStore::fetchDomainsWithUserInteraction, and cache this result in
WebsiteDataStore. When there is a new user interaction with a registrable 
domain, we notify WebsiteDataStore
via WebProcessProxy::recordUserGestureAuthorizationToken, which updates the 
cache.

Test: TestWebKitAPI.SiteIsolation.SharedProcessWithResourceLoadStatistics
      TestWebKitAPI.SiteIsolation.SharedProcessAfterClick
      TestWebKitAPI.SiteIsolation.SharedProcessAfterKeyDown
      
TestWebKitAPI.SiteIsolation.SharedProcessAfterUserInteractionInSharedProcesss

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
* Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::loadWebsitesWithUserInteraction): Added. 
Returns a set of all sites
which has had user interactions in the past.

* Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:

* Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::loadWebsitesWithUserInteraction): 
Added. Fetch the set of all sites
which has had user interactions using the background queue.

* Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::fetchWebsitesWithUserInteractions): Added. Fetch the 
set of sites, in the form of
registrable domains, which has had user interactions in the past.

* Source/WebKit/NetworkProcess/NetworkProcess.h:

* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:

* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::BrowsingContextGroup::sharedProcessForSite): Now takes a completion 
handler with FrameProcess
instead of synchronously returning it since now our decision may depend on an 
IPC to the network process.
(WebKit::BrowsingContextGroup::addFrameProcessAndInjectPageContextIf): Fixed a 
bug that this function was
trying to create remote pages even if the page had already been created. Keep 
track of the set of pages
that have already been created in the hash set (m_pagesInSharedProcess).

* Source/WebKit/UIProcess/BrowsingContextGroup.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::sendMouseEvent):
(WebKit::WebPageProxy::sendKeyEvent): Fixed a bug that we were using 
protectedLegacyMainFrameProcess() to
record the user gesture authorization token.
(WebKit::WebPageProxy::sendPreventableTouchEvent):
(WebKit::WebPageProxy::sendUnpreventableTouchEvent):
(WebKit::WebPageProxy::receivedNavigationActionPolicyDecision): Add the first 
party cookie access to the
shared process if we're loading the main frame.

* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::recordUserGestureAuthorizationToken): Inform the 
website data store that a given
site had user interactions.

* Source/WebKit/UIProcess/WebProcessProxy.h:

* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDomainsWithUserInteraction): Added.
(WebKit::WebsiteDataStore::didHaveUserInteractionForSiteIsolation): Added. 
Updates the set of registrable
domains that have had user interactions in the past. There is a subtle race 
condition to take care of in
this function. When a new site receives user interactions after 
fetchDomainsWithUserInteraction is called
(so that the set is being fetched from the network process) but before it 
receives the response from the
network process, the result we get from the network process might be missing 
this particular site. To avoid
this race condition, we store the relevant registrable domain in 
m_pendingDomainsWithUserInteractions under
this exact circumstances and add it to the set of sites we get back from the 
network process.

(WebKit::WebsiteDataStore::logUserInteraction):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::siteIsolatedViewWithSharedProcess):
(TestWebKitAPI::(SiteIsolation, SharedProcessWithResourceLoadStatistics)): 
Added.
(TestWebKitAPI::(SiteIsolation, SharedProcessAfterClick)): Added.
(TestWebKitAPI::(SiteIsolation, SharedProcessAfterKeyDown)): Added.
(TestWebKitAPI::(SiteIsolation, 
SharedProcessAfterUserInteractionInSharedProcesss)):

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