<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286777] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286777">286777</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-12-09 06:46:27 -0800 (Thu, 09 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, reverting <a href="http://trac.webkit.org/projects/webkit/changeset/286764">r286764</a>.
https://bugs.webkit.org/show_bug.cgi?id=234081

broke the build

Reverted changeset:

"Add ability to inject messages into webpushd"
https://bugs.webkit.org/show_bug.cgi?id=233988
https://commits.webkit.org/<a href="http://trac.webkit.org/projects/webkit/changeset/286764">r286764</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitConfigurationswebpushtoolxcconfig">trunk/Source/WebKit/Configurations/webpushtool.xcconfig</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessh">trunk/Source/WebKit/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNotificationsNetworkNotificationManagercpp">trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNotificationsNetworkNotificationManagerh">trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h</a></li>
<li><a href="#trunkSourceWebKitResourceswebpushtoolentitlements">trunk/Source/WebKit/Resources/webpushtool.entitlements</a></li>
<li><a href="#trunkSourceWebKitSharedWebPushDaemonConstantsh">trunk/Source/WebKit/Shared/WebPushDaemonConstants.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStorePrivateh">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitwebpushdPushClientConnectionh">trunk/Source/WebKit/webpushd/PushClientConnection.h</a></li>
<li><a href="#trunkSourceWebKitwebpushdPushClientConnectionmm">trunk/Source/WebKit/webpushd/PushClientConnection.mm</a></li>
<li><a href="#trunkSourceWebKitwebpushdWebPushDaemonh">trunk/Source/WebKit/webpushd/WebPushDaemon.h</a></li>
<li><a href="#trunkSourceWebKitwebpushdWebPushDaemonmm">trunk/Source/WebKit/webpushd/WebPushDaemon.mm</a></li>
<li><a href="#trunkSourceWebKitwebpushdwebpushtoolWebPushToolConnectionh">trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h</a></li>
<li><a href="#trunkSourceWebKitwebpushdwebpushtoolWebPushToolConnectionmm">trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm</a></li>
<li><a href="#trunkSourceWebKitwebpushdwebpushtoolWebPushToolMainmm">trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPIConfigurationsTestWebKitAPIiOSentitlements">trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements</a></li>
<li><a href="#trunkToolsTestWebKitAPIConfigurationsTestWebKitAPImacOSinternalentitlements">trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements</a></li>
<li><a href="#trunkToolsTestWebKitAPIConfigurationsTestWebKitAPImacOSentitlements">trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS.entitlements</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaPushAPImm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaWebPushDaemonmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaTestWKWebViewh">trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitSharedCocoaWebPushMessageCocoamm">trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitSharedPushMessageForTestingh">trunk/Source/WebKit/Shared/PushMessageForTesting.h</a></li>
<li><a href="#trunkSourceWebKitSharedWebPushMessageh">trunk/Source/WebKit/Shared/WebPushMessage.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/ChangeLog       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2021-12-09  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r286764.
+        https://bugs.webkit.org/show_bug.cgi?id=234081
+
+        broke the build
+
+        Reverted changeset:
+
+        "Add ability to inject messages into webpushd"
+        https://bugs.webkit.org/show_bug.cgi?id=233988
+        https://commits.webkit.org/r286764
+
</ins><span class="cx"> 2021-12-09  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Copy ServiceWorkerNavigationPreloader error when failing its ServiceWorkerFetchTask
</span></span></pre></div>
<a id="trunkSourceWebKitConfigurationswebpushtoolxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Configurations/webpushtool.xcconfig (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Configurations/webpushtool.xcconfig  2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Configurations/webpushtool.xcconfig     2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = *;
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=watch*] = *;
</span><span class="cx"> 
</span><del>-OTHER_LDFLAGS = -framework WebKit -framework JavaScriptCore
</del><ins>+OTHER_LDFLAGS = -l WTF -framework Foundation -framework CoreFoundation;
</ins><span class="cx"> LIBRARY_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR);
</span><span class="cx"> 
</span><span class="cx"> CODE_SIGN_ENTITLEMENTS = Resources/webpushtool.entitlements;
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -58,7 +58,6 @@
</span><span class="cx"> #include "WebCookieManager.h"
</span><span class="cx"> #include "WebPageProxyMessages.h"
</span><span class="cx"> #include "WebProcessPoolMessages.h"
</span><del>-#include "WebPushMessage.h"
</del><span class="cx"> #include "WebResourceLoadStatisticsStore.h"
</span><span class="cx"> #include "WebSWOriginStore.h"
</span><span class="cx"> #include "WebSWServerConnection.h"
</span><span class="lines">@@ -2556,21 +2555,13 @@
</span><span class="cx">         SandboxExtension::consumePermanently(handle);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::getPendingPushMessages(PAL::SessionID sessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&& callback)
</del><ins>+void NetworkProcess::processPushMessage(PAL::SessionID sessionID, const std::optional<IPC::DataReference>& ipcData, URL&& registrationURL, CompletionHandler<void(bool)>&& callback)
</ins><span class="cx"> {
</span><del>-#if ENABLE(BUILT_IN_NOTIFICATIONS)
-    if (auto* session = networkSession(sessionID)) {
-        session->notificationManager().getPendingPushMessages(WTFMove(callback));
-        return;
-    }
-#endif
-    callback({ });
</del><ins>+    std::optional<Vector<uint8_t>> data;
+    if (ipcData)
+        data = Vector<uint8_t> { ipcData->data(), ipcData->size() };
+    swServerForSession(sessionID).processPushMessage(WTFMove(data), WTFMove(registrationURL), WTFMove(callback));
</ins><span class="cx"> }
</span><del>-
-void NetworkProcess::processPushMessage(PAL::SessionID sessionID, WebPushMessage&& pushMessage, CompletionHandler<void(bool)>&& callback)
-{
-    swServerForSession(sessionID).processPushMessage(WTFMove(pushMessage.pushData), WTFMove(pushMessage.registrationURL), WTFMove(callback));
-}
</del><span class="cx"> #endif // ENABLE(SERVICE_WORKER)
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::deletePushAndNotificationRegistration(PAL::SessionID sessionID, const SecurityOriginData& origin, CompletionHandler<void(const String&)>&& callback)
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -117,7 +117,6 @@
</span><span class="cx"> enum class WebsiteDataFetchOption : uint8_t;
</span><span class="cx"> enum class WebsiteDataType : uint32_t;
</span><span class="cx"> struct NetworkProcessCreationParameters;
</span><del>-struct WebPushMessage;
</del><span class="cx"> struct WebsiteDataStoreParameters;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><span class="lines">@@ -397,8 +396,7 @@
</span><span class="cx">     bool ftpEnabled() const { return m_ftpEnabled; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><del>-    void getPendingPushMessages(PAL::SessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&&);
-    void processPushMessage(PAL::SessionID, WebPushMessage&&, CompletionHandler<void(bool)>&&);
</del><ins>+    void processPushMessage(PAL::SessionID, const std::optional<IPC::DataReference>&, URL&&, CompletionHandler<void(bool)>&&);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void deletePushAndNotificationRegistration(PAL::SessionID, const WebCore::SecurityOriginData&, CompletionHandler<void(const String&)>&&);
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -207,8 +207,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><del>-    GetPendingPushMessages(PAL::SessionID sessionID) -> (Vector<WebKit::WebPushMessage> messages) Async
-    ProcessPushMessage(PAL::SessionID sessionID, struct WebKit::WebPushMessage pushMessage) -> (bool didSucceed) Async
</del><ins>+    ProcessPushMessage(PAL::SessionID sessionID, std::optional<IPC::DataReference> data, URL registrationURL) -> (bool didSucceed) Async
</ins><span class="cx"> #endif
</span><span class="cx">     DeletePushAndNotificationRegistration(PAL::SessionID sessionID, struct WebCore::SecurityOriginData origin) -> (String errorMessage) Async
</span><span class="cx">     GetOriginsWithPushAndNotificationPermissions(PAL::SessionID sessionID) -> (Vector<WebCore::SecurityOriginData> origins) Async
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNotificationsNetworkNotificationManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp  2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp     2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "DaemonEncoder.h"
</span><span class="cx"> #include "NetworkSession.h"
</span><span class="cx"> #include "WebPushDaemonConnectionConfiguration.h"
</span><del>-#include "WebPushMessage.h"
</del><span class="cx"> #include <WebCore/SecurityOriginData.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -89,15 +88,6 @@
</span><span class="cx">     sendMessageWithReply<WebPushD::MessageType::GetOriginsWithPushAndNotificationPermissions>(WTFMove(replyHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkNotificationManager::getPendingPushMessages(CompletionHandler<void(const Vector<WebPushMessage>&)>&& completionHandler)
-{
-    CompletionHandler<void(Vector<WebPushMessage>&&)> replyHandler = [completionHandler = WTFMove(completionHandler)] (Vector<WebPushMessage>&& messages) mutable {
-        completionHandler(WTFMove(messages));
-    };
-
-    sendMessageWithReply<WebPushD::MessageType::GetPendingPushMessages>(WTFMove(replyHandler));
-}
-
</del><span class="cx"> void NetworkNotificationManager::showNotification(const String&, const String&, const String&, const String&, const String&, WebCore::NotificationDirection, const String&, uint64_t)
</span><span class="cx"> {
</span><span class="cx">     if (!m_connection)
</span><span class="lines">@@ -196,17 +186,6 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-template<> struct ReplyCaller<Vector<WebPushMessage>&&> {
-    static void callReply(Daemon::Decoder&& decoder, CompletionHandler<void(Vector<WebPushMessage>&&)>&& completionHandler)
-    {
-        std::optional<Vector<WebPushMessage>> messages;
-        decoder >> messages;
-        if (!messages)
-            return completionHandler({ });
-        completionHandler(WTFMove(*messages));
-    }
-};
-
</del><span class="cx"> template<WebPushD::MessageType messageType, typename... Args, typename... ReplyArgs>
</span><span class="cx"> void NetworkNotificationManager::sendMessageWithReply(CompletionHandler<void(ReplyArgs...)>&& completionHandler, Args&&... args) const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNotificationsNetworkNotificationManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include "NotificationManagerMessageHandler.h"
</span><span class="cx"> #include "WebPushDaemonConnection.h"
</span><del>-#include "WebPushMessage.h"
</del><span class="cx"> #include <WebCore/NotificationDirection.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx"> 
</span><span class="lines">@@ -53,7 +52,6 @@
</span><span class="cx"> 
</span><span class="cx">     void deletePushAndNotificationRegistration(const WebCore::SecurityOriginData&, CompletionHandler<void(const String&)>&&);
</span><span class="cx">     void getOriginsWithPushAndNotificationPermissions(CompletionHandler<void(const Vector<WebCore::SecurityOriginData>&)>&&);
</span><del>-    void getPendingPushMessages(CompletionHandler<void(const Vector<WebPushMessage>&)>&&);
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     NetworkNotificationManager(NetworkSession&, const String& webPushMachServiceName);
</span></span></pre></div>
<a id="trunkSourceWebKitResourceswebpushtoolentitlements"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Resources/webpushtool.entitlements (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Resources/webpushtool.entitlements   2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Resources/webpushtool.entitlements      2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -4,7 +4,5 @@
</span><span class="cx"> <dict>
</span><span class="cx">  <key>com.apple.private.webkit.webpush</key>
</span><span class="cx">  <true/>
</span><del>-       <key>com.apple.private.webkit.webpush.inject</key>
-       <true/>
</del><span class="cx"> </dict>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCocoaWebPushMessageCocoamm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm  2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Shared/Cocoa/WebPushMessageCocoa.mm     2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1,61 +0,0 @@
</span><del>-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebPushMessage.h"
-
-#import <wtf/RetainPtr.h>
-
-namespace WebKit {
-
-#define WebKitPushDataKey @"WebKitPushData"
-#define WebKitPushRegistrationURLKey @"WebKitPushRegistrationURL"
-
-std::optional<WebPushMessage> WebPushMessage::fromDictionary(NSDictionary *dictionary)
-{
-    NSURL *url = [dictionary objectForKey:WebKitPushRegistrationURLKey];
-    if (!url || ![url isKindOfClass:[NSURL class]])
-        return std::nullopt;
-
-    NSData *pushData = [dictionary objectForKey:WebKitPushDataKey];
-    if (!pushData || ![pushData isKindOfClass:[NSData class]])
-        return std::nullopt;
-
-    return { {
-        Vector<uint8_t> { static_cast<const uint8_t*>(pushData.bytes), pushData.length },
-        URL { url }
-    } };
-}
-
-NSDictionary *WebPushMessage::toDictionary() const
-{
-    auto nsData = adoptNS([[NSData alloc] initWithBytes:pushData.data() length:pushData.size()]);
-    return @{
-        WebKitPushDataKey : nsData.get(),
-        WebKitPushRegistrationURLKey : (NSURL *)registrationURL
-    };
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKitSharedPushMessageForTestingh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/Shared/PushMessageForTesting.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/PushMessageForTesting.h       2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Shared/PushMessageForTesting.h  2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/URL.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebKit::WebPushD {
-
-struct PushMessageForTesting {
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static std::optional<PushMessageForTesting> decode(Decoder&);
-
-    String targetAppCodeSigningIdentifier;
-    URL registrationURL;
-    String message;
-};
-
-template<class Encoder>
-void PushMessageForTesting::encode(Encoder& encoder) const
-{
-    encoder << targetAppCodeSigningIdentifier << registrationURL << message;
-}
-
-template<class Decoder>
-std::optional<PushMessageForTesting> PushMessageForTesting::decode(Decoder& decoder)
-{
-    std::optional<String> targetAppCodeSigningIdentifier;
-    decoder >> targetAppCodeSigningIdentifier;
-    if (!targetAppCodeSigningIdentifier)
-        return std::nullopt;
-
-    std::optional<URL> registrationURL;
-    decoder >> registrationURL;
-    if (!registrationURL)
-        return std::nullopt;
-
-    std::optional<String> message;
-    decoder >> message;
-    if (!message)
-        return std::nullopt;
-
-    return { {
-        WTFMove(*targetAppCodeSigningIdentifier),
-        WTFMove(*registrationURL),
-        WTFMove(*message),
-    } };
-}
-
-} // namespace WebKit::WebPushD
</del></span></pre></div>
<a id="trunkSourceWebKitSharedWebPushDaemonConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPushDaemonConstants.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPushDaemonConstants.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Shared/WebPushDaemonConstants.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx">     GetOriginsWithPushAndNotificationPermissions,
</span><span class="cx">     SetDebugModeIsEnabled,
</span><span class="cx">     UpdateConnectionConfiguration,
</span><del>-    InjectPushMessageForTesting,
-    GetPendingPushMessages,
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool messageTypeSendsReply(MessageType messageType)
</span><span class="lines">@@ -53,8 +51,6 @@
</span><span class="cx">     case MessageType::GetOriginsWithPushAndNotificationPermissions:
</span><span class="cx">     case MessageType::DeletePushAndNotificationRegistration:
</span><span class="cx">     case MessageType::RequestSystemNotificationPermission:
</span><del>-    case MessageType::GetPendingPushMessages:
-    case MessageType::InjectPushMessageForTesting:
</del><span class="cx">         return true;
</span><span class="cx">     case MessageType::SetDebugModeIsEnabled:
</span><span class="cx">     case MessageType::UpdateConnectionConfiguration:
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPushMessageh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/Shared/WebPushMessage.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPushMessage.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/Shared/WebPushMessage.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1,74 +0,0 @@
</span><del>-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <optional>
-#include <wtf/URL.h>
-#include <wtf/Vector.h>
-
-OBJC_CLASS NSDictionary;
-
-namespace WebKit {
-
-struct WebPushMessage {
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static std::optional<WebPushMessage> decode(Decoder&);
-
-    Vector<uint8_t> pushData;
-    URL registrationURL;
-
-#if PLATFORM(COCOA)
-    static std::optional<WebPushMessage> fromDictionary(NSDictionary *);
-    NSDictionary *toDictionary() const;
-#endif
-};
-
-template<class Encoder>
-void WebPushMessage::encode(Encoder& encoder) const
-{
-    encoder << pushData << registrationURL;
-}
-
-template<class Decoder>
-std::optional<WebPushMessage> WebPushMessage::decode(Decoder& decoder)
-{
-    std::optional<Vector<uint8_t>> pushData;
-    decoder >> pushData;
-    if (!pushData)
-        return std::nullopt;
-
-    std::optional<URL> registrationURL;
-    decoder >> registrationURL;
-    if (!registrationURL)
-        return std::nullopt;
-
-    return { {
-        WTFMove(*pushData),
-        WTFMove(*registrationURL)
-    } };
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #import "WKWebViewInternal.h"
</span><span class="cx"> #import "WKWebsiteDataRecordInternal.h"
</span><span class="cx"> #import "WebPageProxy.h"
</span><del>-#import "WebPushMessage.h"
</del><span class="cx"> #import "WebResourceLoadStatisticsStore.h"
</span><span class="cx"> #import "WebsiteDataFetchOption.h"
</span><span class="cx"> #import "_WKResourceLoadStatisticsThirdPartyInternal.h"
</span><span class="lines">@@ -762,29 +761,13 @@
</span><span class="cx">     return _websiteDataStore->hasServiceWorkerBackgroundActivityForTesting();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>--(void)_getPendingPushMessages:(void(^)(NSArray<NSDictionary *> *))completionHandler
</del><ins>+-(void)_processPushMessage:(NSData*) message registration:(NSURL *)registration completionHandler:(void(^)(bool wasProcessed))completionHandler
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><del>-    _websiteDataStore->networkProcess().getPendingPushMessages(_websiteDataStore->sessionID(), [completionHandler = makeBlockPtr(completionHandler)] (const Vector<WebKit::WebPushMessage>& messages) {
-        auto result = adoptNS([[NSMutableArray alloc] initWithCapacity:messages.size()]);
-        for (auto& message : messages)
-            [result addObject:message.toDictionary()];
-
-        completionHandler(result.get());
-    });
-#endif
-}
-
--(void)_processPushMessage:(NSDictionary *)pushMessageDictionary completionHandler:(void(^)(bool wasProcessed))completionHandler
-{
-#if ENABLE(SERVICE_WORKER)
-    auto pushMessage = WebKit::WebPushMessage::fromDictionary(pushMessageDictionary);
-    if (!pushMessage) {
-        completionHandler(false);
-        return;
-    }
-
-    _websiteDataStore->networkProcess().processPushMessage(_websiteDataStore->sessionID(), *pushMessage, [completionHandler = makeBlockPtr(completionHandler)] (bool wasProcessed) {
</del><ins>+    std::optional<Span<const uint8_t>> data;
+    if (message)
+        data = Span<const uint8_t> { reinterpret_cast<const uint8_t*>(message.bytes), message.length };
+    _websiteDataStore->networkProcess().processPushMessage(_websiteDataStore->sessionID(), data, registration, [completionHandler = makeBlockPtr(completionHandler)] (bool wasProcessed) {
</ins><span class="cx">         completionHandler(wasProcessed);
</span><span class="cx">     });
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebsiteDataStorePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -108,8 +108,7 @@
</span><span class="cx"> - (void)_countNonDefaultSessionSets:(void(^)(size_t))completionHandler;
</span><span class="cx"> 
</span><span class="cx"> -(bool)_hasServiceWorkerBackgroundActivityForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><del>--(void)_getPendingPushMessages:(void(^)(NSArray<NSDictionary *> *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
--(void)_processPushMessage:(NSDictionary *)pushMessage completionHandler:(void(^)(bool))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</del><ins>+-(void)_processPushMessage:(NSData*)data registration:(NSURL *)registration completionHandler:(void(^)(bool))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx"> -(void)_deletePushAndNotificationRegistration:(WKSecurityOrigin *)securityOrigin completionHandler:(void(^)(NSError *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> -(void)_getOriginsWithPushAndNotificationPermissions:(void(^)(NSSet<WKSecurityOrigin *> *))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1692,15 +1692,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><del>-void NetworkProcessProxy::getPendingPushMessages(PAL::SessionID sessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&& completionHandler)
</del><ins>+void NetworkProcessProxy::processPushMessage(PAL::SessionID sessionID, std::optional<Span<const uint8_t>> data, const URL& registrationURL, CompletionHandler<void(bool wasProcessed)>&& callback)
</ins><span class="cx"> {
</span><del>-    sendWithAsyncReply(Messages::NetworkProcess::GetPendingPushMessages { sessionID }, WTFMove(completionHandler));
</del><ins>+    std::optional<IPC::DataReference> ipcData;
+    if (data)
+        ipcData = IPC::DataReference { data->data(), data->size() };
+    sendWithAsyncReply(Messages::NetworkProcess::ProcessPushMessage { sessionID, ipcData, registrationURL }, WTFMove(callback));
</ins><span class="cx"> }
</span><del>-
-void NetworkProcessProxy::processPushMessage(PAL::SessionID sessionID, const WebPushMessage& pushMessage, CompletionHandler<void(bool wasProcessed)>&& callback)
-{
-    sendWithAsyncReply(Messages::NetworkProcess::ProcessPushMessage { sessionID, pushMessage }, WTFMove(callback));
-}
</del><span class="cx"> #endif // ENABLE(SERVICE_WORKER)
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcessProxy::deletePushAndNotificationRegistration(PAL::SessionID sessionID, const SecurityOriginData& origin, CompletionHandler<void(const String&)>&& callback)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -92,7 +92,6 @@
</span><span class="cx"> struct FrameInfoData;
</span><span class="cx"> struct NetworkProcessCreationParameters;
</span><span class="cx"> struct ResourceLoadInfo;
</span><del>-struct WebPushMessage;
</del><span class="cx"> struct WebsiteData;
</span><span class="cx"> struct WebsiteDataStoreParameters;
</span><span class="cx"> 
</span><span class="lines">@@ -274,8 +273,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_WORKER)
</span><del>-    void getPendingPushMessages(PAL::SessionID, CompletionHandler<void(const Vector<WebPushMessage>&)>&&);
-    void processPushMessage(PAL::SessionID, const WebPushMessage&, CompletionHandler<void(bool wasProcessed)>&&);
</del><ins>+    void processPushMessage(PAL::SessionID, std::optional<Span<const uint8_t>>, const URL&, CompletionHandler<void(bool wasProcessed)>&&);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void deletePushAndNotificationRegistration(PAL::SessionID, const WebCore::SecurityOriginData&, CompletionHandler<void(const String&)>&&);
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1034,12 +1034,6 @@
</span><span class="cx">          517B5F84275E97B6002DC22D /* MockAppBundleForTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51F7BB74274498BA00C45A72 /* MockAppBundleForTesting.mm */; };
</span><span class="cx">          517B5F85275E97B6002DC22D /* AppBundleRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160E954274B887100567388 /* AppBundleRequest.h */; };
</span><span class="cx">          517B5F86275E97B6002DC22D /* MockAppBundleRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160E95F274C2A3F00567388 /* MockAppBundleRegistry.mm */; };
</span><del>-               517B5F95275EBA63002DC22D /* PushMessageForTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B5F94275EBA62002DC22D /* PushMessageForTesting.h */; };
-               517B5F97275EC5E5002DC22D /* WebPushMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B5F96275EC5E5002DC22D /* WebPushMessage.h */; };
-               517B5F99275EC601002DC22D /* WebPushMessageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517B5F98275EC600002DC22D /* WebPushMessageCocoa.mm */; };
-               517B5F9A275F3A86002DC22D /* ArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */; };
-               517B5F9B275F3A98002DC22D /* DaemonUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C1579F92717AF5000ED5280 /* DaemonUtilities.mm */; };
-               517B5F9C275F3C37002DC22D /* DaemonEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1579E827172A8A00ED5280 /* DaemonEncoder.cpp */; };
</del><span class="cx">           517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */; };
</span><span class="cx">          517CF0E3163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */; };
</span><span class="cx">          517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */; };
</span><span class="lines">@@ -4415,9 +4409,6 @@
</span><span class="cx">          517B5F6B275AE50B002DC22D /* webpushtool.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; name = webpushtool.entitlements; path = Resources/webpushtool.entitlements; sourceTree = "<group>"; };
</span><span class="cx">          517B5F72275E9609002DC22D /* WebPushDaemonMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPushDaemonMain.h; sourceTree = "<group>"; };
</span><span class="cx">          517B5F77275E9795002DC22D /* webpushd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = webpushd.cpp; sourceTree = "<group>"; };
</span><del>-               517B5F94275EBA62002DC22D /* PushMessageForTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushMessageForTesting.h; sourceTree = "<group>"; };
-               517B5F96275EC5E5002DC22D /* WebPushMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPushMessage.h; sourceTree = "<group>"; };
-               517B5F98275EC600002DC22D /* WebPushMessageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPushMessageCocoa.mm; sourceTree = "<group>"; };
</del><span class="cx">           517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessConnectionMessageReceiver.cpp; path = DerivedSources/WebKit/NetworkProcessConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">          517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CacheStorageEngineConnectionMessageReceiver.cpp; path = DerivedSources/WebKit/CacheStorageEngineConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">          517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessConnectionMessages.h; path = DerivedSources/WebKit/NetworkProcessConnectionMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -6484,7 +6475,6 @@
</span><span class="cx">                  isa = PBXFrameworksBuildPhase;
</span><span class="cx">                  buildActionMask = 2147483647;
</span><span class="cx">                  files = (
</span><del>-                               517B5F9E275F3F54002DC22D /* libicucore.tbd in Frameworks */,
</del><span class="cx">                   );
</span><span class="cx">                  runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">          };
</span><span class="lines">@@ -7146,7 +7136,6 @@
</span><span class="cx">                          E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */,
</span><span class="cx">                          E1CC1B8E12D7EADF00625838 /* PrintInfo.h */,
</span><span class="cx">                          463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */,
</span><del>-                               517B5F94275EBA62002DC22D /* PushMessageForTesting.h */,
</del><span class="cx">                           9B1229D023FF2A5E008CA751 /* RemoteAudioDestinationIdentifier.h */,
</span><span class="cx">                          7203449B26A6C476000A5F54 /* RenderingUpdateID.h */,
</span><span class="cx">                          5CB7AFE623C681B000E49CF3 /* ResourceLoadInfo.h */,
</span><span class="lines">@@ -7253,7 +7242,6 @@
</span><span class="cx">                          467E43E72243FF6D00B13924 /* WebProcessDataStoreParameters.h */,
</span><span class="cx">                          517B5F2D2757382A002DC22D /* WebPushDaemonConnectionConfiguration.h */,
</span><span class="cx">                          512CD6992721F04900F7F8EC /* WebPushDaemonConstants.h */,
</span><del>-                               517B5F96275EC5E5002DC22D /* WebPushMessage.h */,
</del><span class="cx">                           5C8DD37F1FE4519200F2A556 /* WebsiteAutoplayPolicy.h */,
</span><span class="cx">                          5C8DD3811FE455CA00F2A556 /* WebsiteAutoplayQuirk.h */,
</span><span class="cx">                          511F7D3F1EB1BCEE00E47B83 /* WebsiteDataStoreParameters.cpp */,
</span><span class="lines">@@ -8950,7 +8938,6 @@
</span><span class="cx">                          7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */,
</span><span class="cx">                          465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */,
</span><span class="cx">                          1DE076D92460CCBD00B211E8 /* WebPreferencesDefaultValuesCocoa.mm */,
</span><del>-                               517B5F98275EC600002DC22D /* WebPushMessageCocoa.mm */,
</del><span class="cx">                           37C4C0921814B3AF003688B9 /* WKNSArray.h */,
</span><span class="cx">                          37C4C0911814B3AF003688B9 /* WKNSArray.mm */,
</span><span class="cx">                          373CEAD4185417AE008C363D /* WKNSData.h */,
</span><span class="lines">@@ -9713,7 +9700,6 @@
</span><span class="cx">          5750F3292032D4E300389347 /* Frameworks */ = {
</span><span class="cx">                  isa = PBXGroup;
</span><span class="cx">                  children = (
</span><del>-                               517B5F9D275F3F54002DC22D /* libicucore.tbd */,
</del><span class="cx">                           57A9FF15252C6AEF006A2040 /* libWTF.a */,
</span><span class="cx">                          5750F32A2032D4E500389347 /* LocalAuthentication.framework */,
</span><span class="cx">                          570DAAB0230273D200E8FC04 /* NearField.framework */,
</span><span class="lines">@@ -13027,7 +13013,6 @@
</span><span class="cx">                          532159561DBAE72D0054AA3C /* NetworkDataTaskCocoa.h in Headers */,
</span><span class="cx">                          839902031BE9A02B000F3653 /* NetworkLoad.h in Headers */,
</span><span class="cx">                          83D454D71BE9D3C4006C93BD /* NetworkLoadClient.h in Headers */,
</span><del>-                               517B5F97275EC5E5002DC22D /* WebPushMessage.h in Headers */,
</del><span class="cx">                           839149651BEA838500D2D953 /* NetworkLoadParameters.h in Headers */,
</span><span class="cx">                          E47FC8A025B8331C005495FC /* NetworkLoadScheduler.h in Headers */,
</span><span class="cx">                          514526ED271E1647000467B6 /* NetworkNotificationManager.h in Headers */,
</span><span class="lines">@@ -13535,7 +13520,6 @@
</span><span class="cx">                          9356F2DC2152B6B500E6D5DF /* WebSWClientConnection.h in Headers */,
</span><span class="cx">                          517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */,
</span><span class="cx">                          466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */,
</span><del>-                               517B5F95275EBA63002DC22D /* PushMessageForTesting.h in Headers */,
</del><span class="cx">                           460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */,
</span><span class="cx">                          C11A9ECC214035F800CFB20A /* WebSwitchingGPUClient.h in Headers */,
</span><span class="cx">                          9356F2DE2152B71000E6D5DF /* WebSWOriginStore.h in Headers */,
</span><span class="lines">@@ -15101,10 +15085,7 @@
</span><span class="cx">                  isa = PBXSourcesBuildPhase;
</span><span class="cx">                  buildActionMask = 2147483647;
</span><span class="cx">                  files = (
</span><del>-                               517B5F9A275F3A86002DC22D /* ArgumentCoders.cpp in Sources */,
</del><span class="cx">                           517B5F68275A9A78002DC22D /* WebPushToolConnection.mm in Sources */,
</span><del>-                               517B5F9B275F3A98002DC22D /* DaemonUtilities.mm in Sources */,
-                               517B5F9C275F3C37002DC22D /* DaemonEncoder.cpp in Sources */,
</del><span class="cx">                           517B5F65275A8D7F002DC22D /* WebPushToolMain.mm in Sources */,
</span><span class="cx">                  );
</span><span class="cx">                  runOnlyForDeploymentPostprocessing = 0;
</span><span class="lines">@@ -15200,7 +15181,6 @@
</span><span class="cx">                          CDA93DB122F8BCF400490A69 /* FullscreenTouchSecheuristicParameters.cpp in Sources */,
</span><span class="cx">                          C1A152D724E5A29A00978C8B /* HandleXPCEndpointMessages.mm in Sources */,
</span><span class="cx">                          2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */,
</span><del>-                               517B5F99275EC601002DC22D /* WebPushMessageCocoa.mm in Sources */,
</del><span class="cx">                           2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */,
</span><span class="cx">                          9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */,
</span><span class="cx">                          C14D37FE24ACE086007FF014 /* LaunchServicesDatabaseManager.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdPushClientConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/PushClientConnection.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/PushClientConnection.h      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/PushClientConnection.h 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx"> 
</span><span class="cx">     const String& hostAppCodeSigningIdentifier();
</span><span class="cx">     bool hostAppHasPushEntitlement();
</span><del>-    bool hostAppHasPushInjectEntitlement();
</del><span class="cx"> 
</span><span class="cx">     bool debugModeIsEnabled() const { return m_debugModeEnabled; }
</span><span class="cx">     void setDebugModeIsEnabled(bool);
</span><span class="lines">@@ -76,8 +75,6 @@
</span><span class="cx">     void maybeStartNextAppBundleRequest();
</span><span class="cx">     void setHostAppAuditTokenData(const Vector<uint8_t>&);
</span><span class="cx"> 
</span><del>-    bool hostHasEntitlement(const char*);
-
</del><span class="cx">     OSObjectPtr<xpc_connection_t> m_xpcConnection;
</span><span class="cx"> 
</span><span class="cx">     std::optional<audit_token_t> m_hostAppAuditToken;
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdPushClientConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/PushClientConnection.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/PushClientConnection.mm     2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/PushClientConnection.mm        2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -89,24 +89,15 @@
</span><span class="cx"> 
</span><span class="cx"> bool ClientConnection::hostAppHasPushEntitlement()
</span><span class="cx"> {
</span><del>-    if (!m_hostAppHasPushEntitlement)
-        m_hostAppHasPushEntitlement = hostHasEntitlement("com.apple.private.webkit.webpush"_s);
</del><ins>+    if (!m_hostAppHasPushEntitlement) {
+        if (!m_hostAppAuditToken)
+            return false;
+        m_hostAppHasPushEntitlement = WTF::hasEntitlement(*m_hostAppAuditToken, "com.apple.private.webkit.webpush");
+    }
</ins><span class="cx"> 
</span><span class="cx">     return *m_hostAppHasPushEntitlement;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ClientConnection::hostAppHasPushInjectEntitlement()
-{
-    return hostHasEntitlement("com.apple.private.webkit.webpush.inject"_s);
-}
-
-bool ClientConnection::hostHasEntitlement(const char* entitlement)
-{
-    if (!m_hostAppAuditToken)
-        return false;
-    return WTF::hasEntitlement(*m_hostAppAuditToken, entitlement);
-}
-
</del><span class="cx"> void ClientConnection::setDebugModeIsEnabled(bool enabled)
</span><span class="cx"> {
</span><span class="cx">     if (enabled == m_debugModeEnabled)
</span><span class="lines">@@ -121,9 +112,9 @@
</span><span class="cx">     String messageIdentifier;
</span><span class="cx">     auto signingIdentifer = hostAppCodeSigningIdentifier();
</span><span class="cx">     if (signingIdentifer.isEmpty())
</span><del>-        messageIdentifier = makeString("[(0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
</del><ins>+        messageIdentifier = makeString ("[(0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
</ins><span class="cx">     else
</span><del>-        messageIdentifier = makeString("[", signingIdentifer, " (0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
</del><ins>+        messageIdentifier = makeString ("[", signingIdentifer, " (0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
</ins><span class="cx"> 
</span><span class="cx">     Daemon::singleton().broadcastDebugMessage(JSC::MessageLevel::Info, makeString(messageIdentifier, message));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdWebPushDaemonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/WebPushDaemon.h     2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.h        2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -26,11 +26,8 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "PushClientConnection.h"
</span><del>-#include "PushMessageForTesting.h"
</del><span class="cx"> #include "WebPushDaemonConnectionConfiguration.h"
</span><span class="cx"> #include "WebPushDaemonConstants.h"
</span><del>-#include "WebPushMessage.h"
-#include <wtf/Deque.h>
</del><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="lines">@@ -43,7 +40,6 @@
</span><span class="cx"> enum class MessageLevel : uint8_t;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-using WebKit::WebPushD::PushMessageForTesting;
</del><span class="cx"> using WebKit::WebPushD::WebPushDaemonConnectionConfiguration;
</span><span class="cx"> 
</span><span class="cx"> namespace WebPushD {
</span><span class="lines">@@ -66,8 +62,6 @@
</span><span class="cx">     void deletePushAndNotificationRegistration(ClientConnection*, const String& originString, CompletionHandler<void(const String&)>&& replySender);
</span><span class="cx">     void setDebugModeIsEnabled(ClientConnection*, bool);
</span><span class="cx">     void updateConnectionConfiguration(ClientConnection*, const WebPushDaemonConnectionConfiguration&);
</span><del>-    void injectPushMessageForTesting(ClientConnection*, const PushMessageForTesting&, CompletionHandler<void(bool)>&&);
-    void getPendingPushMessages(ClientConnection*, CompletionHandler<void(const Vector<WebKit::WebPushMessage>&)>&& replySender);
</del><span class="cx"> 
</span><span class="cx">     void broadcastDebugMessage(JSC::MessageLevel, const String&);
</span><span class="cx"> 
</span><span class="lines">@@ -81,8 +75,6 @@
</span><span class="cx"> 
</span><span class="cx">     ClientConnection* toClientConnection(xpc_connection_t);
</span><span class="cx">     HashMap<xpc_connection_t, Ref<ClientConnection>> m_connectionMap;
</span><del>-
-    HashMap<String, Deque<PushMessageForTesting>> m_testingPushMessages;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebPushD
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdWebPushDaemonmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/WebPushDaemon.mm    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.mm       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -70,11 +70,6 @@
</span><span class="cx"> REPLY(bool)
</span><span class="cx"> END
</span><span class="cx"> 
</span><del>-FUNCTION(getPendingPushMessages)
-ARGUMENTS()
-REPLY(const Vector<WebKit::WebPushMessage>&)
-END
-
</del><span class="cx"> FUNCTION(setDebugModeIsEnabled)
</span><span class="cx"> ARGUMENTS(bool)
</span><span class="cx"> END
</span><span class="lines">@@ -83,11 +78,6 @@
</span><span class="cx"> ARGUMENTS(WebPushDaemonConnectionConfiguration)
</span><span class="cx"> END
</span><span class="cx"> 
</span><del>-FUNCTION(injectPushMessageForTesting)
-ARGUMENTS(PushMessageForTesting)
-REPLY(bool)
-END
-
</del><span class="cx"> #undef FUNCTION
</span><span class="cx"> #undef ARGUMENTS
</span><span class="cx"> #undef REPLY
</span><span class="lines">@@ -121,20 +111,6 @@
</span><span class="cx">     return encoder.takeBuffer();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPushD::EncodedMessage injectPushMessageForTesting::encodeReply(bool reply)
-{
-    WebKit::Daemon::Encoder encoder;
-    encoder << reply;
-    return encoder.takeBuffer();
-}
-
-WebPushD::EncodedMessage getPendingPushMessages::encodeReply(const Vector<WebKit::WebPushMessage>& reply)
-{
-    WebKit::Daemon::Encoder encoder;
-    encoder << reply;
-    return encoder.takeBuffer();
-}
-
</del><span class="cx"> } // namespace MessageInfo
</span><span class="cx"> 
</span><span class="cx"> template<typename Info>
</span><span class="lines">@@ -257,12 +233,6 @@
</span><span class="cx">     case MessageType::UpdateConnectionConfiguration:
</span><span class="cx">         handleWebPushDMessage<MessageInfo::updateConnectionConfiguration>(clientConnection, encodedMessage);
</span><span class="cx">         break;
</span><del>-    case MessageType::InjectPushMessageForTesting:
-        handleWebPushDMessageWithReply<MessageInfo::injectPushMessageForTesting>(clientConnection, encodedMessage, WTFMove(replySender));
-        break;
-    case MessageType::GetPendingPushMessages:
-        handleWebPushDMessageWithReply<MessageInfo::getPendingPushMessages>(clientConnection, encodedMessage, WTFMove(replySender));
-        break;
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -327,55 +297,6 @@
</span><span class="cx">     clientConnection->updateConnectionConfiguration(configuration);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Daemon::injectPushMessageForTesting(ClientConnection* connection, const PushMessageForTesting& message, CompletionHandler<void(bool)>&& replySender)
-{
-    if (!connection->hostAppHasPushInjectEntitlement()) {
-        connection->broadcastDebugMessage("Attempting to inject a push message from an unentitled process");
-        replySender(false);
-        return;
-    }
-
-    if (message.targetAppCodeSigningIdentifier.isEmpty() || !message.registrationURL.isValid()) {
-        connection->broadcastDebugMessage("Attempting to inject an invalid push message");
-        replySender(false);
-        return;
-    }
-
-    connection->broadcastDebugMessage(makeString("Injected a test push messasge for ", message.targetAppCodeSigningIdentifier, " at ", message.registrationURL.string()));
-    connection->broadcastDebugMessage(message.message);
-
-    auto addResult = m_testingPushMessages.ensure(message.targetAppCodeSigningIdentifier, [] {
-        return Deque<PushMessageForTesting> { };
-    });
-    addResult.iterator->value.append(message);
-
-    replySender(true);
-}
-
-void Daemon::getPendingPushMessages(ClientConnection* connection, CompletionHandler<void(const Vector<WebKit::WebPushMessage>&)>&& replySender)
-{
-    auto hostAppCodeSigningIdentifier = connection->hostAppCodeSigningIdentifier();
-    if (hostAppCodeSigningIdentifier.isEmpty()) {
-        replySender({ });
-        return;
-    }
-
-    Vector<WebKit::WebPushMessage> resultMessages;
-
-    auto iterator = m_testingPushMessages.find(hostAppCodeSigningIdentifier);
-    if (iterator != m_testingPushMessages.end()) {
-        for (auto& message : iterator->value) {
-            auto data = message.message.utf8();
-            resultMessages.append(WebKit::WebPushMessage { Vector<uint8_t> { reinterpret_cast<const uint8_t*>(data.data()), data.length() }, message.registrationURL });
-        }
-        m_testingPushMessages.remove(iterator);
-    }
-
-    connection->broadcastDebugMessage(makeString("Fetching ", String::number(resultMessages.size()), " pending push messages"));
-
-    replySender(WTFMove(resultMessages));
-}
-
</del><span class="cx"> ClientConnection* Daemon::toClientConnection(xpc_connection_t connection)
</span><span class="cx"> {
</span><span class="cx">     auto clientConnection = m_connectionMap.get(connection);
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdwebpushtoolWebPushToolConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h 2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h    2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -25,15 +25,11 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "PushMessageForTesting.h"
</del><span class="cx"> #include <memory>
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><del>-#include <wtf/URL.h>
</del><span class="cx"> #include <wtf/WeakPtr.h>
</span><span class="cx"> #include <wtf/spi/darwin/XPCSPI.h>
</span><span class="cx"> 
</span><del>-using WebKit::WebPushD::PushMessageForTesting;
-
</del><span class="cx"> namespace WebPushTool {
</span><span class="cx"> 
</span><span class="cx"> enum class Action {
</span><span class="lines">@@ -58,8 +54,6 @@
</span><span class="cx"> 
</span><span class="cx">     void connectToService();
</span><span class="cx"> 
</span><del>-    void setPushMessage(std::unique_ptr<PushMessageForTesting>&& message) { m_pushMessage = WTFMove(message); }
-
</del><span class="cx"> private:
</span><span class="cx">     void messageReceived(xpc_object_t);
</span><span class="cx">     void connectionDropped();
</span><span class="lines">@@ -66,16 +60,13 @@
</span><span class="cx"> 
</span><span class="cx">     void startAction();
</span><span class="cx">     void startDebugStreamAction();
</span><del>-    void sendPushMessage();
</del><span class="cx"> 
</span><span class="cx">     void sendAuditToken();
</span><del>-
</del><ins>+    
</ins><span class="cx">     Action m_action;
</span><span class="cx">     bool m_reconnect { false };
</span><span class="cx">     RetainPtr<xpc_connection_t> m_connection;
</span><span class="cx">     const char* m_serviceName;
</span><del>-
-    std::unique_ptr<PushMessageForTesting> m_pushMessage;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebPushTool
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdwebpushtoolWebPushToolConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm        2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm   2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -26,9 +26,6 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import "WebPushToolConnection.h"
</span><span class="cx"> 
</span><del>-#import "DaemonEncoder.h"
-#import "DaemonUtilities.h"
-#import "WebPushDaemonConstants.h"
</del><span class="cx"> #import <mach/mach_init.h>
</span><span class="cx"> #import <mach/task.h>
</span><span class="cx"> #import <pal/spi/cocoa/ServersSPI.h>
</span><span class="lines">@@ -121,28 +118,8 @@
</span><span class="cx">         startDebugStreamAction();
</span><span class="cx">         break;
</span><span class="cx">     };
</span><del>-
-    if (m_pushMessage)
-        sendPushMessage();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Connection::sendPushMessage()
-{
-    ASSERT(m_pushMessage);
-
-    WebKit::Daemon::Encoder encoder;
-    encoder << *m_pushMessage;
-
-    auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
-    xpc_dictionary_set_uint64(dictionary.get(), WebKit::WebPushD::protocolVersionKey, WebKit::WebPushD::protocolVersionValue);
-    xpc_dictionary_set_value(dictionary.get(), WebKit::WebPushD::protocolEncodedMessageKey, WebKit::vectorToXPCData(encoder.takeBuffer()).get());
-    xpc_dictionary_set_uint64(dictionary.get(), WebKit::WebPushD::protocolMessageTypeKey, static_cast<uint64_t>(WebKit::WebPushD::MessageType::InjectPushMessageForTesting));
-
-    xpc_connection_send_message_with_reply(m_connection.get(), dictionary.get(), dispatch_get_main_queue(), ^(xpc_object_t resultMessage) {
-        // This reply handler intentionally left blank
-    });
-}
-
</del><span class="cx"> void Connection::startDebugStreamAction()
</span><span class="cx"> {
</span><span class="cx">     auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
</span></span></pre></div>
<a id="trunkSourceWebKitwebpushdwebpushtoolWebPushToolMainmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm      2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm 2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -24,14 +24,11 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #import "config.h"
</span><del>-#import "PushMessageForTesting.h"
</del><span class="cx"> #import "WebPushToolConnection.h"
</span><span class="cx"> #import <Foundation/Foundation.h>
</span><span class="cx"> #import <optional>
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> 
</span><del>-using WebKit::WebPushD::PushMessageForTesting;
-
</del><span class="cx"> __attribute__((__noreturn__))
</span><span class="cx"> static void printUsageAndTerminate(NSString *message)
</span><span class="cx"> {
</span><span class="lines">@@ -39,43 +36,15 @@
</span><span class="cx"> 
</span><span class="cx">     fprintf(stderr, "Usage: webpushtool [options]\n");
</span><span class="cx">     fprintf(stderr, "\n");
</span><del>-    fprintf(stderr, "  --development\n");
-    fprintf(stderr, "    Connects to mach service \"org.webkit.webpushtestdaemon.service\" (Default)\n");
-    fprintf(stderr, "  --production\n");
-    fprintf(stderr, "    Connects to mach service \"com.apple.webkit.webpushd.service\"\n");
-    fprintf(stderr, "  --streamDebugMessages\n");
-    fprintf(stderr, "    Stream debug messages from webpushd\n");
-    fprintf(stderr, "  --reconnect\n");
-    fprintf(stderr, "    Reconnect after connection is lost\n");
-    fprintf(stderr, "  --push <target app identifier> <registration URL> <message>\n");
-    fprintf(stderr, "    Inject a test push messasge to the target app and registration URL\n");
</del><ins>+    fprintf(stderr, "  --development              Connects to mach service \"org.webkit.webpushtestdaemon.service\" (Default)\n");
+    fprintf(stderr, "  --production               Connects to mach service \"com.apple.webkit.webpushd.service\"\n");
+    fprintf(stderr, "  --streamDebugMessages      Stream debug messages from webpushd\n");
+    fprintf(stderr, "  --reconnect                Reconnect after connection is lost\n");
</ins><span class="cx">     fprintf(stderr, "\n");
</span><span class="cx"> 
</span><span class="cx">     exit(-1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static std::unique_ptr<PushMessageForTesting> pushMessageFromArguments(NSEnumerator<NSString *> *enumerator)
-{
-    NSString *appIdentifier = [enumerator nextObject];
-    if (!appIdentifier)
-        return nullptr;
-
-    NSString *registrationString = [enumerator nextObject];
-    if (!registrationString)
-        return nullptr;
-
-    NSURL *registrationURL = [NSURL URLWithString:registrationString];
-    if (!registrationURL)
-        return nullptr;
-
-    NSString *message = [enumerator nextObject];
-    if (!message)
-        return nullptr;
-
-    PushMessageForTesting pushMessage = { appIdentifier, registrationURL, message };
-    return makeUniqueWithoutFastMallocCheck<PushMessageForTesting>(WTFMove(pushMessage));
-}
-
</del><span class="cx"> int main(int, const char **)
</span><span class="cx"> {
</span><span class="cx">     WTF::initializeMainThread();
</span><span class="lines">@@ -83,7 +52,6 @@
</span><span class="cx">     auto preferTestService = WebPushTool::PreferTestService::Yes;
</span><span class="cx">     auto reconnect = WebPushTool::Reconnect::No;
</span><span class="cx">     std::optional<WebPushTool::Action> action;
</span><del>-    std::unique_ptr<PushMessageForTesting> pushMessage;
</del><span class="cx"> 
</span><span class="cx">     @autoreleasepool {
</span><span class="cx">         NSArray *arguments = [[NSProcessInfo processInfo] arguments];
</span><span class="lines">@@ -90,9 +58,7 @@
</span><span class="cx">         if (arguments.count == 1)
</span><span class="cx">             printUsageAndTerminate(@"No arguments provided");
</span><span class="cx"> 
</span><del>-        NSEnumerator<NSString *> *enumerator = [[arguments subarrayWithRange:NSMakeRange(1, arguments.count - 1)] objectEnumerator];
-        NSString *argument = [enumerator nextObject];
-        while (argument) {
</del><ins>+        for (NSString *argument in [arguments subarrayWithRange:NSMakeRange(1, arguments.count - 1)]) {
</ins><span class="cx">             if ([argument isEqualToString:@"--production"])
</span><span class="cx">                 preferTestService = WebPushTool::PreferTestService::No;
</span><span class="cx">             else if ([argument isEqualToString:@"--development"])
</span><span class="lines">@@ -101,24 +67,15 @@
</span><span class="cx">                 action = WebPushTool::Action::StreamDebugMessages;
</span><span class="cx">             else if ([argument isEqualToString:@"--reconnect"])
</span><span class="cx">                 reconnect = WebPushTool::Reconnect::Yes;
</span><del>-            else if ([argument isEqualToString:@"--push"]) {
-                pushMessage = pushMessageFromArguments(enumerator);
-                if (!pushMessage)
-                    printUsageAndTerminate([NSString stringWithFormat:@"Invalid push arguments specified"]);
-            } else
</del><ins>+            else
</ins><span class="cx">                 printUsageAndTerminate([NSString stringWithFormat:@"Invalid option provided: %@", argument]);
</span><del>-
-            argument = [enumerator nextObject];
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!action && !pushMessage)
</del><ins>+    if (!action)
</ins><span class="cx">         printUsageAndTerminate(@"No action provided");
</span><span class="cx"> 
</span><span class="cx">     auto connection = WebPushTool::Connection::create(*action, preferTestService, reconnect);
</span><del>-    if (pushMessage)
-        connection->setPushMessage(WTFMove(pushMessage));
-
</del><span class="cx">     connection->connectToService();
</span><span class="cx"> 
</span><span class="cx">     CFRunLoopRun();
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/ChangeLog       2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2021-12-09  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r286764.
+        https://bugs.webkit.org/show_bug.cgi?id=234081
+
+        broke the build
+
+        Reverted changeset:
+
+        "Add ability to inject messages into webpushd"
+        https://bugs.webkit.org/show_bug.cgi?id=233988
+        https://commits.webkit.org/r286764
+
</ins><span class="cx"> 2021-12-09  Myles C. Maxfield  <mmaxfield@apple.com> and Don Olmstead  <don.olmstead@sony.com>
</span><span class="cx"> 
</span><span class="cx">         Move TextCodec files from WebCore/platform/text to WebCore/PAL/text
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIConfigurationsTestWebKitAPIiOSentitlements"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements  2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-iOS.entitlements     2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -12,8 +12,6 @@
</span><span class="cx">  <true/>
</span><span class="cx">  <key>com.apple.private.webkit.webpush</key>
</span><span class="cx">  <true/>
</span><del>-       <key>com.apple.private.webkit.webpush.inject</key>
-       <true/>
</del><span class="cx">   <key>com.apple.private.xpc.launchd.job-manager</key>
</span><span class="cx">  <string>TestWebKitAPI</string>
</span><span class="cx"> </dict>
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIConfigurationsTestWebKitAPImacOSinternalentitlements"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements       2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS-internal.entitlements  2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -6,8 +6,6 @@
</span><span class="cx">  <string>TestWebKitAPI</string>
</span><span class="cx">  <key>com.apple.private.webkit.webpush</key>
</span><span class="cx">  <true/>
</span><del>-       <key>com.apple.private.webkit.webpush.inject</key>
-       <true/>
</del><span class="cx">   <key>com.apple.hid.manager.user-access-device</key>
</span><span class="cx">  <true/>
</span><span class="cx">  <key>com.apple.private.hid.client.event-filter</key>
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIConfigurationsTestWebKitAPImacOSentitlements"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS.entitlements (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS.entitlements        2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI-macOS.entitlements   2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -10,8 +10,6 @@
</span><span class="cx">  </array>
</span><span class="cx">  <key>com.apple.private.webkit.webpush</key>
</span><span class="cx">  <true/>
</span><del>-       <key>com.apple.private.webkit.webpush.inject</key>
-       <true/>
</del><span class="cx">   <key>com.apple.security.temporary-exception.sbpl</key>
</span><span class="cx">  <array>
</span><span class="cx">          <string>(allow mach-issue-extension (require-all (extension-class &quot;com.apple.webkit.extension.mach&quot;)))</string>
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaPushAPImm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm   2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm      2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -34,14 +34,6 @@
</span><span class="cx"> #import <WebKit/WKWebsiteDataStorePrivate.h>
</span><span class="cx"> #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
</span><span class="cx"> 
</span><del>-static NSDictionary *messageDictionary(NSData *data, NSURL *registration)
-{
-    return @{
-        @"WebKitPushData" : data,
-        @"WebKitPushRegistrationURL" : registration
-    };
-}
-
</del><span class="cx"> static String expectedMessage;
</span><span class="cx"> 
</span><span class="cx"> @interface PushAPIMessageHandlerWithExpectedMessage : NSObject <WKScriptMessageHandler>
</span><span class="lines">@@ -154,8 +146,7 @@
</span><span class="cx">     pushMessageSuccessful = false;
</span><span class="cx">     NSString *message = @"Sweet Potatoes";
</span><span class="cx">     expectedMessage = "Received: Sweet Potatoes";
</span><del>-
-    [[configuration websiteDataStore] _processPushMessage:messageDictionary([message dataUsingEncoding:NSUTF8StringEncoding], [server.request() URL]) completionHandler:^(bool result) {
</del><ins>+    [[configuration websiteDataStore] _processPushMessage:[message dataUsingEncoding:NSUTF8StringEncoding] registration:[server.request() URL] completionHandler:^(bool result) {
</ins><span class="cx">         pushMessageSuccessful = result;
</span><span class="cx">         pushMessageProcessed = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -169,7 +160,7 @@
</span><span class="cx">     pushMessageSuccessful = false;
</span><span class="cx">     message = @"Rotten Potatoes";
</span><span class="cx">     expectedMessage = "Received: Rotten Potatoes";
</span><del>-    [[configuration websiteDataStore] _processPushMessage:messageDictionary([message dataUsingEncoding:NSUTF8StringEncoding], [server.request() URL]) completionHandler:^(bool result) {
</del><ins>+    [[configuration websiteDataStore] _processPushMessage:[message dataUsingEncoding:NSUTF8StringEncoding] registration:[server.request() URL] completionHandler:^(bool result) {
</ins><span class="cx">         pushMessageSuccessful = result;
</span><span class="cx">         pushMessageProcessed = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -243,7 +234,7 @@
</span><span class="cx">     pushMessageProcessed = false;
</span><span class="cx">     pushMessageSuccessful = false;
</span><span class="cx">     NSString *message = @"Sweet Potatoes";
</span><del>-    [[configuration websiteDataStore] _processPushMessage:messageDictionary([message dataUsingEncoding:NSUTF8StringEncoding], [server.request() URL]) completionHandler:^(bool result) {
</del><ins>+    [[configuration websiteDataStore] _processPushMessage:[message dataUsingEncoding:NSUTF8StringEncoding] registration:[server.request() URL] completionHandler:^(bool result) {
</ins><span class="cx">         pushMessageSuccessful = result;
</span><span class="cx">         pushMessageProcessed = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -288,7 +279,7 @@
</span><span class="cx">     pushMessageProcessed = false;
</span><span class="cx">     pushMessageSuccessful = false;
</span><span class="cx">     NSString *message = @"Rotten Potatoes";
</span><del>-    [[configuration websiteDataStore] _processPushMessage:messageDictionary([message dataUsingEncoding:NSUTF8StringEncoding], [server.request() URL]) completionHandler:^(bool result) {
</del><ins>+    [[configuration websiteDataStore] _processPushMessage:[message dataUsingEncoding:NSUTF8StringEncoding] registration:[server.request() URL] completionHandler:^(bool result) {
</ins><span class="cx">         pushMessageSuccessful = result;
</span><span class="cx">         pushMessageProcessed = true;
</span><span class="cx">     }];
</span><span class="lines">@@ -341,7 +332,7 @@
</span><span class="cx">     pushMessageProcessed = false;
</span><span class="cx">     pushMessageSuccessful = false;
</span><span class="cx">     NSString *message = @"Timeless Potatoes";
</span><del>-    [[configuration websiteDataStore] _processPushMessage:messageDictionary([message dataUsingEncoding:NSUTF8StringEncoding], [server.request() URL]) completionHandler:^(bool result) {
</del><ins>+    [[configuration websiteDataStore] _processPushMessage:[message dataUsingEncoding:NSUTF8StringEncoding] registration:[server.request() URL] completionHandler:^(bool result) {
</ins><span class="cx">         pushMessageSuccessful = result;
</span><span class="cx">         pushMessageProcessed = true;
</span><span class="cx">     }];
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaWebPushDaemonmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm     2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm        2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> 
</span><span class="cx"> #import "DaemonTestUtilities.h"
</span><del>-#import "HTTPServer.h"
</del><span class="cx"> #import "Test.h"
</span><span class="cx"> #import "TestURLSchemeHandler.h"
</span><span class="cx"> #import "TestWKWebView.h"
</span><span class="lines">@@ -36,6 +35,7 @@
</span><span class="cx"> #import <WebKit/WKWebsiteDataStorePrivate.h>
</span><span class="cx"> #import <WebKit/_WKExperimentalFeature.h>
</span><span class="cx"> #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
</span><ins>+#import <array>
</ins><span class="cx"> #import <mach/mach_init.h>
</span><span class="cx"> #import <mach/task.h>
</span><span class="cx"> 
</span><span class="lines">@@ -162,85 +162,6 @@
</span><span class="cx">     EXPECT_NULL(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RetainPtr<xpc_object_t> createMessageDictionary(uint8_t messageType, const Vector<uint8_t>& message)
-{
-    auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
-    xpc_dictionary_set_uint64(dictionary.get(), "protocol version", 1);
-    xpc_dictionary_set_uint64(dictionary.get(), "message type", messageType);
-    xpc_dictionary_set_data(dictionary.get(), "encoded message", message.data(), message.size());
-    return WTFMove(dictionary);
-}
-
-// Uses an existing connection to the daemon for a one-off message
-void sendMessageToDaemon(xpc_connection_t connection, uint8_t messageType, const Vector<uint8_t>& message)
-{
-    auto dictionary = createMessageDictionary(messageType, message);
-    xpc_connection_send_message(connection, dictionary.get());
-}
-
-// Uses an existing connection to the daemon for a one-off message, waiting for the reply
-void sendMessageToDaemonWaitingForReply(xpc_connection_t connection, uint8_t messageType, const Vector<uint8_t>& message)
-{
-    auto dictionary = createMessageDictionary(messageType, message);
-
-    __block bool done = false;
-    xpc_connection_send_message_with_reply(connection, dictionary.get(), dispatch_get_main_queue(), ^(xpc_object_t request) {
-        done = true;
-    });
-
-    TestWebKitAPI::Util::run(&done);
-}
-
-static void sendConfigurationWithAuditToken(xpc_connection_t connection)
-{
-    audit_token_t token = { 0, 0, 0, 0, 0, 0, 0, 0 };
-    mach_msg_type_number_t auditTokenCount = TASK_AUDIT_TOKEN_COUNT;
-    kern_return_t result = task_info(mach_task_self(), TASK_AUDIT_TOKEN, (task_info_t)(&token), &auditTokenCount);
-    if (result != KERN_SUCCESS) {
-        EXPECT_TRUE(false);
-        return;
-    }
-
-    // Send configuration with audit token
-    {
-        Vector<uint8_t> encodedMessage(42);
-        encodedMessage.fill(0);
-        encodedMessage[1] = 1;
-        encodedMessage[2] = 32;
-        memcpy(&encodedMessage[10], &token, sizeof(token));
-        sendMessageToDaemon(connection, 6, encodedMessage);
-    }
-}
-
-RetainPtr<xpc_connection_t> createAndConfigureConnectionToService(const char* serviceName)
-{
-    auto connection = adoptNS(xpc_connection_create_mach_service(serviceName, dispatch_get_main_queue(), 0));
-    xpc_connection_set_event_handler(connection.get(), ^(xpc_object_t) { });
-    xpc_connection_activate(connection.get());
-    sendConfigurationWithAuditToken(connection.get());
-
-    return WTFMove(connection);
-}
-
-static Vector<uint8_t> encodeString(const String& message)
-{
-    ASSERT(message.is8Bit());
-    auto utf8 = message.utf8();
-
-    Vector<uint8_t> result(utf8.length() + 5);
-    result[0] = static_cast<uint8_t>(utf8.length());
-    result[1] = static_cast<uint8_t>(utf8.length() >> 8);
-    result[2] = static_cast<uint8_t>(utf8.length() >> 16);
-    result[3] = static_cast<uint8_t>(utf8.length() >> 24);
-    result[4] = 0x01;
-
-    auto data = utf8.data();
-    for (size_t i = 0; i < utf8.length(); ++i)
-        result[5 + i] = data[i];
-
-    return result;
-}
-
</del><span class="cx"> // FIXME: Re-enable this test on Mac once webkit.org/232857 is resolved.
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> TEST(WebPushD, DISABLED_BasicCommunication)
</span><span class="lines">@@ -275,20 +196,44 @@
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     xpc_connection_activate(connection.get());
</span><del>-    sendConfigurationWithAuditToken(connection.get());
</del><span class="cx"> 
</span><ins>+    audit_token_t token = { 0, 0, 0, 0, 0, 0, 0, 0 };
+    mach_msg_type_number_t auditTokenCount = TASK_AUDIT_TOKEN_COUNT;
+    kern_return_t result = task_info(mach_task_self(), TASK_AUDIT_TOKEN, (task_info_t)(&token), &auditTokenCount);
+    if (result != KERN_SUCCESS) {
+        EXPECT_TRUE(false);
+        return;
+    }
+
+    // Send configuration with audit token
+    {
+        std::array<uint8_t, 42> encodedMessage;
+        encodedMessage.fill(0);
+        encodedMessage[1] = 1;
+        encodedMessage[2] = 32;
+        memcpy(&encodedMessage[10], &token, sizeof(token));
+        auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
+        xpc_dictionary_set_uint64(dictionary.get(), "protocol version", 1);
+        xpc_dictionary_set_uint64(dictionary.get(), "message type", 6);
+        xpc_dictionary_set_data(dictionary.get(), "encoded message", encodedMessage.data(), encodedMessage.size());
+        xpc_connection_send_message(connection.get(), dictionary.get());
+    }
+
</ins><span class="cx">     // Enable debug messages, and wait for the resulting debug message
</span><span class="cx">     {
</span><span class="cx">         auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
</span><del>-        Vector<uint8_t> encodedMessage(1);
-        encodedMessage[0] = 1;
-        sendMessageToDaemon(connection.get(), 5, encodedMessage);
</del><ins>+        std::array<uint8_t, 1> encodedMessage { 1 };
+        xpc_dictionary_set_uint64(dictionary.get(), "protocol version", 1);
+        xpc_dictionary_set_uint64(dictionary.get(), "message type", 5);
+        xpc_dictionary_set_data(dictionary.get(), "encoded message", encodedMessage.data(), encodedMessage.size());
+
+        xpc_connection_send_message(connection.get(), dictionary.get());
</ins><span class="cx">         TestWebKitAPI::Util::run(&done);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Echo and wait for a reply
</span><span class="cx">     auto dictionary = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
</span><del>-    auto encodedString = encodeString("hello");
</del><ins>+    std::array<uint8_t, 10> encodedString { 5, 0, 0, 0, 1, 'h', 'e', 'l', 'l', 'o' };
</ins><span class="cx">     xpc_dictionary_set_uint64(dictionary.get(), "protocol version", 1);
</span><span class="cx">     xpc_dictionary_set_uint64(dictionary.get(), "message type", 1);
</span><span class="cx">     xpc_dictionary_set_data(dictionary.get(), "encoded message", encodedString.data(), encodedString.size());
</span><span class="lines">@@ -396,140 +341,6 @@
</span><span class="cx">     cleanUpTestWebPushD(tempDirectory);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const char* mainSWBytes = R"SWRESOURCE(
-<script>
-function log(msg)
-{
-    window.webkit.messageHandlers.sw.postMessage(msg);
-}
-
-const channel = new MessageChannel();
-channel.port1.onmessage = (event) => log(event.data);
-
-navigator.serviceWorker.register('/sw.js').then((registration) => {
-    if (registration.active) {
-        registration.active.postMessage({port: channel.port2}, [channel.port2]);
-        return;
-    }
-    worker = registration.installing;
-    worker.addEventListener('statechange', function() {
-        if (worker.state == 'activated')
-            worker.postMessage({port: channel.port2}, [channel.port2]);
-    });
-}).catch(function(error) {
-    log("Registration failed with: " + error);
-});
-</script>
-)SWRESOURCE";
-
-static const char* scriptBytes = R"SWRESOURCE(
-let port;
-self.addEventListener("message", (event) => {
-    port = event.data.port;
-    port.postMessage("Ready");
-});
-self.addEventListener("push", (event) => {
-    try {
-        if (!event.data) {
-            port.postMessage("Received: null data");
-            return;
-        }
-        const value = event.data.text();
-        port.postMessage("Received: " + value);
-        if (value != 'Sweet Potatoes')
-            event.waitUntil(Promise.reject('I want sweet potatoes'));
-    } catch (e) {
-        port.postMessage("Got exception " + e);
-    }
-});
-)SWRESOURCE";
-
-static void clearWebsiteDataStore(WKWebsiteDataStore *store)
-{
-    __block bool clearedStore = false;
-    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
-        clearedStore = true;
-    }];
-    TestWebKitAPI::Util::run(&clearedStore);
-}
-
-// FIXME: Re-enable this test on Mac once webkit.org/232857 is resolved.
-#if PLATFORM(MAC)
-TEST(WebPushD, DISABLED_HandleInjectedPush)
-#else
-TEST(WebPushD, HandleInjectedPush)
-#endif
-{
-    [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins];
-
-    NSURL *tempDirectory = setUpTestWebPushD();
-
-    auto dataStoreConfiguration = adoptNS([_WKWebsiteDataStoreConfiguration new]);
-    dataStoreConfiguration.get().webPushMachServiceName = @"org.webkit.webpushtestdaemon.service";
-    dataStoreConfiguration.get().webPushDaemonUsesMockBundlesForTesting = YES;
-    auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]);
-
-    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    configuration.get().websiteDataStore = dataStore.get();
-    clearWebsiteDataStore([configuration websiteDataStore]);
-
-    [configuration.get().preferences _setNotificationsEnabled:YES];
-    for (_WKExperimentalFeature *feature in [WKPreferences _experimentalFeatures]) {
-        if ([feature.key isEqualToString:@"BuiltInNotificationsEnabled"])
-            [[configuration preferences] _setEnabled:YES forFeature:feature];
-    }
-
-    auto messageHandler = adoptNS([[TestMessageHandler alloc] init]);
-    [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"];
-    __block bool done = false;
-    [messageHandler addMessage:@"Ready" withHandler:^{
-        done = true;
-    }];
-    [messageHandler addMessage:@"Received: Hello World" withHandler:^{
-        done = true;
-    }];
-
-    TestWebKitAPI::HTTPServer server({
-        { "/", { mainSWBytes } },
-        { "/sw.js", { { { "Content-Type", "application/javascript" } }, scriptBytes } }
-    }, TestWebKitAPI::HTTPServer::Protocol::Http);
-
-    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
-    [webView loadRequest:server.request()];
-
-    TestWebKitAPI::Util::run(&done);
-    done = false;
-
-    // Inject push message
-    auto encodedMessage = encodeString("com.apple.WebKit.TestWebKitAPI");
-    encodedMessage.appendVector(encodeString(server.request().URL.absoluteString));
-    encodedMessage.appendVector(encodeString("Hello World"));
-
-    auto utilityConnection = createAndConfigureConnectionToService("org.webkit.webpushtestdaemon.service");
-    sendMessageToDaemonWaitingForReply(utilityConnection.get(), 7, encodedMessage);
-
-    // Fetch push messages
-    __block RetainPtr<NSArray<NSDictionary *>> messages;
-    [dataStore _getPendingPushMessages:^(NSArray<NSDictionary *> *rawMessages) {
-        messages = rawMessages;
-        done = true;
-    }];
-    TestWebKitAPI::Util::run(&done);
-    done = false;
-
-    EXPECT_EQ([messages count], 1u);
-
-    // Handle push message
-    __block bool pushMessageProcessed = false;
-    [dataStore _processPushMessage:[messages firstObject] completionHandler:^(bool result) {
-        pushMessageProcessed = true;
-    }];
-    TestWebKitAPI::Util::run(&done);
-    TestWebKitAPI::Util::run(&pushMessageProcessed);
-
-    cleanUpTestWebPushD(tempDirectory);
-}
-
</del><span class="cx"> } // namespace TestWebKitAPI
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC) || PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaTestWKWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (286776 => 286777)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h  2021-12-09 14:03:45 UTC (rev 286776)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h     2021-12-09 14:46:27 UTC (rev 286777)
</span><span class="lines">@@ -78,7 +78,6 @@
</span><span class="cx"> 
</span><span class="cx"> @interface TestMessageHandler : NSObject <WKScriptMessageHandler>
</span><span class="cx"> - (void)addMessage:(NSString *)message withHandler:(dispatch_block_t)handler;
</span><del>-- (void)setWildcardMessageHandler:(void (^)(NSString *))handler;
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface TestWKWebView : WKWebView
</span></span></pre>
</div>
</div>

</body>
</html>