Skip to content

Commit 14a9d2a

Browse files
committed
Add ability to inject messages into webpushd
https://bugs.webkit.org/show_bug.cgi?id=233988 Reviewed by Alex Christensen. Source/WebKit: Covered by API tests. This patch: - Adds WKWebsiteDataStore SPI to fetch pending push messages for the embedding application - Gives webpushd code to inject a push message for a given bundle identifier - Gives webpushtool the ability to send one of these fake messages - Gives webpushtool the ability to reconnect to the next daemon instance after the current connection is dropped - Tests the injection and fetching of push messages via TestWebKitAPI * Configurations/webpushtool.xcconfig: * WebKit.xcodeproj/project.pbxproj: * Resources/webpushtool.entitlements: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::getPendingPushMessages): (WebKit::NetworkProcess::processPushMessage): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/Notifications/NetworkNotificationManager.cpp: (WebKit::NetworkNotificationManager::getPendingPushMessages): (WebKit::ReplyCaller<Vector<WebPushMessage>::callReply): * NetworkProcess/Notifications/NetworkNotificationManager.h: * Shared/Cocoa/WebPushMessageCocoa.mm: Copied from Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h. (WebKit::WebPushMessage::fromDictionary): (WebKit::WebPushMessage::toDictionary const): * Shared/PushMessageForTesting.h: Copied from Source/WebKit/Shared/WebPushDaemonConstants.h. (WebKit::WebPushD::PushMessageForTesting::encode const): (WebKit::WebPushD::PushMessageForTesting::decode): * Shared/WebPushDaemonConstants.h: (WebKit::WebPushD::messageTypeSendsReply): * Shared/WebPushMessage.h: Copied from Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h. (WebKit::WebPushMessage::encode const): (WebKit::WebPushMessage::decode): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _getPendingPushMessages:]): (-[WKWebsiteDataStore _processPushMessage:completionHandler:]): (-[WKWebsiteDataStore _processPushMessage:registration:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getPendingPushMessages): (WebKit::NetworkProcessProxy::processPushMessage): * UIProcess/Network/NetworkProcessProxy.h: Tools: * TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements: * TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements: * TestWebKitAPI/Configurations/TestWebKitAPI-macOS.entitlements: * TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm: (messageDictionary): * TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm: (TestWebKitAPI::createMessageDictionary): (TestWebKitAPI::sendMessageToDaemon): (TestWebKitAPI::sendMessageToDaemonWaitingForReply): (TestWebKitAPI::sendConfigurationWithAuditToken): (TestWebKitAPI::createAndConfigureConnectionToService): (TestWebKitAPI::encodeString): (TestWebKitAPI::TEST): (TestWebKitAPI::function): * TestWebKitAPI/cocoa/TestWKWebView.h: Canonical link: https://commits.webkit.org/245005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0fc4e49 commit 14a9d2a

31 files changed

+849
-70
lines changed

‎Source/WebKit/ChangeLog

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
1+
2021-12-08 Brady Eidson <beidson@apple.com>
2+
3+
Add ability to inject messages into webpushd
4+
https://bugs.webkit.org/show_bug.cgi?id=233988
5+
6+
Reviewed by Alex Christensen.
7+
8+
Covered by API tests.
9+
10+
This patch:
11+
- Adds WKWebsiteDataStore SPI to fetch pending push messages for the embedding application
12+
- Gives webpushd code to inject a push message for a given bundle identifier
13+
- Gives webpushtool the ability to send one of these fake messages
14+
- Gives webpushtool the ability to reconnect to the next daemon instance after the current connection is dropped
15+
- Tests the injection and fetching of push messages via TestWebKitAPI
16+
17+
* Configurations/webpushtool.xcconfig:
18+
* WebKit.xcodeproj/project.pbxproj:
19+
* Resources/webpushtool.entitlements:
20+
21+
* NetworkProcess/NetworkProcess.cpp:
22+
(WebKit::NetworkProcess::getPendingPushMessages):
23+
(WebKit::NetworkProcess::processPushMessage):
24+
* NetworkProcess/NetworkProcess.h:
25+
* NetworkProcess/NetworkProcess.messages.in:
26+
27+
* NetworkProcess/Notifications/NetworkNotificationManager.cpp:
28+
(WebKit::NetworkNotificationManager::getPendingPushMessages):
29+
(WebKit::ReplyCaller<Vector<WebPushMessage>::callReply):
30+
* NetworkProcess/Notifications/NetworkNotificationManager.h:
31+
32+
* Shared/Cocoa/WebPushMessageCocoa.mm: Copied from Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h.
33+
(WebKit::WebPushMessage::fromDictionary):
34+
(WebKit::WebPushMessage::toDictionary const):
35+
36+
* Shared/PushMessageForTesting.h: Copied from Source/WebKit/Shared/WebPushDaemonConstants.h.
37+
(WebKit::WebPushD::PushMessageForTesting::encode const):
38+
(WebKit::WebPushD::PushMessageForTesting::decode):
39+
40+
* Shared/WebPushDaemonConstants.h:
41+
(WebKit::WebPushD::messageTypeSendsReply):
42+
43+
* Shared/WebPushMessage.h: Copied from Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h.
44+
(WebKit::WebPushMessage::encode const):
45+
(WebKit::WebPushMessage::decode):
46+
47+
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
48+
(-[WKWebsiteDataStore _getPendingPushMessages:]):
49+
(-[WKWebsiteDataStore _processPushMessage:completionHandler:]):
50+
(-[WKWebsiteDataStore _processPushMessage:registration:completionHandler:]): Deleted.
51+
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
52+
53+
* UIProcess/Network/NetworkProcessProxy.cpp:
54+
(WebKit::NetworkProcessProxy::getPendingPushMessages):
55+
(WebKit::NetworkProcessProxy::processPushMessage):
56+
* UIProcess/Network/NetworkProcessProxy.h:
57+
\
58+
* webpushd/PushClientConnection.h:
59+
* webpushd/PushClientConnection.mm:
60+
(WebPushD::ClientConnection::hostAppHasPushEntitlement):
61+
(WebPushD::ClientConnection::hostAppHasPushInjectEntitlement):
62+
(WebPushD::ClientConnection::hostHasEntitlement):
63+
(WebPushD::ClientConnection::broadcastDebugMessage):
64+
65+
* webpushd/WebPushDaemon.h:
66+
* webpushd/WebPushDaemon.mm:
67+
(WebPushD::MessageInfo::injectPushMessageForTesting::encodeReply):
68+
(WebPushD::MessageInfo::getPendingPushMessages::encodeReply):
69+
(WebPushD::Daemon::decodeAndHandleMessage):
70+
(WebPushD::Daemon::injectPushMessageForTesting):
71+
(WebPushD::Daemon::getPendingPushMessages):
72+
73+
* webpushd/webpushtool/WebPushToolConnection.h:
74+
(WebPushTool::Connection::setPushMessage):
75+
76+
* webpushd/webpushtool/WebPushToolConnection.mm:
77+
(WebPushTool::Connection::startAction):
78+
(WebPushTool::Connection::sendPushMessage):
79+
80+
* webpushd/webpushtool/WebPushToolMain.mm:
81+
(printUsageAndTerminate):
82+
(pushMessageFromArguments):
83+
(main):
84+
185
2021-12-08 Megan Gardner <megan_gardner@apple.com>
286

387
Show correct content menu for images services chevron.

‎Source/WebKit/Configurations/webpushtool.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SKIP_INSTALL = YES;
2929
EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = *;
3030
EXCLUDED_SOURCE_FILE_NAMES[sdk=watch*] = *;
3131

32-
OTHER_LDFLAGS = -l WTF -framework Foundation -framework CoreFoundation;
32+
OTHER_LDFLAGS = -framework WebKit -framework JavaScriptCore
3333
LIBRARY_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR);
3434

3535
CODE_SIGN_ENTITLEMENTS = Resources/webpushtool.entitlements;

‎Source/WebKit/NetworkProcess/NetworkProcess.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "WebCookieManager.h"
5959
#include "WebPageProxyMessages.h"
6060
#include "WebProcessPoolMessages.h"
61+
#include "WebPushMessage.h"
6162
#include "WebResourceLoadStatisticsStore.h"
6263
#include "WebSWOriginStore.h"
6364
#include "WebSWServerConnection.h"
@@ -2555,12 +2556,20 @@ void NetworkProcess::addServiceWorkerSession(PAL::SessionID sessionID, bool proc
25552556
SandboxExtension::consumePermanently(handle);
25562557
}
25572558

2558-
void NetworkProcess::processPushMessage(PAL::SessionID sessionID, const std::optional<IPC::DataReference>& ipcData, URL&& registrationURL, CompletionHandler<void(bool)>&& callback)
2559+
void NetworkProcess::getPendingPushMessages(PAL::SessionID sessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&& callback)
25592560
{
2560-
std::optional<Vector<uint8_t>> data;
2561-
if (ipcData)
2562-
data = Vector<uint8_t> { ipcData->data(), ipcData->size() };
2563-
swServerForSession(sessionID).processPushMessage(WTFMove(data), WTFMove(registrationURL), WTFMove(callback));
2561+
#if ENABLE(BUILT_IN_NOTIFICATIONS)
2562+
if (auto* session = networkSession(sessionID)) {
2563+
session->notificationManager().getPendingPushMessages(WTFMove(callback));
2564+
return;
2565+
}
2566+
#endif
2567+
callback({ });
2568+
}
2569+
2570+
void NetworkProcess::processPushMessage(PAL::SessionID sessionID, WebPushMessage&& pushMessage, CompletionHandler<void(bool)>&& callback)
2571+
{
2572+
swServerForSession(sessionID).processPushMessage(WTFMove(pushMessage.pushData), WTFMove(pushMessage.registrationURL), WTFMove(callback));
25642573
}
25652574
#endif // ENABLE(SERVICE_WORKER)
25662575

‎Source/WebKit/NetworkProcess/NetworkProcess.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ enum class StorageAccessStatus : uint8_t;
117117
enum class WebsiteDataFetchOption : uint8_t;
118118
enum class WebsiteDataType : uint32_t;
119119
struct NetworkProcessCreationParameters;
120+
struct WebPushMessage;
120121
struct WebsiteDataStoreParameters;
121122

122123
#if ENABLE(SERVICE_WORKER)
@@ -396,7 +397,8 @@ class NetworkProcess : public AuxiliaryProcess, private DownloadManager::Client,
396397
bool ftpEnabled() const { return m_ftpEnabled; }
397398

398399
#if ENABLE(SERVICE_WORKER)
399-
void processPushMessage(PAL::SessionID, const std::optional<IPC::DataReference>&, URL&&, CompletionHandler<void(bool)>&&);
400+
void getPendingPushMessages(PAL::SessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&&);
401+
void processPushMessage(PAL::SessionID, WebPushMessage&&, CompletionHandler<void(bool)>&&);
400402
#endif
401403

402404
void deletePushAndNotificationRegistration(PAL::SessionID, const WebCore::SecurityOriginData&, CompletionHandler<void(const String&)>&&);

‎Source/WebKit/NetworkProcess/NetworkProcess.messages.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ messages -> NetworkProcess LegacyReceiver {
207207
#endif
208208

209209
#if ENABLE(SERVICE_WORKER)
210-
ProcessPushMessage(PAL::SessionID sessionID, std::optional<IPC::DataReference> data, URL registrationURL) -> (bool didSucceed) Async
210+
GetPendingPushMessages(PAL::SessionID sessionID) -> (Vector<WebKit::WebPushMessage> messages) Async
211+
ProcessPushMessage(PAL::SessionID sessionID, struct WebKit::WebPushMessage pushMessage) -> (bool didSucceed) Async
211212
#endif
212213
DeletePushAndNotificationRegistration(PAL::SessionID sessionID, struct WebCore::SecurityOriginData origin) -> (String errorMessage) Async
213214
GetOriginsWithPushAndNotificationPermissions(PAL::SessionID sessionID) -> (Vector<WebCore::SecurityOriginData> origins) Async

‎Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "DaemonEncoder.h"
3333
#include "NetworkSession.h"
3434
#include "WebPushDaemonConnectionConfiguration.h"
35+
#include "WebPushMessage.h"
3536
#include <WebCore/SecurityOriginData.h>
3637

3738
namespace WebKit {
@@ -88,6 +89,15 @@ void NetworkNotificationManager::getOriginsWithPushAndNotificationPermissions(Co
8889
sendMessageWithReply<WebPushD::MessageType::GetOriginsWithPushAndNotificationPermissions>(WTFMove(replyHandler));
8990
}
9091

92+
void NetworkNotificationManager::getPendingPushMessages(CompletionHandler<void(const Vector<WebPushMessage>&)>&& completionHandler)
93+
{
94+
CompletionHandler<void(Vector<WebPushMessage>&&)> replyHandler = [completionHandler = WTFMove(completionHandler)] (Vector<WebPushMessage>&& messages) mutable {
95+
completionHandler(WTFMove(messages));
96+
};
97+
98+
sendMessageWithReply<WebPushD::MessageType::GetPendingPushMessages>(WTFMove(replyHandler));
99+
}
100+
91101
void NetworkNotificationManager::showNotification(const String&, const String&, const String&, const String&, const String&, WebCore::NotificationDirection, const String&, uint64_t)
92102
{
93103
if (!m_connection)
@@ -186,6 +196,17 @@ template<> struct ReplyCaller<Vector<String>&&> {
186196
}
187197
};
188198

199+
template<> struct ReplyCaller<Vector<WebPushMessage>&&> {
200+
static void callReply(Daemon::Decoder&& decoder, CompletionHandler<void(Vector<WebPushMessage>&&)>&& completionHandler)
201+
{
202+
std::optional<Vector<WebPushMessage>> messages;
203+
decoder >> messages;
204+
if (!messages)
205+
return completionHandler({ });
206+
completionHandler(WTFMove(*messages));
207+
}
208+
};
209+
189210
template<WebPushD::MessageType messageType, typename... Args, typename... ReplyArgs>
190211
void NetworkNotificationManager::sendMessageWithReply(CompletionHandler<void(ReplyArgs...)>&& completionHandler, Args&&... args) const
191212
{

‎Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "NotificationManagerMessageHandler.h"
3131
#include "WebPushDaemonConnection.h"
32+
#include "WebPushMessage.h"
3233
#include <WebCore/NotificationDirection.h>
3334
#include <wtf/text/WTFString.h>
3435

@@ -52,6 +53,7 @@ class NetworkNotificationManager : public NotificationManagerMessageHandler {
5253

5354
void deletePushAndNotificationRegistration(const WebCore::SecurityOriginData&, CompletionHandler<void(const String&)>&&);
5455
void getOriginsWithPushAndNotificationPermissions(CompletionHandler<void(const Vector<WebCore::SecurityOriginData>&)>&&);
56+
void getPendingPushMessages(CompletionHandler<void(const Vector<WebPushMessage>&)>&&);
5557

5658
private:
5759
NetworkNotificationManager(NetworkSession&, const String& webPushMachServiceName);

‎Source/WebKit/Resources/webpushtool.entitlements

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
<dict>
55
<key>com.apple.private.webkit.webpush</key>
66
<true/>
7+
<key>com.apple.private.webkit.webpush.inject</key>
8+
<true/>
79
</dict>
810
</plist>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (C) 2021 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#import "config.h"
27+
#import "WebPushMessage.h"
28+
29+
#import <wtf/RetainPtr.h>
30+
31+
namespace WebKit {
32+
33+
#define WebKitPushDataKey @"WebKitPushData"
34+
#define WebKitPushRegistrationURLKey @"WebKitPushRegistrationURL"
35+
36+
std::optional<WebPushMessage> WebPushMessage::fromDictionary(NSDictionary *dictionary)
37+
{
38+
NSURL *url = [dictionary objectForKey:WebKitPushRegistrationURLKey];
39+
if (!url || ![url isKindOfClass:[NSURL class]])
40+
return std::nullopt;
41+
42+
NSData *pushData = [dictionary objectForKey:WebKitPushDataKey];
43+
if (!pushData || ![pushData isKindOfClass:[NSData class]])
44+
return std::nullopt;
45+
46+
return { {
47+
Vector<uint8_t> { static_cast<const uint8_t*>(pushData.bytes), pushData.length },
48+
URL { url }
49+
} };
50+
}
51+
52+
NSDictionary *WebPushMessage::toDictionary() const
53+
{
54+
auto nsData = adoptNS([[NSData alloc] initWithBytes:pushData.data() length:pushData.size()]);
55+
return @{
56+
WebKitPushDataKey : nsData.get(),
57+
WebKitPushRegistrationURLKey : (NSURL *)registrationURL
58+
};
59+
}
60+
61+
} // namespace WebKit
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (C) 2021 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#include <wtf/URL.h>
29+
#include <wtf/text/WTFString.h>
30+
31+
namespace WebKit::WebPushD {
32+
33+
struct PushMessageForTesting {
34+
template<class Encoder> void encode(Encoder&) const;
35+
template<class Decoder> static std::optional<PushMessageForTesting> decode(Decoder&);
36+
37+
String targetAppCodeSigningIdentifier;
38+
URL registrationURL;
39+
String message;
40+
};
41+
42+
template<class Encoder>
43+
void PushMessageForTesting::encode(Encoder& encoder) const
44+
{
45+
encoder << targetAppCodeSigningIdentifier << registrationURL << message;
46+
}
47+
48+
template<class Decoder>
49+
std::optional<PushMessageForTesting> PushMessageForTesting::decode(Decoder& decoder)
50+
{
51+
std::optional<String> targetAppCodeSigningIdentifier;
52+
decoder >> targetAppCodeSigningIdentifier;
53+
if (!targetAppCodeSigningIdentifier)
54+
return std::nullopt;
55+
56+
std::optional<URL> registrationURL;
57+
decoder >> registrationURL;
58+
if (!registrationURL)
59+
return std::nullopt;
60+
61+
std::optional<String> message;
62+
decoder >> message;
63+
if (!message)
64+
return std::nullopt;
65+
66+
return { {
67+
WTFMove(*targetAppCodeSigningIdentifier),
68+
WTFMove(*registrationURL),
69+
WTFMove(*message),
70+
} };
71+
}
72+
73+
} // namespace WebKit::WebPushD

‎Source/WebKit/Shared/WebPushDaemonConstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ enum class MessageType : uint8_t {
4242
GetOriginsWithPushAndNotificationPermissions,
4343
SetDebugModeIsEnabled,
4444
UpdateConnectionConfiguration,
45+
InjectPushMessageForTesting,
46+
GetPendingPushMessages,
4547
};
4648

4749
inline bool messageTypeSendsReply(MessageType messageType)
@@ -51,6 +53,8 @@ inline bool messageTypeSendsReply(MessageType messageType)
5153
case MessageType::GetOriginsWithPushAndNotificationPermissions:
5254
case MessageType::DeletePushAndNotificationRegistration:
5355
case MessageType::RequestSystemNotificationPermission:
56+
case MessageType::GetPendingPushMessages:
57+
case MessageType::InjectPushMessageForTesting:
5458
return true;
5559
case MessageType::SetDebugModeIsEnabled:
5660
case MessageType::UpdateConnectionConfiguration:

0 commit comments

Comments
 (0)