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

  Changed paths:
    M Source/WebCore/Modules/push-api/PushDatabase.cpp
    M Source/WebCore/Modules/push-api/PushDatabase.h
    M Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
    M Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
    M Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h
    M 
Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
    M Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.cpp
    M Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.h
    M 
Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp
    M 
Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h
    M Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp
    M Source/WebKit/webpushd/PushClientConnection.h
    M Source/WebKit/webpushd/PushClientConnection.messages.in
    M Source/WebKit/webpushd/PushClientConnection.mm
    M Source/WebKit/webpushd/PushService.h
    M Source/WebKit/webpushd/PushService.mm
    M Source/WebKit/webpushd/WebPushDaemon.h
    M Source/WebKit/webpushd/WebPushDaemon.mm
    M Tools/MobileMiniBrowser/MobileMiniBrowserFramework/AppDelegate.m
    M Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.h
    M Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m
    M Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp

  Log Message:
  -----------
  Allow webpushd to select web clip implicitly via origin
https://bugs.webkit.org/show_bug.cgi?id=278768
rdar://134520632

Reviewed by Brady Eidson.

For some webpushd clients, it makes more sense to allow clients to specify the 
web clip they want to
operate on implicitly via origin rather than explicitly passing in the web clip 
identifier. This can
make sense if e.g. a client wants multiple web clips to share the same service 
worker since they are
part of the same origin. In this case, we select the oldest web clip associated 
with the origin as
the representative web clip for that origin.

The way this works is that on iOS, we now allow webClipIdentifier/pushPartition 
to be empty at
connection startup time. If this is the case, then each IPC infers the 
effective webClipIdentifier.
This works by basically adding a subscriptionSetForOrigin call to every 
webpushd IPC.

Most IPCs already pass an origin, so this just works. I had to change a few 
IPCs to make them
compatible however:

 - cancelNotification now takes in an origin as well as a notification 
identifier (the origin is
   necessary for implicit web clip selection to work).
 - removeAllPushSubscriptions removes all subscriptions irrespective of web 
clip identifier when
   in implicit web clip mode. This required making some changes to PushDatabase 
and PushService.

I tested this by hooking up the push action handler in 282672@main to get and 
process push events.
However I left that part out of this patch since Brady is also working on that 
logic and want to
avoid merge conflicts. As part of that testing that hookup, I fixed some other 
issues:

 - The UIProcess-side permissions lookup in NetworkProcessProxy is not 
necessary anymore and I
   conditionalized it.
 - SBSCreateOpenApplicationService does not actually follow the create rule, 
which was causing
   webpushd crashes, so I stopped using that with adoptNS.
 - Hooked up MobileMiniBrowser's data store to its push action handler.

* Source/WebCore/Modules/push-api/PushDatabase.cpp:
(WebCore::PushDatabase::removeRecordsByBundleIdentifierAndDataStore):
* Source/WebCore/Modules/push-api/PushDatabase.h:
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::cancelNotification):
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h:
* Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h:
* 
Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::processPushMessage):
* Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.cpp:
(WebKit::ServiceWorkerNotificationHandler::cancelNotification):
* Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.h:
* 
Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp:
(WebKit::WebNotificationManagerMessageHandler::cancelNotification):
* Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h:
* Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::cancel):
* Source/WebKit/webpushd/PushClientConnection.h:
(WebPushD::PushClientConnection::hostAppHasPushInjectEntitlement const):
(WebPushD::PushClientConnection::pushPartitionIfExists const):
(WebPushD::PushClientConnection::pushPartitionString const): Deleted.
* Source/WebKit/webpushd/PushClientConnection.messages.in:
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::isValidPushPartition):
(WebPushD::webClipIdentifierForOrigin):
(WebPushD::PushClientConnection::subscriptionSetIdentifierForOrigin const):
(WebPushD::PushClientConnection::debugDescription const):
(WebPushD::PushClientConnection::cancelNotification):
(WebPushD::PushClientConnection::subscriptionSetIdentifier const): Deleted.
* Source/WebKit/webpushd/PushService.h:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushService::removeRecordsForBundleIdentifierAndDataStore):
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::platformNotificationCenterBundleIdentifier):
(WebPushD::WebPushDaemon::connectionEventHandler):
(WebPushD::WebPushDaemon::updateSubscriptionSetState):
(WebPushD::WebPushDaemon::setPushAndNotificationsEnabledForOrigin):
(WebPushD::WebPushDaemon::injectPushMessageForTesting):
(WebPushD::WebPushDaemon::handleIncomingPushImpl):
(WebPushD::WebPushDaemon::notifyClientPushMessageIsAvailable):
(WebPushD::connectionMatchesPendingPushMessage):
(WebPushD::WebPushDaemon::getPendingPushMessage):
(WebPushD::WebPushDaemon::getPendingPushMessages):
(WebPushD::WebPushDaemon::subscribeToPushService):
(WebPushD::WebPushDaemon::unsubscribeFromPushService):
(WebPushD::WebPushDaemon::getPushSubscription):
(WebPushD::WebPushDaemon::incrementSilentPushCount):
(WebPushD::WebPushDaemon::removeAllPushSubscriptions):
(WebPushD::WebPushDaemon::removePushSubscriptionsForOrigin):
(WebPushD::WebPushDaemon::showNotification):
(WebPushD::WebPushDaemon::getNotifications):
(WebPushD::WebPushDaemon::cancelNotification):
(WebPushD::WebPushDaemon::getPushPermissionState):
(WebPushD::WebPushDaemon::requestPushPermission):
(WebPushD::WebPushDaemon::setAppBadge):
(WebPushD::WebPushDaemon::getAppBadgeForTesting):
* Tools/MobileMiniBrowser/MobileMiniBrowserFramework/AppDelegate.m:
(-[AppDelegate application:didFinishLaunchingWithOptions:]):
* Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.h:
* Tools/MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m:
(-[WebViewController dataStore]):
(-[WebViewController createWebView]):
* Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp:
(TestWebKitAPI::PushDatabaseTest::removeRecordsByBundleIdentifierAndDataStore):
(TestWebKitAPI::TEST_F(PushDatabaseTest, 
RemoveRecordsByBundleIdentifierAndDataStore)):

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