Title: [286527] trunk/Source/WebKit
Revision
286527
Author
[email protected]
Date
2021-12-04 00:28:31 -0800 (Sat, 04 Dec 2021)

Log Message

[Cocoa] Launch Captive Portal WebContent process when requested
https://bugs.webkit.org/show_bug.cgi?id=233824
<rdar://problem/86023898>

Reviewed by Darin Adler.

When the WebKit client requests a Captive Portal process, launch the dedicated XPC service
with Captive Portal entitlements.

 * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
(WebKit::webContentServiceName): New helper function.
(WebKit::serviceName): Update to use new helper.
(WebKit::ProcessLauncher::launchProcess): Log errors when launching.
* WebKit.xcodeproj/project.pbxproj: Include the CaptivePortal xpc service when creating
development symlinks.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286526 => 286527)


--- trunk/Source/WebKit/ChangeLog	2021-12-04 06:12:25 UTC (rev 286526)
+++ trunk/Source/WebKit/ChangeLog	2021-12-04 08:28:31 UTC (rev 286527)
@@ -1,3 +1,21 @@
+2021-12-04  Brent Fulgham  <[email protected]>
+
+        [Cocoa] Launch Captive Portal WebContent process when requested
+        https://bugs.webkit.org/show_bug.cgi?id=233824
+        <rdar://problem/86023898>
+
+        Reviewed by Darin Adler.
+
+        When the WebKit client requests a Captive Portal process, launch the dedicated XPC service
+        with Captive Portal entitlements.
+
+         * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
+        (WebKit::webContentServiceName): New helper function.
+        (WebKit::serviceName): Update to use new helper.
+        (WebKit::ProcessLauncher::launchProcess): Log errors when launching.
+        * WebKit.xcodeproj/project.pbxproj: Include the CaptivePortal xpc service when creating
+        development symlinks.
+
 2021-12-03  Wenson Hsieh  <[email protected]>
 
         [iOS] Web content process sometimes crashes under WebPage::positionInformation()

Modified: trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm (286526 => 286527)


--- trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm	2021-12-04 06:12:25 UTC (rev 286526)
+++ trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm	2021-12-04 08:28:31 UTC (rev 286527)
@@ -54,11 +54,19 @@
 
 namespace WebKit {
 
-static const char* serviceName(const ProcessLauncher::LaunchOptions& launchOptions)
+static const char* webContentServiceName(bool nonValidInjectedCodeAllowed, ProcessLauncher::Client* client)
 {
+    if (client && client->shouldEnableCaptivePortalMode())
+        return "com.apple.WebKit.WebContent.CaptivePortal";
+
+    return nonValidInjectedCodeAllowed ? "com.apple.WebKit.WebContent.Development" : "com.apple.WebKit.WebContent";
+}
+
+static const char* serviceName(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher::Client* client)
+{
     switch (launchOptions.processType) {
     case ProcessLauncher::ProcessType::Web:
-        return launchOptions.nonValidInjectedCodeAllowed ? "com.apple.WebKit.WebContent.Development" : "com.apple.WebKit.WebContent";
+        return webContentServiceName(launchOptions.nonValidInjectedCodeAllowed, client);
     case ProcessLauncher::ProcessType::Network:
         return "com.apple.WebKit.Networking";
 #if ENABLE(GPU_PROCESS)
@@ -120,7 +128,7 @@
     if (!m_launchOptions.customWebContentServiceBundleIdentifier.isNull())
         name = m_launchOptions.customWebContentServiceBundleIdentifier.data();
     else
-        name = serviceName(m_launchOptions);
+        name = serviceName(m_launchOptions, m_client);
 
     m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr));
 
@@ -231,7 +239,7 @@
 
     xpc_dictionary_set_value(bootstrapMessage.get(), "extra-initialization-data", extraInitializationData.get());
 
-    auto errorHandlerImpl = [weakProcessLauncher = WeakPtr { *this }, listeningPort] (xpc_object_t event) {
+    auto errorHandlerImpl = [weakProcessLauncher = WeakPtr { *this }, listeningPort, name] (xpc_object_t event) {
         ASSERT(!event || xpc_get_type(event) == XPC_TYPE_ERROR);
 
         auto processLauncher = weakProcessLauncher.get();
@@ -241,6 +249,12 @@
         if (!processLauncher->isLaunching())
             return;
 
+#if ERROR_DISABLED
+        UNUSED_PARAM(name);
+#endif
+
+        LOG_ERROR("Error while launching %s: %s", name, xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION));
+
 #if ASSERT_ENABLED
         mach_port_urefs_t sendRightCount = 0;
         mach_port_get_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_SEND, &sendRightCount);

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (286526 => 286527)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-12-04 06:12:25 UTC (rev 286526)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-12-04 08:28:31 UTC (rev 286527)
@@ -14826,7 +14826,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "if [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    exit\nfi\n\nif [[ ${WK_PLATFORM_NAME} != \"macosx\" ]]; then\n    XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/XPCServices\"\n    BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES=\"../..\"\nelse\n    XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/Versions/A/XPCServices\"\n    BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES=\"../../../..\"\nfi\n\nmkdir -p \"${XPC_SERVICES_PATH}\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.WebContent.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebContent.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.Networking.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Networking.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC
 _SERVICES}/com.apple.WebKit.GPU.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.GPU.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.WebAuthn.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebAuthn.xpc\"\n\nif [[ ${WK_PLATFORM_NAME} == macosx ]]; then\n    ln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.Plugin.64.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.64.xpc\"\nfi\n";
+			shellScript = "if [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n    exit\nfi\n\nif [[ ${WK_PLATFORM_NAME} != \"macosx\" ]]; then\n    XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/XPCServices\"\n    BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES=\"../..\"\nelse\n    XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/Versions/A/XPCServices\"\n    BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES=\"../../../..\"\nfi\n\nmkdir -p \"${XPC_SERVICES_PATH}\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.WebContent.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebContent.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.WebContent.CaptivePortal.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebContent.CaptivePortal.xpc\"\nln -sFh \"${BUILT_PRODUCTS
 _DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.Networking.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Networking.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.GPU.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.GPU.xpc\"\nln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.WebAuthn.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebAuthn.xpc\"\n\nif [[ ${WK_PLATFORM_NAME} == macosx ]]; then\n    ln -sFh \"${BUILT_PRODUCTS_DIR_RELATIVE_PATH_FROM_XPC_SERVICES}/com.apple.WebKit.Plugin.64.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.64.xpc\"\nfi\n";
 		};
 		942DB245257EE6DF009BD80A /* Create /usr/local to work around XBS Bug <rdar://problem/20388650> */ = {
 			isa = PBXShellScriptBuildPhase;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to