From 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 18 Sep 2012 15:53:33 +0200 Subject: Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886) New snapshot with various build fixes --- .../PluginProcess/PluginControllerProxy.cpp | 8 +++++ .../WebKit2/PluginProcess/PluginControllerProxy.h | 3 ++ .../PluginControllerProxy.messages.in | 3 ++ .../WebKit2/PluginProcess/mac/PluginProcessMac.mm | 35 ++++++++++++++++++++++ 4 files changed, 49 insertions(+) (limited to 'Source/WebKit2/PluginProcess') diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp index 2ad41daa5..31a5d61a6 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -563,6 +563,14 @@ void PluginControllerProxy::getPluginScriptableNPObject(uint64_t& pluginScriptab releaseNPObject(pluginScriptableNPObject); } +void PluginControllerProxy::storageBlockingStateChanged(bool isStorageBlockingEnabled) +{ + if (m_storageBlockingEnabled != isStorageBlockingEnabled) { + m_storageBlockingEnabled = isStorageBlockingEnabled; + m_plugin->storageBlockingStateChanged(m_storageBlockingEnabled); + } +} + void PluginControllerProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled) { m_isPrivateBrowsingEnabled = isPrivateBrowsingEnabled; diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h index a9d35a663..b4a40673e 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.h +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h @@ -35,6 +35,7 @@ #include "ShareableBitmap.h" #include "WebProcessConnectionMessages.h" #include +#include #include namespace CoreIPC { @@ -152,6 +153,7 @@ private: void updateLayerHostingContext(LayerHostingMode); #endif + void storageBlockingStateChanged(bool); void privateBrowsingStateChanged(bool); void getFormValue(bool& returnValue, String& formValue); @@ -163,6 +165,7 @@ private: uint64_t m_pluginInstanceID; String m_userAgent; + bool m_storageBlockingEnabled; bool m_isPrivateBrowsingEnabled; bool m_isAcceleratedCompositingEnabled; bool m_isInitializing; diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in index 371bee237..d7c2d02b2 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in @@ -106,6 +106,9 @@ messages -> PluginControllerProxy { # Return a snapshot of the plugin Snapshot() -> (WebKit::ShareableBitmap::Handle backingStoreHandle) + # Sent when storage blocking policy changes + StorageBlockingStateChanged(bool storageBlockingEnabled) + # Sent when private browsing is enabled or disabled PrivateBrowsingStateChanged(bool isPrivateBrowsingEnabled) diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index f4e834c57..7a8cb35f4 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -39,6 +39,10 @@ #import #import +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +#import "NetscapeSandboxFunctions.h" +#endif + namespace WebKit { static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT; @@ -262,6 +266,33 @@ void PluginProcess::setFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) m_connection->send(Messages::PluginProcessProxy::SetFullscreenWindowIsShowing(fullscreenWindowIsShowing), 0); } +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +static void initializeSandbox(const String& pluginPath) +{ + RetainPtr cfPluginPath = adoptCF(pluginPath.createCFString()); + RetainPtr pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false)); + if (!pluginURL) + return; + + RetainPtr pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); + if (!pluginBundle) + return; + + CFStringRef bundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); + if (!bundleIdentifier) + return; + + RetainPtr sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier); + RetainPtr pluginSandboxDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, CFSTR("/usr/share/sandbox/"), kCFURLPOSIXPathStyle, YES)); + RetainPtr sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, pluginSandboxDirectory.get())); + RetainPtr profileString = [[NSString alloc] initWithContentsOfURL:(NSURL *)sandboxURL.get() encoding:NSUTF8StringEncoding error:NULL]; + if (!profileString) + return; + + enterSandbox([profileString.get() UTF8String], 0, 0); +} +#endif + void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters) { m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); @@ -273,6 +304,10 @@ void PluginProcess::platformInitialize(const PluginProcessCreationParameters& pa (NSString *)parameters.parentProcessName]; WKSetVisibleApplicationName((CFStringRef)applicationName); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + initializeSandbox(m_pluginPath); +#endif } } // namespace WebKit -- cgit v1.2.1