Skip to content

Make PushService aware of data store identifiers and push partitions#7398

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
bnham:eng/push-pass-subscription-set-id
Dec 10, 2022
Merged

Make PushService aware of data store identifiers and push partitions#7398
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
bnham:eng/push-pass-subscription-set-id

Conversation

@bnham
Copy link
Copy Markdown
Contributor

@bnham bnham commented Dec 9, 2022

bc9d83a

Make PushService aware of data store identifiers and push partitions
https://bugs.webkit.org/show_bug.cgi?id=249032
<rdar://problem/103187488>

Reviewed by Brady Eidson.

This changes PushService to identify push subscriptions using the tuple (bundleID, pushPartition,
dataStoreUUID, serviceWorkerScopeURL). Previously, push subscriptions were identified by only
(bundleID, serviceWorkerScopeURL).

This mostly entails replacing all methods that take bundleIDs in PushService with methods that take
a PushSubscriptionSetIdentifier (which is (bundleID, pushPartition, dataStoreUUID)).

Additionally, I changed the WebPushDaemon integration tests to test multiple subscription set
identifiers. There was a massive amount of boilerplate in the tests that made that ugly to do, so I
refactored the tests to remove the boilerplate.

* Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.cpp: Added.
(WebCore::makePushTopic):
(WebCore::PushSubscriptionSetIdentifier::debugDescription const):
* Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h:
(WebCore::PushSubscriptionSetIdentifier::operator== const):
(WebCore::add):
(WebCore::PushSubscriptionSetIdentifier::isHashTableDeletedValue const):
(WTF::PushSubscriptionSetIdentifierHash::hash):
(WTF::PushSubscriptionSetIdentifierHash::equal):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::emptyValue):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::isDeletedValue):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* Source/WebKit/NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::dataStoreIdentifier const):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* Source/WebKit/Platform/IPC/DaemonCoders.cpp:
(WebKit::Daemon::void>::encode):
(WebKit::Daemon::void>::decode):
(WebKit::Daemon::Coder<WTF::UUID>::encode):
(WebKit::Daemon::Coder<WTF::UUID>::decode):
* Source/WebKit/Platform/IPC/DaemonCoders.h:
* Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.h:
(WebKit::WebPushD::WebPushDaemonConnectionConfiguration::encode const):
(WebKit::WebPushD::WebPushDaemonConnectionConfiguration::decode):
* Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration webPushPartitionString]):
(-[_WKWebsiteDataStoreConfiguration setWebPushPartitionString:]):
* Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::setPushesAndNotificationsEnabledForOrigin):
(WebKit::removePushSubscriptionsForOrigins):
(WebKit::persistentDataStoreIfExists): Deleted.
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
(WebKit::WebsiteDataStoreConfiguration::webPushDaemonConnectionConfiguration const):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::webPushPartitionString const):
(WebKit::WebsiteDataStoreConfiguration::setWebPushPartitionString):
* Source/WebKit/webpushd/PushClientConnection.h:
(WebPushD::ClientConnection::pushPartitionString const):
(WebPushD::ClientConnection::dataStoreIdentifier const):
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::ClientConnection::updateConnectionConfiguration):
(WebPushD::ClientConnection::subscriptionSetIdentifier):
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushServiceRequest::subscriptionSetIdentifier const):
(WebPushD::PushServiceRequest::scope const):
(WebPushD::PushServiceRequest::key const):
(WebPushD::PushServiceRequest::PushServiceRequest):
(WebPushD::PushServiceRequestImpl::PushServiceRequestImpl):
(WebPushD::PushServiceRequestImpl::fulfill):
(WebPushD::PushServiceRequestImpl::reject):
(WebPushD::GetSubscriptionRequest::GetSubscriptionRequest):
(WebPushD::GetSubscriptionRequest::startInternal):
(WebPushD::SubscribeRequest::SubscribeRequest):
(WebPushD::SubscribeRequest::startImpl):
(WebPushD::UnsubscribeRequest::UnsubscribeRequest):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::enqueuePushServiceRequest):
(WebPushD::PushService::finishedPushServiceRequest):
(WebPushD::PushService::getSubscription):
(WebPushD::PushService::subscribe):
(WebPushD::PushService::unsubscribe):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::setPushesEnabledForSubscriptionSetAndOrigin):
(WebPushD::PushService::removeRecordsForSubscriptionSet):
(WebPushD::PushService::removeRecordsForSubscriptionSetAndOrigin):
(WebPushD::PushService::removeRecordsImpl):
(WebPushD::PushService::didReceivePushMessage):
(WebPushD::makeSubscriptionSet): Deleted.
(WebPushD::makePushTopic): Deleted.
(WebPushD::PushServiceRequest::bundleIdentifier): Deleted.
(WebPushD::PushServiceRequest::scope): Deleted.
(WebPushD::PushService::setPushesEnabledForBundleIdentifierAndOrigin): Deleted.
(WebPushD::PushService::removeRecordsForBundleIdentifier): Deleted.
(WebPushD::PushService::removeRecordsForBundleIdentifierAndOrigin): Deleted.
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::startMockPushService):
(WebPushD::Daemon::startPushService):
(WebPushD::Daemon::canRegisterForNotifications):
(WebPushD::Daemon::deletePushRegistration):
(WebPushD::Daemon::setPushAndNotificationsEnabledForOrigin):
(WebPushD::Daemon::deletePushAndNotificationRegistration):
(WebPushD::Daemon::injectPushMessageForTesting):
(WebPushD::Daemon::handleIncomingPush):
(WebPushD::Daemon::notifyClientPushMessageIsAvailable):
(WebPushD::Daemon::getPendingPushMessages):
(WebPushD::Daemon::subscribeToPushService):
(WebPushD::Daemon::unsubscribeFromPushService):
(WebPushD::Daemon::getPushSubscription):
(WebPushD::Daemon::incrementSilentPushCount):
(WebPushD::Daemon::removeAllPushSubscriptions):
(WebPushD::Daemon::removePushSubscriptionsForOrigin):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
(TestWebKitAPI::sendConfigurationWithAuditToken):
(TestWebKitAPI::log):
(TestWebKitAPI::then):
(TestWebKitAPI::catch):
(TestWebKitAPI::subscribe):
(TestWebKitAPI::unsubscribe):
(TestWebKitAPI::getPushSubscription):
(TestWebKitAPI::disableShowNotifications):
(-[NotificationScriptMessageHandler setMessageHandler:]): Deleted.
(-[NotificationScriptMessageHandler userContentController:didReceiveScriptMessage:]): Deleted.
(TestWebKitAPI::function): Deleted.

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

cf1baed

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 🧪 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl 🧪 ios-wk2 🧪 api-mac 💥 🧪 gtk-wk2
🧪 api-ios ✅ 🧪 mac-wk1 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk2
✅ 🛠 tv-sim 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge ✅ 🛠 watch-sim

@bnham bnham requested a review from cdumez as a code owner December 9, 2022 19:23
@bnham bnham self-assigned this Dec 9, 2022
@bnham bnham added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Dec 9, 2022
@bnham bnham force-pushed the eng/push-pass-subscription-set-id branch from 2332601 to 1b66714 Compare December 9, 2022 19:24
@bnham bnham requested a review from beidson December 9, 2022 19:27
@webkit-early-warning-system
Copy link
Copy Markdown
Collaborator

webkit-early-warning-system commented Dec 9, 2022

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 9, 2022
@bnham bnham removed the merging-blocked Applied to prevent a change from being merged label Dec 9, 2022
@bnham bnham force-pushed the eng/push-pass-subscription-set-id branch from 1b66714 to 04da94b Compare December 9, 2022 21:25
@bnham bnham force-pushed the eng/push-pass-subscription-set-id branch from 04da94b to cf1baed Compare December 10, 2022 01:31
@bnham bnham added the merge-queue Applied to send a pull request to merge-queue label Dec 10, 2022
https://bugs.webkit.org/show_bug.cgi?id=249032
<rdar://problem/103187488>

Reviewed by Brady Eidson.

This changes PushService to identify push subscriptions using the tuple (bundleID, pushPartition,
dataStoreUUID, serviceWorkerScopeURL). Previously, push subscriptions were identified by only
(bundleID, serviceWorkerScopeURL).

This mostly entails replacing all methods that take bundleIDs in PushService with methods that take
a PushSubscriptionSetIdentifier (which is (bundleID, pushPartition, dataStoreUUID)).

Additionally, I changed the WebPushDaemon integration tests to test multiple subscription set
identifiers. There was a massive amount of boilerplate in the tests that made that ugly to do, so I
refactored the tests to remove the boilerplate.

* Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.cpp: Added.
(WebCore::makePushTopic):
(WebCore::PushSubscriptionSetIdentifier::debugDescription const):
* Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h:
(WebCore::PushSubscriptionSetIdentifier::operator== const):
(WebCore::add):
(WebCore::PushSubscriptionSetIdentifier::isHashTableDeletedValue const):
(WTF::PushSubscriptionSetIdentifierHash::hash):
(WTF::PushSubscriptionSetIdentifierHash::equal):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::emptyValue):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::constructDeletedValue):
(WTF::HashTraits<WebCore::PushSubscriptionSetIdentifier>::isDeletedValue):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* Source/WebKit/NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::dataStoreIdentifier const):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h:
* Source/WebKit/Platform/IPC/DaemonCoders.cpp:
(WebKit::Daemon::void>::encode):
(WebKit::Daemon::void>::decode):
(WebKit::Daemon::Coder<WTF::UUID>::encode):
(WebKit::Daemon::Coder<WTF::UUID>::decode):
* Source/WebKit/Platform/IPC/DaemonCoders.h:
* Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.h:
(WebKit::WebPushD::WebPushDaemonConnectionConfiguration::encode const):
(WebKit::WebPushD::WebPushDaemonConnectionConfiguration::decode):
* Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration webPushPartitionString]):
(-[_WKWebsiteDataStoreConfiguration setWebPushPartitionString:]):
* Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::setPushesAndNotificationsEnabledForOrigin):
(WebKit::removePushSubscriptionsForOrigins):
(WebKit::persistentDataStoreIfExists): Deleted.
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
(WebKit::WebsiteDataStoreConfiguration::webPushDaemonConnectionConfiguration const):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::webPushPartitionString const):
(WebKit::WebsiteDataStoreConfiguration::setWebPushPartitionString):
* Source/WebKit/webpushd/PushClientConnection.h:
(WebPushD::ClientConnection::pushPartitionString const):
(WebPushD::ClientConnection::dataStoreIdentifier const):
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::ClientConnection::updateConnectionConfiguration):
(WebPushD::ClientConnection::subscriptionSetIdentifier):
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushServiceRequest::subscriptionSetIdentifier const):
(WebPushD::PushServiceRequest::scope const):
(WebPushD::PushServiceRequest::key const):
(WebPushD::PushServiceRequest::PushServiceRequest):
(WebPushD::PushServiceRequestImpl::PushServiceRequestImpl):
(WebPushD::PushServiceRequestImpl::fulfill):
(WebPushD::PushServiceRequestImpl::reject):
(WebPushD::GetSubscriptionRequest::GetSubscriptionRequest):
(WebPushD::GetSubscriptionRequest::startInternal):
(WebPushD::SubscribeRequest::SubscribeRequest):
(WebPushD::SubscribeRequest::startImpl):
(WebPushD::UnsubscribeRequest::UnsubscribeRequest):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::enqueuePushServiceRequest):
(WebPushD::PushService::finishedPushServiceRequest):
(WebPushD::PushService::getSubscription):
(WebPushD::PushService::subscribe):
(WebPushD::PushService::unsubscribe):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::setPushesEnabledForSubscriptionSetAndOrigin):
(WebPushD::PushService::removeRecordsForSubscriptionSet):
(WebPushD::PushService::removeRecordsForSubscriptionSetAndOrigin):
(WebPushD::PushService::removeRecordsImpl):
(WebPushD::PushService::didReceivePushMessage):
(WebPushD::makeSubscriptionSet): Deleted.
(WebPushD::makePushTopic): Deleted.
(WebPushD::PushServiceRequest::bundleIdentifier): Deleted.
(WebPushD::PushServiceRequest::scope): Deleted.
(WebPushD::PushService::setPushesEnabledForBundleIdentifierAndOrigin): Deleted.
(WebPushD::PushService::removeRecordsForBundleIdentifier): Deleted.
(WebPushD::PushService::removeRecordsForBundleIdentifierAndOrigin): Deleted.
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::startMockPushService):
(WebPushD::Daemon::startPushService):
(WebPushD::Daemon::canRegisterForNotifications):
(WebPushD::Daemon::deletePushRegistration):
(WebPushD::Daemon::setPushAndNotificationsEnabledForOrigin):
(WebPushD::Daemon::deletePushAndNotificationRegistration):
(WebPushD::Daemon::injectPushMessageForTesting):
(WebPushD::Daemon::handleIncomingPush):
(WebPushD::Daemon::notifyClientPushMessageIsAvailable):
(WebPushD::Daemon::getPendingPushMessages):
(WebPushD::Daemon::subscribeToPushService):
(WebPushD::Daemon::unsubscribeFromPushService):
(WebPushD::Daemon::getPushSubscription):
(WebPushD::Daemon::incrementSilentPushCount):
(WebPushD::Daemon::removeAllPushSubscriptions):
(WebPushD::Daemon::removePushSubscriptionsForOrigin):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
(TestWebKitAPI::sendConfigurationWithAuditToken):
(TestWebKitAPI::log):
(TestWebKitAPI::then):
(TestWebKitAPI::catch):
(TestWebKitAPI::subscribe):
(TestWebKitAPI::unsubscribe):
(TestWebKitAPI::getPushSubscription):
(TestWebKitAPI::disableShowNotifications):
(-[NotificationScriptMessageHandler setMessageHandler:]): Deleted.
(-[NotificationScriptMessageHandler userContentController:didReceiveScriptMessage:]): Deleted.
(TestWebKitAPI::function): Deleted.

Canonical link: https://commits.webkit.org/257669@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/push-pass-subscription-set-id branch from cf1baed to bc9d83a Compare December 10, 2022 04:22
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 257669@main (bc9d83a): https://commits.webkit.org/257669@main

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

@webkit-commit-queue webkit-commit-queue merged commit bc9d83a into WebKit:main Dec 10, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 10, 2022
@bnham bnham deleted the eng/push-pass-subscription-set-id branch December 11, 2023 17:33
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