[webkit-changes] [WebKit/WebKit] a427fa: Raise exception when a webpushd connection error o...
bnham
noreply at github.com
Wed Oct 23 10:20:03 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a427fa53db759bf8b1ff595b346a781de07ca84d
https://github.com/WebKit/WebKit/commit/a427fa53db759bf8b1ff595b346a781de07ca84d
Author: Ben Nham <nham at apple.com>
Date: 2024-10-23 (Wed, 23 Oct 2024)
Changed paths:
M Source/WebKit/NetworkProcess/Notifications/WebPushDaemonConnection.h
M Source/WebKit/Shared/WebPushDaemonConstants.h
M Source/WebKit/webpushd/PushClientConnection.h
M Source/WebKit/webpushd/PushClientConnection.messages.in
M Source/WebKit/webpushd/PushClientConnection.mm
M Source/WebKit/webpushd/WebPushDaemon.h
M Source/WebKit/webpushd/WebPushDaemon.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm
Log Message:
-----------
Raise exception when a webpushd connection error occurs
https://bugs.webkit.org/show_bug.cgi?id=281886
rdar://138358189
Reviewed by Sihui Liu.
In the past there have been some bugs which cause a WebKit client to try to talk to webpushd with
mismatching IPC protocol versions (e.g. bug 281155). This causes webpushd to terminate the IPC
connection, which then causes a default-constructed response object to be returned to the caller in
the client process.
For most webpushd IPCs, the default-constructed response makes sense. For instance, if the client
tries to send the GetPushPermissionState IPC and this type of IPC protocol mismatch occurs, then a
default-constructed PushPermissionState is returned, which is PushPermissionState::Denied. However,
for SubscribeToPushService, this does not make sense, as a default-constructed PushSubscription
object is returned which has an empty endpoint URL and keys dictionary.
Fix this by making GetPushPermissionState raise an AbortError via an AsyncReplyError if there is an
IPC protocol mismatch. I put this AsyncReplyError in the WebPushDaemonConnection header since it's a
common header imported by both _WKWebPushDaemonConnection and NetworkNotificationManager.
* Source/WebKit/NetworkProcess/Notifications/WebPushDaemonConnection.h:
* Source/WebKit/Shared/WebPushDaemonConstants.h:
* Source/WebKit/webpushd/PushClientConnection.h:
* Source/WebKit/webpushd/PushClientConnection.messages.in:
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::PushClientConnection::setProtocolVersionForTesting):
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::connectionEventHandler):
(WebPushD::WebPushDaemon::setProtocolVersionForTesting):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
(TestWebKitAPI::(WebPushDTest, SubscribeWithBadIPCVersionRaisesExceptionTest)):
(TestWebKitAPI::(WebPushD, WKWebPushDaemonConnectionSubscribeWithBadIPCVersionRaisesException)):
Canonical link: https://commits.webkit.org/285610@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