Commit 537f7345 authored by weinig@apple.com's avatar weinig@apple.com
Browse files

WebProcess XPC services need have their environment set without disrupting all other XPC services

https://bugs.webkit.org/show_bug.cgi?id=95161

Reviewed by Anders Carlsson.

Source/WebKit2:

Replace the WebKit2Service with two new XPC services, the WebProcessService, which is only used
when installed on the system, and the WebProcessServiceForWebKitDevelopment which is used at all
other times. We need both services because XPC can't in general be configured to have a custom
environment at runtime, and thus WebProcessServiceForWebKitDevelopment has the ability to re-exec
itself into a desired state. That capability is rather undesirable for installed usage, where we
don't want to allow arbitrary changes to the environment of the service, which would allow breaking
the App Sandbox.

* Configurations/WebProcessService.xcconfig: Copied from Source/WebKit2/Configurations/WebKit2Service.xcconfig.
* Configurations/WebProcessServiceForWebKitDevelopment.xcconfig: Renamed from Source/WebKit2/Configurations/WebKit2Service.xcconfig.
Add new configuration files.

* Platform/mac/WorkQueueMac.cpp:
(WorkQueue::registerMachPortEventHandler):
(WorkQueue::unregisterMachPortEventHandler):
Add helpful assertions. Without them, we confusingly crash a bit later in HashTable code.

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::addDYLDEnvironmentAdditions):
Factor out environment additions to this helper function.

(WebKit::connectToWebProcessServiceForWebKitDevelopment):
(WebKit::createWebProcessServiceForWebKitDevelopment):
Add functionality to setup the webkit development service via re-exec.

(WebKit::createWebProcessService):
Add functionality to connect to the installed WebProcess service.

(WebKit::createProcess):
Factor out posix_spawn based launching into this helper function.

(WebKit::ProcessLauncher::launchProcess):
Call the correct process creation function based on launch data and install state.

* WebKit2.xcodeproj/project.pbxproj:
Add new files to the project.

* WebProcess/mac/WebProcessServiceEntryPoints.h: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.h.
* WebProcess/mac/WebProcessServiceEntryPoints.mm: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.mm.
(WebKit::WebProcessServiceEventHandler):
(WebProcessServiceMain):
(InitializeWebProcessForWebProcessServiceForWebKitDevelopment):
Rename to WebProcessServiceEntryPoints since this is now used for both the WebProcessService and the
WebProcessServiceForWebKitDevelopment.

* WebProcessService/Info.plist: Copied from Source/WebKit2/WebKit2Service/Info.plist.
* WebProcessService/WebProcessServiceMain.mm: Renamed from Source/WebKit2/WebKit2Service/MainMacService.mm.
Add main for the WebProcessService which just calls into the WebProcessServiceEntryPoints in WebKit2.framework.

* WebProcessServiceForWebKitDevelopment/Info.plist: Renamed from Source/WebKit2/WebKit2Service/Info.plist.
* WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm: Added.
Add main for the WebProcessServiceForWebKitDevelopment, which can't just call directly into WebProcessServiceEntryPoints
as the framework path might not be set up correctly. This is also where we re-exec ourselves when required.

Tools:

Remove setting the __XPC_* environment variables.

