⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286527 in webkit


Ignore:
Timestamp:
Dec 4, 2021, 12:28:31 AM (5 years ago)
Author:
Brent Fulgham
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.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r286522 r286527  
     12021-12-04  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Cocoa] Launch Captive Portal WebContent process when requested
     4        https://bugs.webkit.org/show_bug.cgi?id=233824
     5        <rdar://problem/86023898>
     6
     7        Reviewed by Darin Adler.
     8
     9        When the WebKit client requests a Captive Portal process, launch the dedicated XPC service
     10        with Captive Portal entitlements.
     11
     12         * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
     13        (WebKit::webContentServiceName): New helper function.
     14        (WebKit::serviceName): Update to use new helper.
     15        (WebKit::ProcessLauncher::launchProcess): Log errors when launching.
     16        * WebKit.xcodeproj/project.pbxproj: Include the CaptivePortal xpc service when creating
     17        development symlinks.
     18
    1192021-12-03  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm

    r285737 r286527  
    5555namespace WebKit {
    5656
    57 static const char* serviceName(const ProcessLauncher::LaunchOptions& launchOptions)
     57static const char* webContentServiceName(bool nonValidInjectedCodeAllowed, ProcessLauncher::Client* client)
     58{
     59    if (client && client->shouldEnableCaptivePortalMode())
     60        return "com.apple.WebKit.WebContent.CaptivePortal";
     61
     62    return nonValidInjectedCodeAllowed ? "com.apple.WebKit.WebContent.Development" : "com.apple.WebKit.WebContent";
     63}
     64
     65static const char* serviceName(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher::Client* client)
    5866{
    5967    switch (launchOptions.processType) {
    6068    case ProcessLauncher::ProcessType::Web:
    61         return launchOptions.nonValidInjectedCodeAllowed ? "com.apple.WebKit.WebContent.Development" : "com.apple.WebKit.WebContent";
     69        return webContentServiceName(launchOptions.nonValidInjectedCodeAllowed, client);
    6270    case ProcessLauncher::ProcessType::Network:
    6371        return "com.apple.WebKit.Networking";
     
    121129        name = m_launchOptions.customWebContentServiceBundleIdentifier.data();
    122130    else
    123         name = serviceName(m_launchOptions);
     131        name = serviceName(m_launchOptions, m_client);
    124132
    125133    m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr));
     
    232240    xpc_dictionary_set_value(bootstrapMessage.get(), "extra-initialization-data", extraInitializationData.get());
    233241
    234     auto errorHandlerImpl = [weakProcessLauncher = WeakPtr { *this }, listeningPort] (xpc_object_t event) {
     242    auto errorHandlerImpl = [weakProcessLauncher = WeakPtr { *this }, listeningPort, name] (xpc_object_t event) {
    235243        ASSERT(!event || xpc_get_type(event) == XPC_TYPE_ERROR);
    236244
     
    241249        if (!processLauncher->isLaunching())
    242250            return;
     251
     252#if ERROR_DISABLED
     253        UNUSED_PARAM(name);
     254#endif
     255
     256        LOG_ERROR("Error while launching %s: %s", name, xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION));
    243257
    244258#if ASSERT_ENABLED
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r286508 r286527  
    1482714827                        runOnlyForDeploymentPostprocessing = 0;
    1482814828                        shellPath = /bin/sh;
    14829                         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";
     14829                        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";
    1483014830                };
    1483114831                942DB245257EE6DF009BD80A /* Create /usr/local to work around XBS Bug <rdar://problem/20388650> */ = {
Note: See TracChangeset for help on using the changeset viewer.