Skip to content

Exempt origins with push subscriptions from time-based website data eviction#64971

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
bnham:eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction
May 19, 2026
Merged

Exempt origins with push subscriptions from time-based website data eviction#64971
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
bnham:eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction

Conversation

@bnham
Copy link
Copy Markdown
Contributor

@bnham bnham commented May 15, 2026

f6769c8

Exempt origins with push subscriptions from time-based website data eviction
https://bugs.webkit.org/show_bug.cgi?id=314872
rdar://176399178

Reviewed by Sihui Liu.

There are a number of websites whose only use of persisted website data is a simple service worker
that processes push events for the purposes of Web Push, and who do no other mutations to website
data. These websites could have their service workers (and therefore push subscriptions) cleared by
the time-based eviction path added in 312741@main, which is not desirable.

This exempts all origins with an active push subscription from time-based website data
eviction. This is handled through a new GetAllPushSubscriptionOrigins IPC from NetworkProcess to
webpushd.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebsiteDatastore.mm
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebPushDaemon.mm

* Source/WebCore/Modules/push-api/PushDatabase.cpp:
(WebCore::PushDatabase::getAllPushSubscriptionOrigins):
* Source/WebCore/Modules/push-api/PushDatabase.h:
* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::getAllPushSubscriptionOrigins):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
* Source/WebKit/NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::mockPushSubscriptionOriginsForTesting const):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in:
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::getAllPushSubscriptionOrigins):
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h:
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::prepareForTimeBasedEviction):
(WebKit::NetworkStorageManager::donePrepareForTimeBasedEviction):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h:
* Source/WebKit/Shared/WebPushDaemonConstants.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration mockPushSubscriptionOriginsForTesting]):
(-[_WKWebsiteDataStoreConfiguration setMockPushSubscriptionOriginsForTesting:]):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::mockPushSubscriptionOriginsForTesting const):
(WebKit::WebsiteDataStoreConfiguration::setMockPushSubscriptionOriginsForTesting):
* Source/WebKit/webpushd/PushClientConnection.h:
* Source/WebKit/webpushd/PushClientConnection.messages.in:
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::PushClientConnection::getAllPushSubscriptionOrigins):
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushService::getAllPushSubscriptionOrigins):
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::getAllPushSubscriptionOrigins):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebsiteDatastore.mm:
(TestWebKitAPI::(TimeBasedEviction, PushSubscriptionOriginNotEvicted)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebPushDaemon.mm:
(TestWebKitAPI::TestArgumentCoder<WebCore::SecurityOriginData>::encode):
(TestWebKitAPI::TestArgumentCoder<WebCore::SecurityOriginData>::decode):
(TestWebKitAPI::(WebPushDTest, SubscribeTest)):

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

0ec8037

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ❌ 🛠 mac-apple
✅ 🧪 webkitperl 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim ✅ 🧪 mac-site-isolation
✅ 🛠 watch
✅ 🛠 watch-sim

@bnham bnham self-assigned this May 15, 2026
@bnham bnham added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label May 15, 2026
@bnham bnham requested a review from szewai May 15, 2026 04:24
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from 2801f31 to af9bdaf Compare May 15, 2026 04:37
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from af9bdaf to f05a439 Compare May 15, 2026 04:45
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 15, 2026
@bnham bnham removed the merging-blocked Applied to prevent a change from being merged label May 15, 2026
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from f05a439 to 9152c8b Compare May 15, 2026 05:52
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

macOS Safer C++ Build #103108 (9152c8b)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 15, 2026
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #21468 (9152c8b)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

Comment thread Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm Outdated
@bnham bnham marked this pull request as ready for review May 15, 2026 13:45
@bnham bnham requested review from cdumez and rr-codes as code owners May 15, 2026 13:45
Comment thread Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebsiteDatastore.mm Outdated
Comment thread Source/WebCore/Modules/push-api/PushDatabase.cpp Outdated
Comment thread Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm Outdated
@bnham bnham removed the merging-blocked Applied to prevent a change from being merged label May 15, 2026
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from 9152c8b to 6e459f9 Compare May 15, 2026 21:36
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from 6e459f9 to 0880cdd Compare May 18, 2026 23:56
@bnham bnham force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from 0880cdd to 0ec8037 Compare May 19, 2026 00:06
@bnham bnham added the merge-queue Applied to send a pull request to merge-queue label May 19, 2026
…viction

https://bugs.webkit.org/show_bug.cgi?id=314872
rdar://176399178

Reviewed by Sihui Liu.

There are a number of websites whose only use of persisted website data is a simple service worker
that processes push events for the purposes of Web Push, and who do no other mutations to website
data. These websites could have their service workers (and therefore push subscriptions) cleared by
the time-based eviction path added in 312741@main, which is not desirable.

This exempts all origins with an active push subscription from time-based website data
eviction. This is handled through a new GetAllPushSubscriptionOrigins IPC from NetworkProcess to
webpushd.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebsiteDatastore.mm
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebPushDaemon.mm

* Source/WebCore/Modules/push-api/PushDatabase.cpp:
(WebCore::PushDatabase::getAllPushSubscriptionOrigins):
* Source/WebCore/Modules/push-api/PushDatabase.h:
* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::getAllPushSubscriptionOrigins):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
* Source/WebKit/NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::mockPushSubscriptionOriginsForTesting const):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in:
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::getAllPushSubscriptionOrigins):
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h:
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::prepareForTimeBasedEviction):
(WebKit::NetworkStorageManager::donePrepareForTimeBasedEviction):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h:
* Source/WebKit/Shared/WebPushDaemonConstants.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration mockPushSubscriptionOriginsForTesting]):
(-[_WKWebsiteDataStoreConfiguration setMockPushSubscriptionOriginsForTesting:]):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::mockPushSubscriptionOriginsForTesting const):
(WebKit::WebsiteDataStoreConfiguration::setMockPushSubscriptionOriginsForTesting):
* Source/WebKit/webpushd/PushClientConnection.h:
* Source/WebKit/webpushd/PushClientConnection.messages.in:
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::PushClientConnection::getAllPushSubscriptionOrigins):
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushService::getAllPushSubscriptionOrigins):
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::getAllPushSubscriptionOrigins):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebsiteDatastore.mm:
(TestWebKitAPI::(TimeBasedEviction, PushSubscriptionOriginNotEvicted)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebPushDaemon.mm:
(TestWebKitAPI::TestArgumentCoder<WebCore::SecurityOriginData>::encode):
(TestWebKitAPI::TestArgumentCoder<WebCore::SecurityOriginData>::decode):
(TestWebKitAPI::(WebPushDTest, SubscribeTest)):

Canonical link: https://commits.webkit.org/313457@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Exempt-origins-with-push-subscriptions-from-time-based-website-data-eviction branch from 0ec8037 to f6769c8 Compare May 19, 2026 04:25
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 313457@main (f6769c8): https://commits.webkit.org/313457@main

Reviewed commits have been landed. Closing PR #64971 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit f6769c8 into WebKit:main May 19, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants