Plug-ins should initialize their sandbox at creation time
https://bugs.webkit.org/show_bug.cgi?id=108098
Reviewed by Anders Carlsson.
Add the ability to add string key/value pairs to process creation parameters
to allow the plugin process to get passed the plugin path which in turn allows
the plugin to initialize its sandbox at the correct time.
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(NetworkServiceInitializer):
* PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
(WebKit::PluginProcessMainDelegate::getExtraData):
(PluginProcessMainDelegate):
* PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm:
* PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm:
* PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm:
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit):
(PluginServiceInitializerDelegate):
(WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
(WebKit::PluginServiceInitializerDelegate::getExtraData):
(PluginServiceInitializer):
* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::initializeProcess):
(WebKit::PluginProcess::initializePluginProcess):
(WebKit::PluginProcess::initializeProcessName):
(WebKit::PluginProcess::initializeSandbox):
* PluginProcess/PluginProcess.h:
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializePluginProcess):
(WebKit::PluginProcess::platformInitializeProcess):
(WebKit::PluginProcess::initializeProcessName):
(WebKit::PluginProcess::initializeSandbox):
* Shared/ChildProcess.h:
(ChildProcessInitializationParameters):
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h:
(ChildProcessMainDelegate):
(WebKit::ChildProcessMain):
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:
(WebKit::ChildProcessMainDelegate::getExtraData):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h:
(WebKit::XPCServiceEventHandler):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h:
(WebKit::XPCServiceEventHandler):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: Added.
(XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: Added.
(WebKit::XPCServiceInitializerDelegate::~XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier):
(WebKit::XPCServiceInitializerDelegate::getClientIdentifier):
(WebKit::XPCServiceInitializerDelegate::getClientProcessName):
(WebKit::XPCServiceInitializerDelegate::getExtraData):
* Shared/Plugins/PluginProcessCreationParameters.cpp:
(WebKit::PluginProcessCreationParameters::encode):
(WebKit::PluginProcessCreationParameters::decode):
* Shared/Plugins/PluginProcessCreationParameters.h:
(PluginProcessCreationParameters):
* UIProcess/Launcher/ProcessLauncher.h:
(LaunchOptions):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
(WebKit::connectToReExecService):
(WebKit::createService):
(WebKit::createProcess):
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::platformInitializeLaunchOptions):
(WebKit::PluginProcessProxy::platformInitializePluginProcess):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm:
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141051 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 0e22fd6..c42e925 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,86 @@
+2013-01-28 Sam Weinig <sam@webkit.org>
+
+ Plug-ins should initialize their sandbox at creation time
+ https://bugs.webkit.org/show_bug.cgi?id=108098
+
+ Reviewed by Anders Carlsson.
+
+ Add the ability to add string key/value pairs to process creation parameters
+ to allow the plugin process to get passed the plugin path which in turn allows
+ the plugin to initialize its sandbox at the correct time.
+
+ * NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm:
+ * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm:
+ * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
+ (NetworkServiceInitializer):
+ * PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
+ (WebKit::PluginProcessMainDelegate::getExtraData):
+ (PluginProcessMainDelegate):
+ * PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm:
+ * PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm:
+ * PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm:
+ * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
+ (WebKit):
+ (PluginServiceInitializerDelegate):
+ (WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
+ (WebKit::PluginServiceInitializerDelegate::getExtraData):
+ (PluginServiceInitializer):
+ * PluginProcess/PluginProcess.cpp:
+ (WebKit::PluginProcess::initializeProcess):
+ (WebKit::PluginProcess::initializePluginProcess):
+ (WebKit::PluginProcess::initializeProcessName):
+ (WebKit::PluginProcess::initializeSandbox):
+ * PluginProcess/PluginProcess.h:
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::PluginProcess::platformInitializePluginProcess):
+ (WebKit::PluginProcess::platformInitializeProcess):
+ (WebKit::PluginProcess::initializeProcessName):
+ (WebKit::PluginProcess::initializeSandbox):
+ * Shared/ChildProcess.h:
+ (ChildProcessInitializationParameters):
+ * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h:
+ (ChildProcessMainDelegate):
+ (WebKit::ChildProcessMain):
+ * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:
+ (WebKit::ChildProcessMainDelegate::getExtraData):
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h:
+ (WebKit::XPCServiceEventHandler):
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h:
+ (WebKit::XPCServiceEventHandler):
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: Added.
+ (XPCServiceInitializerDelegate):
+ (WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
+ (WebKit::XPCServiceInitializer):
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: Added.
+ (WebKit::XPCServiceInitializerDelegate::~XPCServiceInitializerDelegate):
+ (WebKit::XPCServiceInitializerDelegate::getConnectionIdentifier):
+ (WebKit::XPCServiceInitializerDelegate::getClientIdentifier):
+ (WebKit::XPCServiceInitializerDelegate::getClientProcessName):
+ (WebKit::XPCServiceInitializerDelegate::getExtraData):
+ * Shared/Plugins/PluginProcessCreationParameters.cpp:
+ (WebKit::PluginProcessCreationParameters::encode):
+ (WebKit::PluginProcessCreationParameters::decode):
+ * Shared/Plugins/PluginProcessCreationParameters.h:
+ (PluginProcessCreationParameters):
+ * UIProcess/Launcher/ProcessLauncher.h:
+ (LaunchOptions):
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::connectToService):
+ (WebKit::connectToReExecService):
+ (WebKit::createService):
+ (WebKit::createProcess):
+ (WebKit::ProcessLauncher::launchProcess):
+ * UIProcess/Plugins/PluginProcessProxy.cpp:
+ (WebKit::PluginProcessProxy::didFinishLaunching):
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::platformInitializeLaunchOptions):
+ (WebKit::PluginProcessProxy::platformInitializePluginProcess):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm:
+ * WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm:
+ * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
+ (WebContentServiceInitializer):
+
2013-01-28 Kiran Muppala <cmuppala@apple.com>
Add window occlusion criteria to determine page visibility on Mac
diff --git a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm
index a42e58d..a3022fb 100644
--- a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm
+++ b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/NetworkServiceMain.Development.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializeNetworkService
+#define WEBKIT_XPC_SERVICE_INITIALIZER NetworkServiceInitializer
#include "XPCServiceBootstrapper.Development.h"
using namespace WebKit;
diff --git a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm
index 736684e..b00dbd3 100644
--- a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm
+++ b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/NetworkServiceMain.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializeNetworkService
+#define WEBKIT_XPC_SERVICE_INITIALIZER NetworkServiceInitializer
#include "XPCServiceBootstrapper.h"
using namespace WebKit;
diff --git a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm
index ee4dbce..1c6ab64 100644
--- a/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm
+++ b/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm
@@ -28,33 +28,21 @@
#if HAVE(XPC)
#import "EnvironmentUtilities.h"
-#import "WKBase.h"
-#import "WebKit2Initialize.h"
#import "NetworkProcess.h"
-#import <WebCore/RunLoop.h>
-#import <stdio.h>
-#import <stdlib.h>
-#import <xpc/xpc.h>
+#import "WKBase.h"
+#import "XPCServiceEntryPoint.h"
-using namespace WebCore;
using namespace WebKit;
-extern "C" WK_EXPORT void initializeNetworkService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);
+extern "C" WK_EXPORT void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage);
-void initializeNetworkService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)
+void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
{
- // Remove the SecItemShim shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
+ // Remove the SecItemShim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
// the this process don't try to insert the shim and crash.
EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib");
- InitializeWebKit2();
-
- ChildProcessInitializationParameters parameters;
- parameters.uiProcessName = uiProcessName;
- parameters.clientIdentifier = clientIdentifier;
- parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection);
-
- NetworkProcess::shared().initialize(parameters);
+ XPCServiceInitializer<NetworkProcess, XPCServiceInitializerDelegate>(connection, initializerMessage);
}
#endif // HAVE(XPC)
diff --git a/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm b/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm
index 614f640..0e45f89 100644
--- a/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm
+++ b/Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm
@@ -80,6 +80,22 @@
}
}
+ virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData)
+ {
+ String pluginPath = m_commandLine["plugin-path"];
+ if (pluginPath.isEmpty())
+ return false;
+ extraInitializationData.add("plugin-path", pluginPath);
+
+ // FIXME: We should stop passing this and have it in a hard coded place. For now
+ // though, let the absence of a sandboxProfileDirectoryPath indicate no plugin
+ // sandboxing should take place.
+ String sandboxProfileDirectoryPath = m_commandLine["sandbox-profile-directory-path"];
+ extraInitializationData.add("sandbox-profile-directory-path", sandboxProfileDirectoryPath);
+
+ return true;
+ }
+
virtual void doPostRunWork()
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
diff --git a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm
index bf7bf31..8994085 100644
--- a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm
+++ b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.32/PluginService.32.Main.mm
@@ -23,7 +23,9 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService
+#if defined(__i386__)
+
+#define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer
#include "XPCServiceBootstrapper.h"
using namespace WebKit;
@@ -33,3 +35,12 @@
xpc_main(XPCServiceEventHandler);
return 0;
}
+
+#else
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
+
+#endif
diff --git a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm
index bf7bf31..974ba44 100644
--- a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm
+++ b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.64/PluginService.64.Main.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService
+#define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer
#include "XPCServiceBootstrapper.h"
using namespace WebKit;
diff --git a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm
index 774ae74..0d76e20 100644
--- a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm
+++ b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginService.Development/PluginService.Development.Main.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializePluginService
+#define WEBKIT_XPC_SERVICE_INITIALIZER PluginServiceInitializer
#include "XPCServiceBootstrapper.Development.h"
using namespace WebKit;
diff --git a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
index 079a5d1..c3745a6 100644
--- a/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
+++ b/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
@@ -28,34 +28,56 @@
#if HAVE(XPC)
#import "EnvironmentUtilities.h"
-#import "WKBase.h"
-#import "WebKit2Initialize.h"
#import "PluginProcess.h"
+#import "WKBase.h"
+#import "XPCServiceEntryPoint.h"
#import <WebCore/RunLoop.h>
-#import <xpc/xpc.h>
+
+namespace WebKit {
+
+class PluginServiceInitializerDelegate : public XPCServiceInitializerDelegate {
+public:
+ PluginServiceInitializerDelegate(xpc_connection_t connection, xpc_object_t initializerMessage)
+ : XPCServiceInitializerDelegate(connection, initializerMessage)
+ {
+ }
+
+ virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData)
+ {
+ xpc_object_t extraDataInitializationDataObject = xpc_dictionary_get_value(m_initializerMessage, "extra-initialization-data");
+
+ String pluginPath = xpc_dictionary_get_string(extraDataInitializationDataObject, "plugin-path");
+ if (pluginPath.isEmpty())
+ return false;
+ extraInitializationData.add("plugin-path", pluginPath);
+
+ // FIXME: We should stop passing this and have it in a hard coded place. For now
+ // though, let the absence of a sandboxProfileDirectoryPath indicate no plugin
+ // sandboxing should take place.
+ String sandboxProfileDirectoryPath = xpc_dictionary_get_string(extraDataInitializationDataObject, "sandbox-profile-directory-path");
+ extraInitializationData.add("sandbox-profile-directory-path", sandboxProfileDirectoryPath);
+
+ return true;
+ }
+};
+
+} // namespace WebKit
using namespace WebCore;
using namespace WebKit;
-extern "C" WK_EXPORT void initializePluginService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);
+extern "C" WK_EXPORT void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage);
-void initializePluginService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)
+void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
{
+ // FIXME: Add support for teardown from PluginProcessMain.mm
+
// Remove the PluginProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes
// spawned by the PluginProcess don't try to insert the shim and crash.
EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
-
RunLoop::setUseApplicationRunLoopOnMainRunLoop();
- InitializeWebKit2();
- ChildProcessInitializationParameters parameters;
- parameters.uiProcessName = uiProcessName;
- parameters.clientIdentifier = clientIdentifier;
- parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection);
-
- PluginProcess::shared().initialize(parameters);
-
- // FIXME: Add support for teardown from PluginProcessMain.mm
+ XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(connection, initializerMessage);
}
#endif // HAVE(XPC)
diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp
index 1d2361a..26ddc40 100644
--- a/Source/WebKit2/PluginProcess/PluginProcess.cpp
+++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp
@@ -87,15 +87,10 @@
void PluginProcess::initializeProcess(const ChildProcessInitializationParameters& parameters)
{
+ m_pluginPath = parameters.extraInitializationData.get("plugin-path");
platformInitializeProcess(parameters);
}
-#if !PLATFORM(MAC)
-void PluginProcess::enterSandbox(const String&)
-{
-}
-#endif
-
void PluginProcess::removeWebProcessConnection(WebProcessConnection* webProcessConnection)
{
size_t vectorIndex = m_webProcessConnections.find(webProcessConnection);
@@ -155,7 +150,6 @@
{
ASSERT(!m_pluginModule);
- m_pluginPath = parameters.pluginPath;
m_supportsAsynchronousPluginInitialization = parameters.supportsAsynchronousPluginInitialization;
setMinimumLifetime(parameters.minimumLifetime);
setTerminationTimeout(parameters.terminationTimeout);
@@ -264,6 +258,16 @@
enableTermination();
}
+#if !PLATFORM(MAC)
+void PluginProcess::initializeProcessName(const ChildProcessInitializationParameters&)
+{
+}
+
+void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&)
+{
+}
+#endif
+
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h
index e62ea7d..20e618f 100644
--- a/Source/WebKit2/PluginProcess/PluginProcess.h
+++ b/Source/WebKit2/PluginProcess/PluginProcess.h
@@ -32,10 +32,6 @@
#include <wtf/Forward.h>
#include <wtf/text/WTFString.h>
-namespace WebCore {
-class RunLoop;
-}
-
namespace WebKit {
class NetscapePluginModule;
@@ -72,16 +68,11 @@
PluginProcess();
~PluginProcess();
- void enterSandbox(const String& sandboxProfileDirectoryPath);
-
// ChildProcess
virtual void initializeProcess(const ChildProcessInitializationParameters&) OVERRIDE;
+ virtual void initializeProcessName(const ChildProcessInitializationParameters&) OVERRIDE;
+ virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) OVERRIDE;
virtual bool shouldTerminate() OVERRIDE;
-
- // Prevent entering the sandbox during first stage of process initialization. We can't do enter the sandbox before receiving
- // sandbox profile directory in initialization message.
- virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) OVERRIDE { }
-
void platformInitializeProcess(const ChildProcessInitializationParameters&);
// CoreIPC::Connection::Client
@@ -100,10 +91,6 @@
void setMinimumLifetime(double);
void minimumLifetimeTimerFired();
-
- // Stored for delayed sandbox initialization.
- ChildProcessInitializationParameters m_childProcessInitializationParameters;
-
// Our web process connections.
Vector<RefPtr<WebProcessConnection> > m_webProcessConnections;
diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
index 2cbe8b1..0ae1f02 100644
--- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
+++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
@@ -270,31 +270,6 @@
CFRetain(orderOffScreenObserver);
}
-void PluginProcess::platformInitializeProcess(const ChildProcessInitializationParameters& parameters)
-{
- m_childProcessInitializationParameters = parameters;
-
- RunLoop::setUseApplicationRunLoopOnMainRunLoop();
-
-#if defined(__i386__)
- // Initialize the shim.
- initializeShim();
-#endif
-
- // Initialize Cocoa overrides.
- initializeCocoaOverrides();
-
- // FIXME: It would be better to proxy SetCursor calls over to the UI process instead of
- // allowing plug-ins to change the mouse cursor at any time.
- WKEnableSettingCursorWhenInBackground();
-
-#if defined(__i386__)
- NSDictionary *defaults = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"AppleMagnifiedMode", nil];
- [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
- [defaults release];
-#endif
-}
-
void PluginProcess::setModalWindowIsShowing(bool modalWindowIsShowing)
{
parentProcessConnection()->send(Messages::PluginProcessProxy::SetModalWindowIsShowing(modalWindowIsShowing), 0);
@@ -351,28 +326,40 @@
void PluginProcess::platformInitializePluginProcess(const PluginProcessCreationParameters& parameters)
{
m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
-
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)",
- "visible name of the plug-in host process. The first argument is the plug-in name "
- "and the second argument is the application name."),
- [[(NSString *)parameters.pluginPath lastPathComponent] stringByDeletingPathExtension],
- (NSString *)parameters.parentProcessName];
-
- WKSetVisibleApplicationName((CFStringRef)applicationName);
-
- // FIXME: PluginProcess initializes sandbox later than normal for ChildProcesses, because it needs
- // to know profile directory path. Switch to normal initialization scheme once the path can be determined earlier.
- enterSandbox(parameters.sandboxProfileDirectoryPath);
-
if (parameters.processType == TypeSnapshotProcess)
muteAudio();
}
-void PluginProcess::enterSandbox(const String& sandboxProfileDirectoryPath)
+void PluginProcess::platformInitializeProcess(const ChildProcessInitializationParameters& parameters)
{
- SandboxInitializationParameters sandboxParameters;
+#if defined(__i386__)
+ // Initialize the shim.
+ initializeShim();
+#endif
- String sandboxProfile = loadSandboxProfile(m_pluginPath, sandboxProfileDirectoryPath);
+ // Initialize Cocoa overrides.
+ initializeCocoaOverrides();
+
+ // FIXME: It would be better to proxy SetCursor calls over to the UI process instead of
+ // allowing plug-ins to change the mouse cursor at any time.
+ WKEnableSettingCursorWhenInBackground();
+
+#if defined(__i386__)
+ NSDictionary *defaults = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"AppleMagnifiedMode", nil];
+ [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
+ [defaults release];
+#endif
+}
+
+void PluginProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
+{
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name and the second argument is the application name."), [[(NSString *)m_pluginPath lastPathComponent] stringByDeletingPathExtension], (NSString *)parameters.uiProcessName];
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+}
+
+void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
+{
+ String sandboxProfile = loadSandboxProfile(m_pluginPath, parameters.extraInitializationData.get("sandbox-profile-directory-path"));
if (sandboxProfile.isEmpty())
return;
@@ -403,7 +390,7 @@
RetainPtr<NSDictionary> defaults = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"NSUseRemoteSavePanel", nil]);
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults.get()];
- ChildProcess::initializeSandbox(m_childProcessInitializationParameters, sandboxParameters);
+ ChildProcess::initializeSandbox(parameters, sandboxParameters);
}
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h
index 35a3e44..567101b 100644
--- a/Source/WebKit2/Shared/ChildProcess.h
+++ b/Source/WebKit2/Shared/ChildProcess.h
@@ -30,7 +30,9 @@
#include "MessageReceiverMap.h"
#include "MessageSender.h"
#include <WebCore/RunLoop.h>
+#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
+#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
@@ -41,6 +43,7 @@
String uiProcessName;
String clientIdentifier;
CoreIPC::Connection::Identifier connectionIdentifier;
+ HashMap<String, String> extraInitializationData;
};
class ChildProcess : protected CoreIPC::Connection::Client, public CoreIPC::MessageSender<ChildProcess> {
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h b/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h
index d08177c..784bec8 100644
--- a/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.h
@@ -50,6 +50,7 @@
virtual bool getConnectionIdentifier(CoreIPC::Connection::Identifier& identifier);
virtual bool getClientIdentifier(String& clientIdentifier);
virtual bool getClientProcessName(String& clientProcessName);
+ virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData);
virtual void doPostRunWork();
@@ -82,6 +83,9 @@
if (!delegate.getClientProcessName(parameters.uiProcessName))
return EXIT_FAILURE;
+ if (!delegate.getExtraInitializationData(parameters.extraInitializationData))
+ return EXIT_FAILURE;
+
// FIXME: This should be moved to ChildProcessMac if it is still necessary.
String localization = commandLine["localization"];
RetainPtr<CFStringRef> cfLocalization(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm b/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm
index 4cf09c3..8a0c36c 100644
--- a/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm
@@ -88,6 +88,11 @@
return true;
}
+bool ChildProcessMainDelegate::getExtraInitializationData(HashMap<String, String>&)
+{
+ return true;
+}
+
void ChildProcessMainDelegate::doPostRunWork()
{
}
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h
index be3fa9e..0c1c460 100644
--- a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h
@@ -30,7 +30,6 @@
#error WEBKIT_XPC_SERVICE_INITIALIZER must be defined.
#endif
-#import <AvailabilityMacros.h>
#import <crt_externs.h>
#import <dlfcn.h>
#import <mach-o/dyld.h>
@@ -39,8 +38,6 @@
#import <stdlib.h>
#import <xpc/xpc.h>
-extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
-
#define STRINGIZE(exp) #exp
#define STRINGIZE_VALUE_OF(exp) STRINGIZE(exp)
@@ -117,7 +114,7 @@
exit(EXIT_FAILURE);
}
- typedef void (*InitializerFunction)(const char* clientIdentifer, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);
+ typedef void (*InitializerFunction)(xpc_connection_t, xpc_object_t);
InitializerFunction initializerFunctionPtr = reinterpret_cast<InitializerFunction>(dlsym(frameworkLibrary, STRINGIZE_VALUE_OF(WEBKIT_XPC_SERVICE_INITIALIZER)));
if (!initializerFunctionPtr) {
NSLog(@"Unable to find entry point in WebKit2.framework loaded from path: %s (Error: %s)", xpc_dictionary_get_string(event, "framework-executable-path"), dlerror());
@@ -132,12 +129,7 @@
dup2(xpc_dictionary_dup_fd(event, "stdout"), STDOUT_FILENO);
dup2(xpc_dictionary_dup_fd(event, "stderr"), STDERR_FILENO);
- initializerFunctionPtr(
- xpc_dictionary_get_string(event, "client-identifier"),
- peer,
- xpc_dictionary_copy_mach_send(event, "server-port"),
- xpc_dictionary_get_string(event, "ui-process-name")
- );
+ initializerFunctionPtr(peer, event);
}
}
});
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h
index 6792992..fd4f32b 100644
--- a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.h
@@ -31,10 +31,9 @@
#endif
#import <xpc/xpc.h>
-extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
// Forward declare the specified initializer.
-extern "C" void WEBKIT_XPC_SERVICE_INITIALIZER(const char* clientIdentifier, xpc_connection_t, mach_port_t serverPort, const char* uiProcessName);
+extern "C" void WEBKIT_XPC_SERVICE_INITIALIZER(xpc_connection_t, xpc_object_t);
namespace WebKit {
@@ -57,12 +56,7 @@
xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply);
xpc_release(reply);
- WEBKIT_XPC_SERVICE_INITIALIZER(
- xpc_dictionary_get_string(event, "client-identifier"),
- peer,
- xpc_dictionary_copy_mach_send(event, "server-port"),
- xpc_dictionary_get_string(event, "ui-process-name")
- );
+ WEBKIT_XPC_SERVICE_INITIALIZER(peer, event);
}
}
});
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h
new file mode 100644
index 0000000..0b1a4e3
--- /dev/null
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef XPCServiceEntryPoint_h
+#define XPCServiceEntryPoint_h
+
+#if HAVE(XPC)
+
+#import "ChildProcess.h"
+#import "WebKit2Initialize.h"
+#import <xpc/xpc.h>
+
+namespace WebKit {
+
+class XPCServiceInitializerDelegate {
+public:
+ XPCServiceInitializerDelegate(xpc_connection_t connection, xpc_object_t initializerMessage)
+ : m_connection(connection)
+ , m_initializerMessage(initializerMessage)
+ {
+ }
+
+ virtual ~XPCServiceInitializerDelegate();
+
+ virtual bool getConnectionIdentifier(CoreIPC::Connection::Identifier& identifier);
+ virtual bool getClientIdentifier(String& clientIdentifier);
+ virtual bool getClientProcessName(String& clientProcessName);
+ virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData);
+
+protected:
+ xpc_connection_t m_connection;
+ xpc_object_t m_initializerMessage;
+};
+
+template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
+void XPCServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
+{
+ XPCServiceInitializerDelegateType delegate(connection, initializerMessage);
+
+ InitializeWebKit2();
+
+ ChildProcessInitializationParameters parameters;
+ if (!delegate.getConnectionIdentifier(parameters.connectionIdentifier))
+ exit(EXIT_FAILURE);
+
+ if (!delegate.getClientIdentifier(parameters.clientIdentifier))
+ exit(EXIT_FAILURE);
+
+ if (!delegate.getClientProcessName(parameters.uiProcessName))
+ exit(EXIT_FAILURE);
+
+ if (!delegate.getExtraInitializationData(parameters.extraInitializationData))
+ exit(EXIT_FAILURE);
+
+ XPCServiceType::shared().initialize(parameters);
+}
+
+} // namespace WebKit
+
+#endif // HAVE(XPC)
+
+#endif // XPCServiceEntryPoint_h
diff --git a/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm
new file mode 100644
index 0000000..98c5b4b
--- /dev/null
+++ b/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 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"
+
+#if HAVE(XPC)
+
+#import "XPCServiceEntryPoint.h"
+
+extern "C" mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
+
+namespace WebKit {
+
+XPCServiceInitializerDelegate::~XPCServiceInitializerDelegate()
+{
+}
+
+bool XPCServiceInitializerDelegate::getConnectionIdentifier(CoreIPC::Connection::Identifier& identifier)
+{
+ identifier = CoreIPC::Connection::Identifier(xpc_dictionary_copy_mach_send(m_initializerMessage, "server-port"), m_connection);
+ return true;
+}
+
+bool XPCServiceInitializerDelegate::getClientIdentifier(String& clientIdentifier)
+{
+ clientIdentifier = xpc_dictionary_get_string(m_initializerMessage, "client-identifier");
+ if (clientIdentifier.isEmpty())
+ return false;
+ return true;
+}
+
+bool XPCServiceInitializerDelegate::getClientProcessName(String& clientProcessName)
+{
+ clientProcessName = xpc_dictionary_get_string(m_initializerMessage, "ui-process-name");
+ if (clientProcessName.isEmpty())
+ return false;
+ return true;
+}
+
+bool XPCServiceInitializerDelegate::getExtraInitializationData(HashMap<String, String>&)
+{
+ return true;
+}
+
+} // namespace WebKit
+
+#endif // HAVE(XPC)
diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
index f5e5101..e11fc8d 100644
--- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
@@ -39,23 +39,17 @@
void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
{
- encoder << pluginPath;
encoder.encodeEnum(processType);
encoder << supportsAsynchronousPluginInitialization;
encoder << minimumLifetime;
encoder << terminationTimeout;
-
#if PLATFORM(MAC)
- encoder << parentProcessName;
encoder << acceleratedCompositingPort;
- encoder << sandboxProfileDirectoryPath;
#endif
}
bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginProcessCreationParameters& result)
{
- if (!decoder->decode(result.pluginPath))
- return false;
if (!decoder->decodeEnum(result.processType))
return false;
if (!decoder->decode(result.supportsAsynchronousPluginInitialization))
@@ -65,12 +59,8 @@
if (!decoder->decode(result.terminationTimeout))
return false;
#if PLATFORM(MAC)
- if (!decoder->decode(result.parentProcessName))
- return false;
if (!decoder->decode(result.acceleratedCompositingPort))
return false;
- if (!decoder->decode(result.sandboxProfileDirectoryPath))
- return false;
#endif
return true;
diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
index 1b3f9ff..36181e2 100644
--- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
+++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
@@ -29,7 +29,6 @@
#if ENABLE(PLUGIN_PROCESS)
#include "PluginProcess.h"
-#include <wtf/text/WTFString.h>
#if PLATFORM(MAC)
#include "MachPort.h"
@@ -48,7 +47,6 @@
void encode(CoreIPC::ArgumentEncoder&) const;
static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&);
- String pluginPath;
PluginProcess::Type processType;
bool supportsAsynchronousPluginInitialization;
@@ -56,9 +54,7 @@
double terminationTimeout;
#if PLATFORM(MAC)
- String parentProcessName;
CoreIPC::MachPort acceleratedCompositingPort;
- String sandboxProfileDirectoryPath;
#endif
};
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
index 3ccdf6c..85467ee 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
@@ -28,12 +28,11 @@
#include "Connection.h"
#include "PlatformProcessIdentifier.h"
+#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
-
-#ifndef NDEBUG
+#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
-#endif
namespace WebKit {
@@ -61,6 +60,7 @@
struct LaunchOptions {
ProcessType processType;
+ HashMap<String, String> extraInitializationData;
#if PLATFORM(MAC)
static const cpu_type_t MatchCurrentArchitecture = 0;
cpu_type_t architecture;
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index 87bbf64..63758bb 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -178,10 +178,10 @@
}
}
-static void connectToServiceForDevelopment(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID)
+static void connectToService(const ProcessLauncher::LaunchOptions& launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID)
{
// Create a connection to the WebKit2 XPC service.
- xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, true), 0);
+ xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, forDevelopment), 0);
xpc_connection_set_instance(connection, instanceUUID->uuid);
// XPC requires having an event handler, even if it is not used.
@@ -204,8 +204,19 @@
xpc_dictionary_set_mach_send(bootstrapMessage, "server-port", listeningPort);
xpc_dictionary_set_string(bootstrapMessage, "client-identifier", clientIdentifier.data());
xpc_dictionary_set_string(bootstrapMessage, "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]);
- xpc_dictionary_set_fd(bootstrapMessage, "stdout", STDOUT_FILENO);
- xpc_dictionary_set_fd(bootstrapMessage, "stderr", STDERR_FILENO);
+
+ if (forDevelopment) {
+ xpc_dictionary_set_fd(bootstrapMessage, "stdout", STDOUT_FILENO);
+ xpc_dictionary_set_fd(bootstrapMessage, "stderr", STDERR_FILENO);
+ }
+
+ xpc_object_t extraInitializationData = xpc_dictionary_create(0, 0, 0);
+ HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin();
+ HashMap<String, String>::const_iterator end = launchOptions.extraInitializationData.end();
+ for (; it != end; ++it)
+ xpc_dictionary_set_string(extraInitializationData, it->key.utf8().data(), it->value.utf8().data());
+ xpc_dictionary_set_value(bootstrapMessage, "extra-initialization-data", extraInitializationData);
+ xpc_release(extraInitializationData);
that->ref();
@@ -235,7 +246,7 @@
xpc_release(bootstrapMessage);
}
-static void createServiceForDevelopment(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)
+static void connectToReExecService(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)
{
EnvironmentVariables environmentVariables;
addDYLDEnvironmentAdditions(launchOptions, true, environmentVariables);
@@ -256,7 +267,7 @@
xpc_connection_set_event_handler(reExecConnection, ^(xpc_object_t event) {
ASSERT(xpc_get_type(event) == XPC_TYPE_ERROR);
- connectToServiceForDevelopment(launchOptions, that, didFinishLaunchingProcessFunction, instanceUUID.get());
+ connectToService(launchOptions, true, that, didFinishLaunchingProcessFunction, instanceUUID.get());
// Release the connection.
xpc_release(reExecConnection);
@@ -290,63 +301,19 @@
xpc_release(reExecMessage);
}
-static void createService(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)
+static void createService(const ProcessLauncher::LaunchOptions& launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)
{
+ if (forDevelopment) {
+ connectToReExecService(launchOptions, that, didFinishLaunchingProcessFunction);
+ return;
+ }
+
// Generate the uuid for the service instance we are about to create.
// FIXME: This UUID should be stored on the ChildProcessProxy.
RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create();
-
- // Create a connection to the WebKit2 XPC service.
- xpc_connection_t connection = xpc_connection_create(serviceName(launchOptions, false), 0);
- xpc_connection_set_instance(connection, instanceUUID->uuid);
-
- // XPC requires having an event handler, even if it is not used.
- xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { });
- xpc_connection_resume(connection);
-
- // Create the listening port.
- mach_port_t listeningPort;
- mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
-
- // Insert a send right so we can send to it.
- mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND);
-
- NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
- CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname();
-
- xpc_object_t bootstrapMessage = xpc_dictionary_create(0, 0, 0);
- xpc_dictionary_set_string(bootstrapMessage, "message-name", "bootstrap");
- xpc_dictionary_set_mach_send(bootstrapMessage, "server-port", listeningPort);
- xpc_dictionary_set_string(bootstrapMessage, "client-identifier", clientIdentifier.data());
- xpc_dictionary_set_string(bootstrapMessage, "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]);
-
- that->ref();
-
- xpc_connection_send_message_with_reply(connection, bootstrapMessage, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(xpc_object_t reply) {
- xpc_type_t type = xpc_get_type(reply);
- if (type == XPC_TYPE_ERROR) {
- // We failed to launch. Release the send right.
- mach_port_deallocate(mach_task_self(), listeningPort);
-
- // And the receive right.
- mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1);
-
- RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, 0, CoreIPC::Connection::Identifier()));
- } else {
- ASSERT(type == XPC_TYPE_DICTIONARY);
- ASSERT(!strcmp(xpc_dictionary_get_string(reply, "message-name"), "process-finished-launching"));
-
- // The process has finished launching, grab the pid from the connection.
- pid_t processIdentifier = xpc_connection_get_pid(connection);
-
- // We've finished launching the process, message back to the main run loop.
- RunLoop::main()->dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, CoreIPC::Connection::Identifier(listeningPort, connection)));
- }
-
- that->deref();
- });
- xpc_release(bootstrapMessage);
+ connectToService(launchOptions, false, that, didFinishLaunchingProcessFunction, instanceUUID.get());
}
+
#endif
static bool tryPreexistingProcess(const ProcessLauncher::LaunchOptions& launchOptions, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction)
@@ -443,8 +410,35 @@
// Make a unique, per pid, per process launcher web process service name.
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), that).utf8();
- const char* args[] = { [processAppExecutablePath fileSystemRepresentation], [frameworkExecutablePath fileSystemRepresentation], "-type", ProcessLauncher::processTypeAsString(launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), "-client-identifier", clientIdentifier.data(),
- "-ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String], 0 };
+ Vector<const char*> args;
+ args.append([processAppExecutablePath fileSystemRepresentation]);
+ args.append([frameworkExecutablePath fileSystemRepresentation]);
+ args.append("-type");
+ args.append(ProcessLauncher::processTypeAsString(launchOptions.processType));
+ args.append("-servicename");
+ args.append(serviceName.data());
+ args.append("-localization");
+ args.append(localization.data());
+ args.append("-client-identifier");
+ args.append(clientIdentifier.data());
+ args.append("-ui-process-name");
+ args.append([[[NSProcessInfo processInfo] processName] UTF8String]);
+
+ HashMap<String, String>::const_iterator it = launchOptions.extraInitializationData.begin();
+ HashMap<String, String>::const_iterator end = launchOptions.extraInitializationData.end();
+ Vector<CString> temps;
+ for (; it != end; ++it) {
+ String keyPlusDash = "-" + it->key;
+ CString key(keyPlusDash.utf8().data());
+ temps.append(key);
+ args.append(key.data());
+
+ CString value(it->value.utf8().data());
+ temps.append(value);
+ args.append(value.data());
+ }
+
+ args.append(nullptr);
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
@@ -481,7 +475,7 @@
posix_spawnattr_setflags(&attr, flags);
pid_t processIdentifier = 0;
- int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args), environmentVariables.environmentPointer());
+ int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args.data()), environmentVariables.environmentPointer());
posix_spawnattr_destroy(&attr);
@@ -513,10 +507,7 @@
#if HAVE(XPC)
if (m_launchOptions.useXPC) {
- if (isWebKitDevelopmentBuild)
- createServiceForDevelopment(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess);
- else
- createService(m_launchOptions, this, &ProcessLauncher::didFinishLaunchingProcess);
+ createService(m_launchOptions, isWebKitDevelopmentBuild, this, &ProcessLauncher::didFinishLaunchingProcess);
return;
}
#endif
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 7d90c41..5913555 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -203,13 +203,9 @@
m_connection->open();
PluginProcessCreationParameters parameters;
-
- parameters.pluginPath = m_pluginInfo.path;
parameters.processType = m_processType;
-
parameters.minimumLifetime = minimumLifetime;
parameters.terminationTimeout = shutdownTimeout;
-
platformInitializePluginProcess(parameters);
// Initialize the plug-in host process.
diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
index ffe74bc..bc85bff 100644
--- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
@@ -136,6 +136,14 @@
launchOptions.architecture = pluginInfo.pluginArchitecture;
launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo);
+ launchOptions.extraInitializationData.add("plugin-path", pluginInfo.path);
+
+ // FIXME: We should rip this out once we have a good place to install plug-in
+ // sandbox profiles.
+ NSString* sandboxProfileDirectoryPath = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2PlugInSandboxProfileDirectoryPathKey];
+ if (sandboxProfileDirectoryPath)
+ launchOptions.extraInitializationData.add("sandbox-profile-directory-path", String(sandboxProfileDirectoryPath));
+
#if HAVE(XPC)
launchOptions.useXPC = shouldUseXPC();
#endif
@@ -143,22 +151,14 @@
void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
- // For know only Flash is known to behave with asynchronous plug-in initialization.
+ // For now only Flash is known to behave with asynchronous plug-in initialization.
parameters.supportsAsynchronousPluginInitialization = m_pluginInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin";
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
- parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort];
-
if (renderServerPort != MACH_PORT_NULL)
parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND);
#endif
-
- // FIXME: We should rip this out once we have a good place to install plug-in
- // sandbox profiles.
- NSString* sandboxProfileDirectoryPath = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2PlugInSandboxProfileDirectoryPathKey];
- if (sandboxProfileDirectoryPath)
- parameters.sandboxProfileDirectoryPath = String(sandboxProfileDirectoryPath);
}
bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber)
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 9cb8567..de02bb0 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -914,6 +914,8 @@
BCBD3915125BB1A800D2C29F /* WebPageProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBD3913125BB1A800D2C29F /* WebPageProxyMessages.h */; };
BCBD3C3B125BFA7A00D2C29F /* StringPairVector.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */; };
BCBECDC316B5CEB100047A1A /* PluginService.Development.Main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBECDC116B5CE0D00047A1A /* PluginService.Development.Main.mm */; };
+ BCBECDE716B6416800047A1A /* XPCServiceEntryPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */; };
+ BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */; };
BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */; };
BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */; };
BCC43AC7127B99DE00317F16 /* WebPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */; };
@@ -2263,6 +2265,8 @@
BCBECDC016B5CE0D00047A1A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BCBECDC116B5CE0D00047A1A /* PluginService.Development.Main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginService.Development.Main.mm; sourceTree = "<group>"; };
BCBECDC216B5CE2A00047A1A /* PluginService.Development.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = PluginService.Development.xcconfig; sourceTree = "<group>"; };
+ BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XPCServiceEntryPoint.mm; sourceTree = "<group>"; };
+ BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCServiceEntryPoint.h; sourceTree = "<group>"; };
BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformPopupMenuData.cpp; sourceTree = "<group>"; };
BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformPopupMenuData.h; sourceTree = "<group>"; };
BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPopupMenuMac.mm; sourceTree = "<group>"; };
@@ -4177,8 +4181,10 @@
BC82836B16B3587900A278FE /* XPCService */ = {
isa = PBXGroup;
children = (
- BC82839616B47EC400A278FE /* XPCServiceBootstrapper.h */,
BC82839716B480F600A278FE /* XPCServiceBootstrapper.Development.h */,
+ BC82839616B47EC400A278FE /* XPCServiceBootstrapper.h */,
+ BCBECDE616B6416700047A1A /* XPCServiceEntryPoint.h */,
+ BCBECDE516B6416700047A1A /* XPCServiceEntryPoint.mm */,
);
name = XPCService;
path = mac/XPCService;
@@ -5320,6 +5326,7 @@
518E8F0A16B2093700E91429 /* DownloadAuthenticationClient.h in Headers */,
518E8F0C16B2093700E91429 /* DownloadManager.h in Headers */,
BC82837A16B36A4F00A278FE /* ChildProcessMain.h in Headers */,
+ BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */,
A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -6436,6 +6443,7 @@
BC82839916B48DC000A278FE /* WebContentServiceEntryPoint.mm in Sources */,
BC8283AC16B4BF3F00A278FE /* NetworkServiceEntryPoint.mm in Sources */,
BC82844D16B5081C00A278FE /* PluginServiceEntryPoint.mm in Sources */,
+ BCBECDE716B6416800047A1A /* XPCServiceEntryPoint.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm
index 2910ceb..671d2ba 100644
--- a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm
+++ b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/WebContentServiceMain.Development.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializeWebContentService
+#define WEBKIT_XPC_SERVICE_INITIALIZER WebContentServiceInitializer
#include "XPCServiceBootstrapper.Development.h"
using namespace WebKit;
diff --git a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm
index e6abf7c..3368562 100644
--- a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm
+++ b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/WebContentServiceMain.mm
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define WEBKIT_XPC_SERVICE_INITIALIZER initializeWebContentService
+#define WEBKIT_XPC_SERVICE_INITIALIZER WebContentServiceInitializer
#include "XPCServiceBootstrapper.h"
using namespace WebKit;
diff --git a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
index d9a0af8..34ab8da 100644
--- a/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
+++ b/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
@@ -29,33 +29,24 @@
#import "EnvironmentUtilities.h"
#import "WKBase.h"
-#import "WebKit2Initialize.h"
#import "WebProcess.h"
+#import "XPCServiceEntryPoint.h"
#import <WebCore/RunLoop.h>
-#import <stdio.h>
-#import <stdlib.h>
-#import <xpc/xpc.h>
using namespace WebCore;
using namespace WebKit;
-extern "C" WK_EXPORT void initializeWebContentService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName);
+extern "C" WK_EXPORT void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage);
-void initializeWebContentService(const char* clientIdentifier, xpc_connection_t connection, mach_port_t serverPort, const char* uiProcessName)
+void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
{
- // Remove the SecItemShim shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
+ // Remove the SecItemShim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
// the this process don't try to insert the shim and crash.
EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib");
RunLoop::setUseApplicationRunLoopOnMainRunLoop();
- InitializeWebKit2();
- ChildProcessInitializationParameters parameters;
- parameters.uiProcessName = uiProcessName;
- parameters.clientIdentifier = clientIdentifier;
- parameters.connectionIdentifier = CoreIPC::Connection::Identifier(serverPort, connection);
-
- WebProcess::shared().initialize(parameters);
+ XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(connection, initializerMessage);
}
#endif // HAVE(XPC)