Modified: trunk/Source/WebKit2/ChangeLog (129308 => 129309)
--- trunk/Source/WebKit2/ChangeLog 2012-09-22 16:17:57 UTC (rev 129308)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-22 22:18:41 UTC (rev 129309)
@@ -1,3 +1,28 @@
+2012-09-22 Sam Weinig <[email protected]>
+
+ Allow setting a custom path to where the plug-in sandbox profiles are being kept
+ https://bugs.webkit.org/show_bug.cgi?id=97399
+
+ Reviewed by Anders Carlsson.
+
+ Add a new default to allow controlling where to look for plug-in sandbox profiles
+ called "PlugInSandboxProfileDirectoryPath".
+
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::initializeSandbox):
+ Use the passed in sandboxProfileDirectoryPath instead of hard coding /usr/share/sandbox/.
+
+ (WebKit::PluginProcess::platformInitialize):
+ * Shared/Plugins/PluginProcessCreationParameters.cpp:
+ (WebKit::PluginProcessCreationParameters::encode):
+ (WebKit::PluginProcessCreationParameters::decode):
+ * Shared/Plugins/PluginProcessCreationParameters.h:
+ (PluginProcessCreationParameters):
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::platformInitializePluginProcess):
+ Grab the sandboxProfileDirectoryPath from standardUserDefaults and pass it to
+ the plug-in.
+
2012-09-21 Sam Weinig <[email protected]>
Fix the Lion and Snow Leopard builds.
Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (129308 => 129309)
--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm 2012-09-22 16:17:57 UTC (rev 129308)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm 2012-09-22 22:18:41 UTC (rev 129309)
@@ -267,8 +267,11 @@
}
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
-static void initializeSandbox(const String& pluginPath)
+static void initializeSandbox(const String& pluginPath, const String& sandboxProfileDirectoryPath)
{
+ if (sandboxProfileDirectoryPath.isEmpty())
+ return;
+
RetainPtr<CFStringRef> cfPluginPath = adoptCF(pluginPath.createCFString());
RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false));
if (!pluginURL)
@@ -282,9 +285,12 @@
if (!bundleIdentifier)
return;
+ RetainPtr<CFStringRef> cfSandboxProfileDirectoryPath = adoptCF(sandboxProfileDirectoryPath.createCFString());
+ RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, cfSandboxProfileDirectoryPath.get(), kCFURLPOSIXPathStyle, TRUE));
+
RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier);
- RetainPtr<CFURLRef> pluginSandboxDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, CFSTR("/usr/share/sandbox/"), kCFURLPOSIXPathStyle, YES));
- RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, pluginSandboxDirectory.get()));
+ RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get()));
+
RetainPtr<NSString> profileString = [[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL];
if (!profileString)
return;
@@ -306,7 +312,7 @@
WKSetVisibleApplicationName((CFStringRef)applicationName);
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- initializeSandbox(m_pluginPath);
+ initializeSandbox(m_pluginPath, parameters.sandboxProfileDirectoryPath);
#endif
}
Modified: trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp (129308 => 129309)
--- trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp 2012-09-22 16:17:57 UTC (rev 129308)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp 2012-09-22 22:18:41 UTC (rev 129309)
@@ -47,6 +47,7 @@
#if PLATFORM(MAC)
encoder->encode(parentProcessName);
encoder->encode(acceleratedCompositingPort);
+ encoder->encode(sandboxProfileDirectoryPath);
#endif
}
@@ -65,6 +66,8 @@
return false;
if (!decoder->decode(result.acceleratedCompositingPort))
return false;
+ if (!decoder->decode(result.sandboxProfileDirectoryPath))
+ return false;
#endif
return true;
Modified: trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h (129308 => 129309)
--- trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h 2012-09-22 16:17:57 UTC (rev 129308)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h 2012-09-22 22:18:41 UTC (rev 129309)
@@ -56,6 +56,7 @@
#if PLATFORM(MAC)
String parentProcessName;
CoreIPC::MachPort acceleratedCompositingPort;
+ String sandboxProfileDirectoryPath;
#endif
};
Modified: trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm (129308 => 129309)
--- trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2012-09-22 16:17:57 UTC (rev 129308)
+++ trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm 2012-09-22 22:18:41 UTC (rev 129309)
@@ -53,6 +53,8 @@
@end
+NSString * const WebKit2PlugInSandboxProfileDirectoryPathKey = @"WebKit2PlugInSandboxProfileDirectoryPath";
+
using namespace WebCore;
namespace WebKit {
@@ -132,6 +134,12 @@
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)