* Scripts/webkitdirs.pm:
(setUpGuardMallocIfNeeded):
(runMacWebKitApp):
(execMacWebKitAppForDebugging):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c1b7f46b
2012-09-21 Sam Weinig <sam@webkit.org>
WebProcess XPC services need have their environment set without disrupting all other XPC services
https://bugs.webkit.org/show_bug.cgi?id=95161
Reviewed by Anders Carlsson.
Replace the WebKit2Service with two new XPC services, the WebProcessService, which is only used
when installed on the system, and the WebProcessServiceForWebKitDevelopment which is used at all
other times. We need both services because XPC can't in general be configured to have a custom
environment at runtime, and thus WebProcessServiceForWebKitDevelopment has the ability to re-exec
itself into a desired state. That capability is rather undesirable for installed usage, where we
don't want to allow arbitrary changes to the environment of the service, which would allow breaking
the App Sandbox.
* Configurations/WebProcessService.xcconfig: Copied from Source/WebKit2/Configurations/WebKit2Service.xcconfig.
* Configurations/WebProcessServiceForWebKitDevelopment.xcconfig: Renamed from Source/WebKit2/Configurations/WebKit2Service.xcconfig.
Add new configuration files.
* Platform/mac/WorkQueueMac.cpp:
(WorkQueue::registerMachPortEventHandler):
(WorkQueue::unregisterMachPortEventHandler):
Add helpful assertions. Without them, we confusingly crash a bit later in HashTable code.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::addDYLDEnvironmentAdditions):
Factor out environment additions to this helper function.
(WebKit::connectToWebProcessServiceForWebKitDevelopment):
(WebKit::createWebProcessServiceForWebKitDevelopment):
Add functionality to setup the webkit development service via re-exec.
(WebKit::createWebProcessService):
Add functionality to connect to the installed WebProcess service.
(WebKit::createProcess):
Factor out posix_spawn based launching into this helper function.
(WebKit::ProcessLauncher::launchProcess):
Call the correct process creation function based on launch data and install state.
* WebKit2.xcodeproj/project.pbxproj:
Add new files to the project.
* WebProcess/mac/WebProcessServiceEntryPoints.h: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.h.
* WebProcess/mac/WebProcessServiceEntryPoints.mm: Renamed from Source/WebKit2/WebProcess/mac/WebProcessXPCServiceMain.mm.
(WebKit::WebProcessServiceEventHandler):
(WebProcessServiceMain):
(InitializeWebProcessForWebProcessServiceForWebKitDevelopment):
Rename to WebProcessServiceEntryPoints since this is now used for both the WebProcessService and the
WebProcessServiceForWebKitDevelopment.
* WebProcessService/Info.plist: Copied from Source/WebKit2/WebKit2Service/Info.plist.
* WebProcessService/WebProcessServiceMain.mm: Renamed from Source/WebKit2/WebKit2Service/MainMacService.mm.
Add main for the WebProcessService which just calls into the WebProcessServiceEntryPoints in WebKit2.framework.
* WebProcessServiceForWebKitDevelopment/Info.plist: Renamed from Source/WebKit2/WebKit2Service/Info.plist.
* WebProcessServiceForWebKitDevelopment/WebProcessServiceForWebKitDevelopmentMain.mm: Added.
Add main for the WebProcessServiceForWebKitDevelopment, which can't just call directly into WebProcessServiceEntryPoints
as the framework path might not be set up correctly. This is also where we re-exec ourselves when required.
2012-09-21 Anders Carlsson <andersca@apple.com>
 
