Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 64fda2fa68e045b76c91af8864e0cde1d8ffe896
      
https://github.com/WebKit/WebKit/commit/64fda2fa68e045b76c91af8864e0cde1d8ffe896
  Author: Sihui Liu <sihui_...@apple.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkSession.cpp
    M Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
    M 
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in
    M Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
    M Source/WebKit/Shared/ResourceLoadStatisticsParameters.h
    M Source/WebKit/Shared/ResourceLoadStatisticsParameters.serialization.in
    M Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

  Log Message:
  -----------
  Ensure TrackingPreventionEnabled flag is correctly set before using 
WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=270382
rdar://123922825

Reviewed by Chris Dumez.

We currently set TrackingPreventionEnabled on WebsiteDataStore in 
WebProcessPool::createNewWebProcess. This has caused
problem that TrackingPreventionEnabled is incorrectly set when WebsiteDataStore 
(or its corresponding NetworkSession)
is in use. One case is when process is created for prewarm, it does not have a 
attached WebsiteDataStore (it will be
assigned a WebsiteDataStore later), so we don't set TrackingPreventionEnabled 
flag, and we don't set it when the
prewarmed process is used for loading (WebsiteDataStore is assigned to it). 
Another case is when WebsiteDataStore is
used without web process for website data retrieval. Failing to set the flag 
will cause ITP data not to be fetched or
removed.

To fix this issue, this patch moves TrackingPreventionEnabled setting to 
WebsiteDataStore: WebsiteDataStore will get
the right value when it needs to send its parameters to network process and web 
process (i.e. it's going to be used).
To simply the setting logic, this patch also makes the following changes:
1. WebsiteDataStore::m_trackingPreventionEnabled now has 3 states: yes, no and 
default, where default means we will fall
back to TCC permission state to decide the value. This enables us to remove 
m_isTrackingPreventionStateExplicitlySet.
2. Drop appHasRequestedCrossWebsiteTrackingPermission and 
TrackingPreventionStateExplicitlySet parameters since network
process does not need to re-compute the TrackingPreventionEnabled value and 
know about how it is computed. We previously
used it for logging and debugging purpose, and we probably don't need it any 
more (as TCC check is not free). This patch
replaces it with normal logging in NetworkSession::setTrackingPreventionEnabled.

* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setTrackingPreventionEnabled):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* 
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in:
* Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
(WebKit::activateSessionCleanup): Deleted.
* Source/WebKit/Shared/ResourceLoadStatisticsParameters.h:
* Source/WebKit/Shared/ResourceLoadStatisticsParameters.serialization.in:
* Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetResourceLoadStatisticsEnabled):
* Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
(WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
(WebKit::WebsiteDataStore::defaultTrackingPreventionEnabled const):
(WebKit::WebsiteDataStore::trackingPreventionEnabled const):
(WebKit::WebsiteDataStore::setTrackingPreventionEnabled):
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::isTrackingPreventionStateExplicitlySet const): 
Deleted.
(WebKit::WebsiteDataStore::useExplicitTrackingPreventionState): Deleted.

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