Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5f2a2afa9207ac4f567654e640d5edae3059c984
      
https://github.com/WebKit/WebKit/commit/5f2a2afa9207ac4f567654e640d5edae3059c984
  Author: Ben Nham <[email protected]>
  Date:   2024-08-14 (Wed, 14 Aug 2024)

  Changed paths:
    M Source/WebCore/Modules/push-api/PushDatabase.cpp
    M Source/WebCore/Modules/push-api/PushDatabase.h
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M 
Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.webpushd.sb.in
    M Source/WebKit/webpushd/PushService.h
    M Source/WebKit/webpushd/PushService.mm
    M Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp

  Log Message:
  -----------
  Remove subscriptions associated with uninstalled web clips at webpushd 
startup time
https://bugs.webkit.org/show_bug.cgi?id=277993
rdar://133725266

Reviewed by Brady Eidson.

On iOS, every web push subscription must be associated with a web clip. Enforce 
this with a check at
startup time by making sure that each subscription is associated with a web 
clip identifier, and
remove any subscriptions that are no longer associated with a web clip 
identifier.

The main logic changed here is in PushService::create. This now calls 
updateSubscriptionSetState,
which is what intersects the list of web clips with the list of push 
subscriptions, cleaning up as
necessary.

I also changed both PushService and PushServiceRequest so that we can make weak 
pointers out of them
and had various lambdas that capture those objects use weak pointers as 
necessary. This isn't
actually necessary because PushService is constructed and never destructed by 
the WebPushDaemon
singleton. But I think it makes it easier to review PushService code in 
isolation.

* Source/WebCore/Modules/push-api/PushDatabase.cpp:
(WebCore::PushSubscriptionSetRecord::isolatedCopy const):
(WebCore::PushSubscriptionSetRecord::isolatedCopy):
(WebCore::PushDatabase::getTopics):
(WebCore::PushDatabase::getPushSubscriptionSetRecords):
(WebCore::PushDatabase::setPushesEnabled):
(WebCore::PushDatabase::setPushesEnabledForOrigin):
* Source/WebCore/Modules/push-api/PushDatabase.h:
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushService::create):
(WebPushD::PushService::PushService):
(WebPushD::GetSubscriptionRequest::startInternal):
(WebPushD::SubscribeRequest::startImpl):
(WebPushD::SubscribeRequest::attemptToRecoverFromTopicAlreadyInFilterError):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::setPushesEnabledForSubscriptionSetAndOrigin):
(WebPushD::PushService::removeRecordsImpl):
(WebPushD::PushService::updateSubscriptionSetState):
(WebPushD::PushService::updateTopicLists):
(WebPushD::PushService::didReceivePublicToken):
(WebPushD::PushService::didReceivePushMessage):
(WebPushD::updateTopicLists): Deleted.
* Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp:
(WebCore::operator==):
(TestWebKitAPI::getPushSubscriptionSetsSync):
(TestWebKitAPI::PushDatabaseTest::getPushSubscriptionSets):
(TestWebKitAPI::PushDatabaseTest::setPushesEnabled):
(TestWebKitAPI::TEST_F):

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