Fix WebKit2 sandbox profile.
......
......@@ -25,7 +25,7 @@
GCC_ENABLE_OBJC_GC = NO;
PRODUCT_NAME = com.apple.WebKit2.$(TARGET_NAME:rfc1034identifier);
INFOPLIST_FILE = WebKit2Service/Info.plist;
INFOPLIST_FILE = WebProcessService/Info.plist;
INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework;
APP_ICON = $(APP_ICON_$(CONFIGURATION));
......
// Copyright (C) 2012 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. ``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
// 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.
#include "BaseTarget.xcconfig"
GCC_ENABLE_OBJC_GC = NO;
PRODUCT_NAME = com.apple.WebKit2.$(TARGET_NAME:rfc1034identifier);
INFOPLIST_FILE = WebProcessServiceForWebKitDevelopment/Info.plist;
INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework;
APP_ICON = $(APP_ICON_$(CONFIGURATION));
APP_ICON_Debug = WebKit.icns;
APP_ICON_Release = WebKit.icns;
APP_ICON_Production = ;
EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(CONFIGURATION));
EXCLUDED_SOURCE_FILE_NAMES_Production = WebKit.icns;
WRAPPER_EXTENSION = xpc;
MACH_O_TYPE = mh_execute;
......@@ -110,6 +110,8 @@ private:
void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, const Function<void()>& function)
{
ASSERT(machPort != MACH_PORT_NULL);
dispatch_source_type_t sourceType = 0;
switch (eventType) {
case MachPortDataAvailable:
......@@ -144,7 +146,7 @@ void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEvent
void WorkQueue::unregisterMachPortEventHandler(mach_port_t machPort)
{
ASSERT(machPort);
ASSERT(machPort != MACH_PORT_NULL);
MutexLocker locker(m_eventSourcesMutex);
......
......@@ -203,10 +203,12 @@ void WebProcess::initializeSandbox(const String& clientIdentifier)
setenv("TMPDIR", temporaryDirectory, 1);
#endif
NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")];
Vector<const char*> sandboxParameters;
// These are read-only.
appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent]);
appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[webkit2Bundle bundlePath] stringByDeletingLastPathComponent]);
// These are read-write getconf paths.
appendReadwriteConfDirectory(sandboxParameters, "DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR);
......@@ -217,7 +219,7 @@ void WebProcess::initializeSandbox(const String& clientIdentifier)
sandboxParameters.append(static_cast<const char*>(0));
const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation];
const char* profilePath = [[webkit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation];
char* errorBuf;
if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParameters.data(), &errorBuf)) {
......
......@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebProcessXPCServiceMain_h
#define WebProcessXPCServiceMain_h
#ifndef WebProcessServiceEntryPoints_h
#define WebProcessServiceEntryPoints_h
#if HAVE(XPC)
......@@ -34,7 +34,14 @@
extern "C" {
#endif
WK_EXPORT int WebProcessXPCServiceMain(int argc, char** argv);
// This entry point is used for the installed WebProcessService, which does not
// need to be re-execed, or mess around with DYLD.
WK_EXPORT int WebProcessServiceMain(int argc, char** argv);
// This entry point is used for the WebProcessServiceForWebKitDevelopment
// which needs to be re-exec, and can't link directly to WebKit2 requiring
// some DYLD fiddling.
WK_EXPORT void InitializeWebProcessForWebProcessServiceForWebKitDevelopment(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort);
#ifdef __cplusplus
}; // extern "C"
......@@ -42,4 +49,4 @@ WK_EXPORT int WebProcessXPCServiceMain(int argc, char** argv);
#endif // HAVE(XPC)
#endif // WebProcessXPCServiceMain_h
#endif // WebProcessServiceEntryPoints_h
......@@ -24,10 +24,13 @@
*/
#import "config.h"
#import "WebProcessXPCServiceMain.h"
#import "WebProcessServiceEntryPoints.h"
#if HAVE(XPC)
#import "EnvironmentUtilities.h"
#import "WebProcessInitialization.h"
#import "EnvironmentUtilities.h"
#import "WebProcessInitialization.h"
#import <stdio.h>
......@@ -38,7 +41,7 @@ extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
namespace WebKit {
static void WebKit2ServiceEventHandler(xpc_connection_t peer)
static void WebProcessServiceEventHandler(xpc_connection_t peer)
{
xpc_connection_set_target_queue(peer, dispatch_get_main_queue());
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
......@@ -67,14 +70,23 @@ static void WebKit2ServiceEventHandler(xpc_connection_t peer)
} // namespace WebKit
int WebProcessXPCServiceMain(int argc, char** argv)
int WebProcessServiceMain(int argc, char** argv)
{
// Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
// the WebProcess don't try to insert the shim and crash.
WebKit::EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
xpc_main(WebKit::WebKit2ServiceEventHandler);
xpc_main(WebKit::WebProcessServiceEventHandler);
return 0;
}
void InitializeWebProcessForWebProcessServiceForWebKitDevelopment(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort)
{
// Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
// the WebProcess don't try to insert the shim and crash.
WebKit::EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
WebKit::InitializeWebProcess(String(clientIdentifer), CoreIPC::Connection::Identifier(serverPort, connection));
}
#endif // HAVE(XPC)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.apple.WebKit2.WebProcessService</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<true/>
<key>XPCService</key>
<dict>
<key>ServiceType</key>
<string>Application</string>
<key>RunLoopType</key>
<string>_NSApplicationMain</string>
<key>_MultipleInstance</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>DYLD_INSERT_LIBRARIES</key>
<string>$(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework/WebProcess.app/Contents/MacOS/WebProcessShim.dylib</string>
</dict>
</dict>
</dict>
</plist>
......@@ -27,11 +27,11 @@
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import "WebProcessXPCServiceMain.h"
#import "WebProcessServiceEntryPoints.h"
int main(int argc, char** argv)
{
return WebProcessXPCServiceMain(argc, argv);
return WebProcessServiceMain(argc, argv);
}
#else
......
......@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.apple.WebKit2Service</string>
<string>com.apple.WebKit2.WebProcessServiceForWebKitDevelopment</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
......
/*
* Copyright (C) 2012 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 <AvailabilityMacros.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#import <crt_externs.h>
#import <dlfcn.h>
#import <mach-o/dyld.h>
#import <spawn.h>
#import <stdio.h>
#import <stdlib.h>
#import <xpc/xpc.h>
extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
static void WebProcessServiceForWebKitDevelopmentEventHandler(xpc_connection_t peer)
{
xpc_connection_set_target_queue(peer, dispatch_get_main_queue());
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR) {
if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_TERMINATION_IMMINENT) {
// FIXME: Handle this case more gracefully.
exit(EXIT_FAILURE);
}
} else {
assert(type == XPC_TYPE_DICTIONARY);
if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "re-exec")) {
// Setup the posix_spawn attributes.
posix_spawnattr_t attr;
posix_spawnattr_init(&attr);
short flags = 0;
// We just want to set the process state, not actually launch a new process,
// so we are going to use the darwin extension to posix_spawn POSIX_SPAWN_SETEXEC
// to act like a more full featured exec.
flags |= POSIX_SPAWN_SETEXEC;
// We want our process to receive all signals.
sigset_t signalMaskSet;
sigemptyset(&signalMaskSet);
posix_spawnattr_setsigmask(&attr, &signalMaskSet);
flags |= POSIX_SPAWN_SETSIGMASK;
// Set the architecture.
cpu_type_t cpuTypes[] = { (cpu_type_t)xpc_dictionary_get_uint64(event, "architecture") };
size_t outCount = 0;
posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount);
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static const int allowExecutableHeapFlag = 0x2000;
if (xpc_dictionary_get_bool(event, "executable-heap"))
flags |= allowExecutableHeapFlag;
#endif
posix_spawnattr_setflags(&attr, flags);
uint32_t pathLength;
char path[4 * PATH_MAX];
_NSGetExecutablePath(path, &pathLength);
// Setup the command line.
char** argv = *_NSGetArgv();
const char* programName = argv[0];
const char* args[] = { programName, 0 };
// Setup the environment.
xpc_object_t environmentArray = xpc_dictionary_get_value(event, "environment");
size_t numberOfEnvironmentVariables = xpc_array_get_count(environmentArray);
char** environment = (char**)malloc(numberOfEnvironmentVariables * sizeof(char*) + 1);
for (size_t i = 0; i < numberOfEnvironmentVariables; ++i) {
const char* string = xpc_array_get_string(environmentArray, i);
size_t stringLength = strlen(string);
char* environmentVariable = (char*)malloc(stringLength + 1);
memcpy(environmentVariable, string, stringLength);
environmentVariable[stringLength] = '\0';
environment[i] = environmentVariable;
}
environment[numberOfEnvironmentVariables] = 0;
pid_t processIdentifier = 0;
posix_spawn(&processIdentifier, path, 0, &attr, const_cast<char**>(args), environment);
posix_spawnattr_destroy(&attr);
NSLog(@"Unable to re-exec for path: %s\n", path);
exit(EXIT_FAILURE);
}
if (!strcmp(xpc_dictionary_get_string(event, "message-name"), "bootstrap")) {
static void* frameworkLibrary = dlopen(xpc_dictionary_get_string(event, "framework-executable-path"), RTLD_NOW);
if (!frameworkLibrary) {
NSLog(@"Unable to load WebKit2.framework: %s\n", dlerror());
exit(EXIT_FAILURE);
}
typedef void (*InitializeWebProcessFunction)(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort);
InitializeWebProcessFunction InitializeWebProcessFunctionPtr = reinterpret_cast<InitializeWebProcessFunction>(dlsym(frameworkLibrary, "InitializeWebProcessForWebProcessServiceForWebKitDevelopment"));
if (!InitializeWebProcessFunctionPtr) {
NSLog(@"Unable to find entry point in WebKit2.framework: %s\n", dlerror());
exit(EXIT_FAILURE);
}
xpc_object_t reply = xpc_dictionary_create_reply(event);
xpc_dictionary_set_string(reply, "message-name", "process-finished-launching");
xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply);
xpc_release(reply);
InitializeWebProcessFunctionPtr(xpc_dictionary_get_string(event, "client-identifier"), peer, xpc_dictionary_copy_mach_send(event, "server-port"));
}
}
});
xpc_connection_resume(peer);
}
int main(int argc, char** argv)
{
xpc_main(WebProcessServiceForWebKitDevelopmentEventHandler);
return 0;;
}
#else
int main(int argc, char** argv)
{
return 0;
}
#endif
2012-09-21 Sam Weinig <sam@webkit.org>
WebProcess XPC services need have their environment set without disrupting all other XPC services
https://bugs.webkit.org/show_bug.cgi?id=95161
Reviewed by Anders Carlsson.
Remove setting the __XPC_* environment variables.
* Scripts/webkitdirs.pm:
(setUpGuardMallocIfNeeded):
(runMacWebKitApp):
(execMacWebKitAppForDebugging):
2012-09-21 Dirk Pranke <dpranke@chromium.org>
 
Fix typo in additional-platform-directory patch just landed
......@@ -1476,9 +1476,6 @@ sub setUpGuardMallocIfNeeded
if ($shouldUseGuardMalloc) {
appendToEnvironmentVariableList("DYLD_INSERT_LIBRARIES", "/usr/lib/libgmalloc.dylib");
if (shouldUseXPCServiceForWebProcess()) {
appendToEnvironmentVariableList("__XPC_DYLD_INSERT_LIBRARIES", "/usr/lib/libgmalloc.dylib");
}
}
}
......@@ -2546,8 +2543,6 @@ sub runMacWebKitApp($;$)
setUpGuardMallocIfNeeded();
if (shouldUseXPCServiceForWebProcess()) {
$ENV{__XPC_DYLD_FRAMEWORK_PATH} = $productDir;
appendToEnvironmentVariableList("__XPC_DYLD_INSERT_LIBRARIES", File::Spec->catfile($productDir, "WebProcessShim.dylib"));
$ENV{WEBKIT_USE_XPC_SERVICE_FOR_WEB_PROCESS} = "YES";
}
......@@ -2589,8 +2584,6 @@ sub execMacWebKitAppForDebugging($)
my @architectureFlags = ($architectureSwitch, architecture());
if (!shouldTargetWebProcess()) {
if (shouldUseXPCServiceForWebProcess()) {
$ENV{__XPC_DYLD_FRAMEWORK_PATH} = $productDir;
appendToEnvironmentVariableList("__XPC_DYLD_INSERT_LIBRARIES", File::Spec->catfile($productDir, "WebProcessShim.dylib"));
$ENV{WEBKIT_USE_XPC_SERVICE_FOR_WEB_PROCESS} = "YES";
}
print "Starting @{[basename($appPath)]} under $debugger with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment