Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (287008 => 287009)
--- trunk/Source/_javascript_Core/ChangeLog 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-12-14 04:23:27 UTC (rev 287009)
@@ -1,3 +1,15 @@
+2021-12-13 Brady Eidson <beid...@apple.com>
+
+ Teach webpushtool to register and "host" the daemon.
+ https://bugs.webkit.org/show_bug.cgi?id=234265
+
+ Reviewed by Tim Horton.
+
+ * inspector/ConsoleMessage.h: Remove `using JSC::MessageType` because it makes it hard for others
+ to also have a `MessageType` type.
+ * inspector/JSGlobalObjectConsoleClient.h:
+ * runtime/ConsoleTypes.h:
+
2021-12-13 Saam Barati <sbar...@apple.com>
Roll back r286345, r286387, r286471, r286667, r286849
Modified: trunk/Source/_javascript_Core/inspector/ConsoleMessage.h (287008 => 287009)
--- trunk/Source/_javascript_Core/inspector/ConsoleMessage.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/_javascript_Core/inspector/ConsoleMessage.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -43,6 +43,8 @@
class JSGlobalObject;
}
+using JSC::MessageType;
+
namespace Inspector {
class ConsoleFrontendDispatcher;
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h (287008 => 287009)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -29,6 +29,8 @@
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
+using JSC::MessageType;
+
namespace Inspector {
class InspectorConsoleAgent;
Modified: trunk/Source/_javascript_Core/runtime/ConsoleTypes.h (287008 => 287009)
--- trunk/Source/_javascript_Core/runtime/ConsoleTypes.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/_javascript_Core/runtime/ConsoleTypes.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -115,5 +115,4 @@
} // namespace WTF
using JSC::MessageSource;
-using JSC::MessageType;
using JSC::MessageLevel;
Modified: trunk/Source/WebCore/ChangeLog (287008 => 287009)
--- trunk/Source/WebCore/ChangeLog 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebCore/ChangeLog 2021-12-14 04:23:27 UTC (rev 287009)
@@ -1,3 +1,12 @@
+2021-12-13 Brady Eidson <beid...@apple.com>
+
+ Teach webpushtool to register and "host" the daemon.
+ https://bugs.webkit.org/show_bug.cgi?id=234265
+
+ Reviewed by Tim Horton.
+
+ * page/PageConsoleClient.h:
+
2021-12-13 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r286993.
Modified: trunk/Source/WebCore/page/PageConsoleClient.h (287008 => 287009)
--- trunk/Source/WebCore/page/PageConsoleClient.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebCore/page/PageConsoleClient.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -40,6 +40,8 @@
class CallFrame;
}
+using JSC::MessageType;
+
namespace WebCore {
class Document;
Modified: trunk/Source/WebKit/ChangeLog (287008 => 287009)
--- trunk/Source/WebKit/ChangeLog 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/ChangeLog 2021-12-14 04:23:27 UTC (rev 287009)
@@ -1,3 +1,45 @@
+2021-12-13 Brady Eidson <beid...@apple.com>
+
+ Teach webpushtool to register and "host" the daemon.
+ https://bugs.webkit.org/show_bug.cgi?id=234265
+
+ Reviewed by Tim Horton.
+
+ Covered by API tests verifying hosting mode operation.
+
+ As various engineers work on various parts of the project, it's become apparent that it's super useful
+ to have a tool handle the "setting up" of the daemon itself, to avoid launchctl, etc.
+
+ Implement that, as well as a few other niceties found while testing.
+
+ * Configurations/webpushtool.xcconfig:
+ * Resources/webpushtool.entitlements:
+
+ * Shared/Daemon/DaemonUtilities.mm:
+ (WebKit::startListeningForMachServiceConnections):
+
+ * webpushd/AppBundleRequest.mm:
+ (WebPushD::AppBundleRequest::start):
+
+ * webpushd/PushClientConnection.h:
+ * webpushd/PushClientConnection.mm:
+ (WebPushD::ClientConnection::setHostAppAuditTokenData):
+ (WebPushD::ClientConnection::broadcastDebugMessage):
+
+ * webpushd/WebPushDaemon.h:
+ * webpushd/WebPushDaemon.mm:
+ (WebPushD::Daemon::broadcastAllConnectionIdentities):
+
+ * webpushd/webpushtool/WebPushToolConnection.h:
+ * webpushd/webpushtool/WebPushToolConnection.mm:
+ (WebPushTool::Connection::connectToService):
+ (WebPushTool::Connection::connectionDropped):
+
+ * webpushd/webpushtool/WebPushToolMain.mm:
+ (printUsageAndTerminate):
+ (registerDaemonWithLaunchD):
+ (main):
+
2021-12-13 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r286993.
Modified: trunk/Source/WebKit/Configurations/webpushtool.xcconfig (287008 => 287009)
--- trunk/Source/WebKit/Configurations/webpushtool.xcconfig 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/Configurations/webpushtool.xcconfig 2021-12-14 04:23:27 UTC (rev 287009)
@@ -29,7 +29,14 @@
EXCLUDED_SOURCE_FILE_NAMES[sdk=appletv*] = *;
EXCLUDED_SOURCE_FILE_NAMES[sdk=watch*] = *;
-OTHER_LDFLAGS = -framework Foundation -framework CoreFoundation -framework WebKit -framework _javascript_Core
+WK_APPSERVERSUPPORT_LDFLAGS = $(WK_APPSERVERSUPPORT_LDFLAGS_$(WK_PLATFORM_NAME));
+WK_APPSERVERSUPPORT_LDFLAGS_macosx = $(WK_APPSERVERSUPPORT_LDFLAGS$(WK_MACOS_1200));
+WK_APPSERVERSUPPORT_LDFLAGS_MACOS_SINCE_1200 = -framework AppServerSupport
+WK_APPSERVERSUPPORT_LDFLAGS_iphoneos = $(WK_APPSERVERSUPPORT_LDFLAGS$(WK_IOS_15));
+WK_APPSERVERSUPPORT_LDFLAGS_iphonesimulator = $(WK_APPSERVERSUPPORT_LDFLAGS$(WK_IOS_15));
+WK_APPSERVERSUPPORT_LDFLAGS_IOS_SINCE_15 = -framework AppServerSupport
+
+OTHER_LDFLAGS = -framework Foundation -framework CoreFoundation -framework WebKit -framework _javascript_Core $(WK_APPSERVERSUPPORT_LDFLAGS)
LIBRARY_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR);
CODE_SIGN_ENTITLEMENTS = Resources/webpushtool.entitlements;
Modified: trunk/Source/WebKit/Resources/webpushtool.entitlements (287008 => 287009)
--- trunk/Source/WebKit/Resources/webpushtool.entitlements 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/Resources/webpushtool.entitlements 2021-12-14 04:23:27 UTC (rev 287009)
@@ -6,5 +6,7 @@
<true/>
<key>com.apple.private.webkit.webpush.inject</key>
<true/>
+ <key>com.apple.private.xpc.launchd.job-manager</key>
+ <string>webpushtool</string>
</dict>
</plist>
Modified: trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm (287008 => 287009)
--- trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/Shared/Daemon/DaemonUtilities.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -54,6 +54,9 @@
#else
NSLog(@"Failed to start listening for connections to mach service %s, likely because it is not registered with launchd", serviceName);
#endif
+ NSLog(@"Removing peer connection %p", peer);
+ connectionRemoved(peer);
+ return;
}
if (event == XPC_ERROR_CONNECTION_INTERRUPTED) {
NSLog(@"Removing peer connection %p", peer);
Modified: trunk/Source/WebKit/webpushd/AppBundleRequest.mm (287008 => 287009)
--- trunk/Source/WebKit/webpushd/AppBundleRequest.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/AppBundleRequest.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -53,8 +53,10 @@
if (m_connection->useMockBundlesForTesting())
m_appBundle = MockAppBundleForTesting::create(m_originString, m_connection->hostAppCodeSigningIdentifier(), *this);
- else
+ else {
+ m_connection->broadcastDebugMessage("Client is trying to initiate app bundle request without having configured mock app bundles for testing. About to crash...");
RELEASE_ASSERT_NOT_REACHED();
+ }
startInternal();
}
Modified: trunk/Source/WebKit/webpushd/PushClientConnection.h (287008 => 287009)
--- trunk/Source/WebKit/webpushd/PushClientConnection.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/PushClientConnection.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -28,6 +28,7 @@
#include <optional>
#include <wtf/Deque.h>
#include <wtf/Forward.h>
+#include <wtf/Identified.h>
#include <wtf/OSObjectPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/WeakPtr.h>
@@ -45,7 +46,7 @@
class AppBundleRequest;
-class ClientConnection : public RefCounted<ClientConnection>, public CanMakeWeakPtr<ClientConnection> {
+class ClientConnection : public RefCounted<ClientConnection>, public CanMakeWeakPtr<ClientConnection>, public Identified<ClientConnection> {
WTF_MAKE_FAST_ALLOCATED;
public:
static Ref<ClientConnection> create(xpc_connection_t);
Modified: trunk/Source/WebKit/webpushd/PushClientConnection.mm (287008 => 287009)
--- trunk/Source/WebKit/webpushd/PushClientConnection.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/PushClientConnection.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -73,6 +73,7 @@
}
m_hostAppAuditToken = WTFMove(token);
+ Daemon::singleton().broadcastAllConnectionIdentities();
}
const String& ClientConnection::hostAppCodeSigningIdentifier()
@@ -121,9 +122,9 @@
String messageIdentifier;
auto signingIdentifer = hostAppCodeSigningIdentifier();
if (signingIdentifer.isEmpty())
- messageIdentifier = makeString("[(0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
+ messageIdentifier = makeString("[(0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ") (", String::number(identifier()), " )] ");
else
- messageIdentifier = makeString("[", signingIdentifer, " (0x", hex(reinterpret_cast<uint64_t>(m_xpcConnection.get()), WTF::HexConversionMode::Lowercase), ")] ");
+ messageIdentifier = makeString("[", signingIdentifer, " (", String::number(identifier()), ")] ");
Daemon::singleton().broadcastDebugMessage(JSC::MessageLevel::Info, makeString(messageIdentifier, message));
}
Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.h (287008 => 287009)
--- trunk/Source/WebKit/webpushd/WebPushDaemon.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -70,6 +70,7 @@
void getPendingPushMessages(ClientConnection*, CompletionHandler<void(const Vector<WebKit::WebPushMessage>&)>&& replySender);
void broadcastDebugMessage(JSC::MessageLevel, const String&);
+ void broadcastAllConnectionIdentities();
private:
Daemon() = default;
Modified: trunk/Source/WebKit/webpushd/WebPushDaemon.mm (287008 => 287009)
--- trunk/Source/WebKit/webpushd/WebPushDaemon.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/WebPushDaemon.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -185,6 +185,14 @@
}
}
+void Daemon::broadcastAllConnectionIdentities()
+{
+ broadcastDebugMessage((JSC::MessageLevel)4, "===\nCurrent connections:");
+ for (auto& iterator : m_connectionMap)
+ iterator.value->broadcastDebugMessage("");
+ broadcastDebugMessage((JSC::MessageLevel)4, "===");
+}
+
void Daemon::connectionEventHandler(xpc_object_t request)
{
if (xpc_get_type(request) != XPC_TYPE_DICTIONARY)
Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h (287008 => 287009)
--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h 2021-12-14 04:23:27 UTC (rev 287009)
@@ -41,13 +41,18 @@
};
enum class PreferTestService : bool {
+ No,
Yes,
- No,
};
enum class Reconnect : bool {
+ No,
Yes,
+};
+
+enum class WaitForServiceToExist : bool {
No,
+ Yes,
};
class Connection : public CanMakeWeakPtr<Connection> {
@@ -56,7 +61,7 @@
static std::unique_ptr<Connection> create(Action, PreferTestService, Reconnect);
Connection(Action, PreferTestService, Reconnect);
- void connectToService();
+ void connectToService(WaitForServiceToExist);
void setPushMessage(std::unique_ptr<PushMessageForTesting>&& message) { m_pushMessage = WTFMove(message); }
Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm (287008 => 287009)
--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -66,7 +66,7 @@
m_serviceName = "com.apple.webkit.webpushd.service";
}
-void Connection::connectToService()
+void Connection::connectToService(WaitForServiceToExist waitForServiceToExist)
{
if (m_connection)
return;
@@ -99,13 +99,15 @@
RELEASE_ASSERT_NOT_REACHED();
});
- auto result = maybeConnectToService(m_serviceName);
- if (result == MACH_PORT_NULL)
- printf("Waiting for service '%s' to be available\n", m_serviceName);
+ if (waitForServiceToExist == WaitForServiceToExist::Yes) {
+ auto result = maybeConnectToService(m_serviceName);
+ if (result == MACH_PORT_NULL)
+ printf("Waiting for service '%s' to be available\n", m_serviceName);
- while (result == MACH_PORT_NULL) {
- usleep(1000);
- result = maybeConnectToService(m_serviceName);
+ while (result == MACH_PORT_NULL) {
+ usleep(1000);
+ result = maybeConnectToService(m_serviceName);
+ }
}
xpc_connection_activate(m_connection.get());
@@ -184,7 +186,7 @@
if (m_reconnect) {
callOnMainRunLoop([this, weakThis = WeakPtr { this }] {
if (weakThis)
- connectToService();
+ connectToService(WaitForServiceToExist::Yes);
});
return;
}
Modified: trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm (287008 => 287009)
--- trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -43,6 +43,11 @@
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");
+#if HAVE(OS_LAUNCHD_JOB)
+ fprintf(stderr, " --host\n");
+ fprintf(stderr, " Dynamically registers the service with launchd so it is visible to other applications\n");
+ fprintf(stderr, " The service name of the registration depends on either the --development or --production option chosen\n");
+#endif
fprintf(stderr, " --streamDebugMessages\n");
fprintf(stderr, " Stream debug messages from webpushd\n");
fprintf(stderr, " --reconnect\n");
@@ -76,6 +81,63 @@
return makeUniqueWithoutFastMallocCheck<PushMessageForTesting>(WTFMove(pushMessage));
}
+#if HAVE(OS_LAUNCHD_JOB)
+static bool registerDaemonWithLaunchD(WebPushTool::PreferTestService preferTestService)
+{
+ // For now webpushtool only knows how to host webpushd when they're in the same directory
+ // e.g. the build directory of a WebKit contributor.
+ NSString *currentExecutablePath = [[NSBundle mainBundle] executablePath];
+ NSURL *currentExecutableDirectoryURL = [[NSURL fileURLWithPath:currentExecutablePath isDirectory:NO] URLByDeletingLastPathComponent];
+ NSURL *daemonExecutablePathURL = [currentExecutableDirectoryURL URLByAppendingPathComponent:@"webpushd"];
+
+ if (![[NSFileManager defaultManager] fileExistsAtPath:daemonExecutablePathURL.path]) {
+ NSLog(@"Daemon executable does not exist at path %@", daemonExecutablePathURL.path);
+ return false;
+ }
+
+ const char* serviceName = (preferTestService == WebPushTool::PreferTestService::Yes) ? "org.webkit.webpushtestdaemon.service" : "com.apple.webkit.webpushd.service";
+
+ auto plist = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
+ xpc_dictionary_set_string(plist.get(), "_ManagedBy", "webpushtool");
+ xpc_dictionary_set_string(plist.get(), "Label", "org.webkit.webpushtestdaemon");
+ xpc_dictionary_set_bool(plist.get(), "LaunchOnlyOnce", true);
+ xpc_dictionary_set_bool(plist.get(), "RootedSimulatorPath", true);
+
+ {
+ auto environmentVariables = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
+ xpc_dictionary_set_string(environmentVariables.get(), "DYLD_FRAMEWORK_PATH", currentExecutableDirectoryURL.fileSystemRepresentation);
+ xpc_dictionary_set_value(plist.get(), "EnvironmentVariables", environmentVariables.get());
+ }
+ {
+ auto machServices = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
+ xpc_dictionary_set_bool(machServices.get(), serviceName, true);
+ xpc_dictionary_set_value(plist.get(), "MachServices", machServices.get());
+ }
+ {
+ auto programArguments = adoptNS(xpc_array_create(nullptr, 0));
+#if PLATFORM(MAC)
+ xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, daemonExecutablePathURL.fileSystemRepresentation);
+#else
+ xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, daemonExecutablePathURL.path.fileSystemRepresentation);
+#endif
+ xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "--machServiceName");
+ xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, serviceName);
+ xpc_dictionary_set_value(plist.get(), "ProgramArguments", programArguments.get());
+ }
+
+ auto job = adoptNS([[OSLaunchdJob alloc] initWithPlist:plist.get()]);
+ NSError *error = nil;
+ [job submit:&error];
+
+ if (error) {
+ NSLog(@"Error setting up service: %@", error);
+ return false;
+ }
+
+ return true;
+}
+#endif // #if HAVE(OS_LAUNCHD_JOB)
+
int main(int, const char **)
{
WTF::initializeMainThread();
@@ -82,6 +144,7 @@
auto preferTestService = WebPushTool::PreferTestService::Yes;
auto reconnect = WebPushTool::Reconnect::No;
+ bool host = false;
std::optional<WebPushTool::Action> action;
std::unique_ptr<PushMessageForTesting> pushMessage;
@@ -101,6 +164,10 @@
action = ""
else if ([argument isEqualToString:@"--reconnect"])
reconnect = WebPushTool::Reconnect::Yes;
+#if HAVE(OS_LAUNCHD_JOB)
+ else if ([argument isEqualToString:@"--host"])
+ host = true;
+#endif
else if ([argument isEqualToString:@"--push"]) {
pushMessage = pushMessageFromArguments(enumerator);
if (!pushMessage)
@@ -115,11 +182,16 @@
if (!action && !pushMessage)
printUsageAndTerminate(@"No action provided");
+#if HAVE(OS_LAUNCHD_JOB)
+ if (host && !registerDaemonWithLaunchD(preferTestService))
+ printUsageAndTerminate(@"Unable to install plist to host the service");
+#endif
+
auto connection = WebPushTool::Connection::create(*action, preferTestService, reconnect);
if (pushMessage)
connection->setPushMessage(WTFMove(pushMessage));
- connection->connectToService();
+ connection->connectToService(host ? WebPushTool::WaitForServiceToExist::No : WebPushTool::WaitForServiceToExist::Yes);
CFRunLoopRun();
return 0;
Modified: trunk/Tools/ChangeLog (287008 => 287009)
--- trunk/Tools/ChangeLog 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Tools/ChangeLog 2021-12-14 04:23:27 UTC (rev 287009)
@@ -1,3 +1,16 @@
+2021-12-13 Brady Eidson <beid...@apple.com>
+
+ Teach webpushtool to register and "host" the daemon.
+ https://bugs.webkit.org/show_bug.cgi?id=234265
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
+ (TestWebKitAPI::shouldSetupWebPushD): Add a command line argument to skip the "install the daemon" step,
+ so an engineer can handle that part themselves.
+ (TestWebKitAPI::setUpTestWebPushD):
+ (TestWebKitAPI::cleanUpTestWebPushD):
+
2021-12-13 Christopher Reid <chris.r...@sony.com>
[Curl] Improve curl's cookie conformance in WPT
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (287008 => 287009)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm 2021-12-14 03:28:24 UTC (rev 287008)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm 2021-12-14 04:23:27 UTC (rev 287009)
@@ -125,8 +125,24 @@
#endif // HAVE(OS_LAUNCHD_JOB)
+static bool shouldSetupWebPushD()
+{
+ static bool shouldSetup = true;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSArray<NSString *> *arguments = [[NSProcessInfo processInfo] arguments];
+ if ([arguments containsObject:@"--no-webpushd"])
+ shouldSetup = false;
+ });
+
+ return shouldSetup;
+}
+
static NSURL *setUpTestWebPushD()
{
+ if (!shouldSetupWebPushD())
+ return nil;
+
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"WebPushDaemonTest"] isDirectory:YES];
NSError *error = nil;
@@ -148,6 +164,9 @@
static void cleanUpTestWebPushD(NSURL *tempDir)
{
+ if (!shouldSetupWebPushD())
+ return;
+
killFirstInstanceOfDaemon(@"webpushd");
if (![[NSFileManager defaultManager] fileExistsAtPath:tempDir.path])
@@ -242,7 +261,7 @@
}
// FIXME: Re-enable this test on Mac once webkit.org/232857 is resolved.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !USE(APPLE_INTERNAL_SDK)
TEST(WebPushD, DISABLED_BasicCommunication)
#else
TEST(WebPushD, BasicCommunication)
@@ -321,7 +340,7 @@
)WEBPUSHRESOURCE";
// FIXME: Re-enable this test on Mac once webkit.org/232857 is resolved.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !USE(APPLE_INTERNAL_SDK)
TEST(WebPushD, DISABLED_PermissionManagement)
#else
TEST(WebPushD, PermissionManagement)
@@ -454,7 +473,7 @@
}
// FIXME: Re-enable this test on Mac once webkit.org/232857 is resolved.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !USE(APPLE_INTERNAL_SDK)
TEST(WebPushD, DISABLED_HandleInjectedPush)
#else
TEST(WebPushD, HandleInjectedPush)