[webkit-changes] [WebKit/WebKit] 77fc47: Make network process wait web processes to exit be...

Sihui noreply at github.com
Thu Feb 13 19:53:28 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 77fc477a6eedabe4679b2f88496e837673b901e3
      https://github.com/WebKit/WebKit/commit/77fc477a6eedabe4679b2f88496e837673b901e3
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2025-02-13 (Thu, 13 Feb 2025)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkProcess.h
    M Source/WebKit/NetworkProcess/NetworkProcess.messages.in
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
    M Source/WebKit/UIProcess/WebProcessCache.cpp
    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
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm

  Log Message:
  -----------
  Make network process wait web processes to exit before deleting data
https://bugs.webkit.org/show_bug.cgi?id=287491
rdar://144626633

Reviewed by Chris Dumez.

In the case where clients close all web views before deleting website data, sometimes they notice data still exists in
next fetch. This is not because data is not removed, but data is populated after deletion, as the current implementation
does not wait until pages to fully close (and network requests to finish) before deletion. To fix this, now we make
network process wait web processes to exit before it deletes data. This is implemented by making UI process include
active web process identifiers in the delete data request sent to network process. For web process that's not active,
network process will wait for them to exit before starting deletion. To avoid waiting indefinitely, the wait will time
out after 3s and deletion will start anyways.

Also, to ensure inactive web processes (process that has no active page) will exit, during the website data deletion
process, UI process kill service worker processes, clear web process cache and disable web process cache.

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::performDeleteWebsiteDataTask):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataImpl):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::deleteWebsiteData):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::canCacheProcess const):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishRemoteWorkerContextConnectionToNetworkProcess):
(WebKit::WebProcessPool::terminateServiceWorkersForSession):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::computeWebProcessAccessTypeForDataRemoval):
(WebKit::computeWebProcessAccessTypeForDataRemovalWithRecords):
(WebKit::WebsiteDataStore::activeWebProcesses const):
(WebKit::WebsiteDataStore::removeDataInNetworkProcess):
(WebKit::WebsiteDataStore::removeData):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::isRemovingData const):
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::deleteWebsiteData):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::log):
(TestWebKitAPI::installServiceWorker):
(TestWebKitAPI::addEventListener):
(TestWebKitAPI::(WKWebsiteDataStore, RemoveDataWaitUntilWebProcessesExit)):
(TestWebKitAPI::TEST(WKWebsiteDataStore, FetchNonPersistentCredentials)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, FetchPersistentCredentials)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, RemoveNonPersistentCredentials)): Deleted.
(TestWebKitAPI::TEST(WebKit, SettingNonPersistentDataStorePathsThrowsException)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, FetchPersistentWebStorage)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, FetchNonPersistentWebStorage)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, SessionSetCount)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, ReferenceCycle)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, ClearCustomDataStoreNoWebViews)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DoNotCreateDefaultDataStore)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DefaultHSTSStorageDirectory)): Deleted.
(TestWebKitAPI::createWebsiteDataStoreAndPrepare): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DataStoreWithIdentifierAndPushPartition)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, RemoveDataStoreWithIdentifier)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, RemoveDataStoreWithIdentifierRemoveCredentials)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, RemoveDataStoreWithIdentifierErrorWhenInUse)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, ListIdentifiers)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStorePrivate, FetchWithSize)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DataStoreForNilIdentifier)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DataStoreForEmptyIdentifier)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, OriginQuotaRatio)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, OriginQuotaRatioInvalidValue)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, TotalQuotaRatio)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, TotalQuotaRatioWithResourceLoadStatisticsEnabled)): Deleted.
(TestWebKitAPI::htmlStringForTotalQuotaRatioTest): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, TotalQuotaRatioWithPersistedDomain)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, TotalQuotaRatioInvalidValue)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, QuotaRatioDefaultValue)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStoreConfiguration, StandardVolumeCapacity)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStorePrivate, CompletionHandlerForRemovalFromNetworkProcess)): Deleted.
(TestWebKitAPI::TEST(WKWebsiteDataStore, DoNotLogNetworkConnectionsInEphemeralSessions)): Deleted.

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



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


More information about the webkit-changes mailing list