Separate enabling sandbox extensions from the WEB_PROCESS_SANDBOX flag
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 May 2014 23:28:40 +0000 (23:28 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 May 2014 23:28:40 +0000 (23:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133016

Reviewed by Alexey Proskuryakov.

Add a distinct SANDBOX_EXTENSIONS flag to guard sandbox extensions
and switch over to it in the places that extensions are used.

* Shared/SandboxExtension.h:
* Shared/mac/SandboxExtensionMac.mm:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChooseFilesForOpenPanel):
* WebKit2Prefix.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168984 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/SandboxExtension.h
Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebKit2Prefix.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm

index 74b7031..6161c23 100644 (file)
@@ -1,3 +1,24 @@
+2014-05-16  Oliver Hunt  <oliver@apple.com>
+
+        Separate enabling sandbox extensions from the WEB_PROCESS_SANDBOX flag
+        https://bugs.webkit.org/show_bug.cgi?id=133016
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add a distinct SANDBOX_EXTENSIONS flag to guard sandbox extensions
+        and switch over to it in the places that extensions are used.
+
+        * Shared/SandboxExtension.h:
+        * Shared/mac/SandboxExtensionMac.mm:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
+        * WebKit2Prefix.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2014-05-16  Benjamin Poulain  <bpoulain@apple.com>
 
         [iOS][WK2] Add a heuristic to set the right horizontal offset on rotation for responsive websites
index 06c6873..5462e4a 100644 (file)
@@ -32,7 +32,7 @@
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
 typedef struct __WKSandboxExtension* WKSandboxExtensionRef;
 #endif
 
@@ -62,7 +62,7 @@ public:
 
     private:
         friend class SandboxExtension;
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
         mutable WKSandboxExtensionRef m_sandboxExtension;
 #endif
     };
@@ -81,7 +81,7 @@ public:
         static bool decode(IPC::ArgumentDecoder&, HandleArray&);
        
     private:
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
         std::unique_ptr<Handle[]> m_data;
         size_t m_size;
 #else
@@ -104,13 +104,13 @@ public:
 private:
     explicit SandboxExtension(const Handle&);
                      
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
     mutable WKSandboxExtensionRef m_sandboxExtension;
     size_t m_useCount;
 #endif
 };
 
-#if !ENABLE(WEB_PROCESS_SANDBOX)
+#if !ENABLE(SANDBOX_EXTENSIONS)
 inline SandboxExtension::Handle::Handle() { }
 inline SandboxExtension::Handle::~Handle() { }
 inline void SandboxExtension::Handle::encode(IPC::ArgumentEncoder&) const { }
index e2a2ec5..b99f1a1 100644 (file)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "SandboxExtension.h"
 
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
 
 #import "ArgumentDecoder.h"
 #import "ArgumentEncoder.h"
@@ -322,4 +322,4 @@ bool SandboxExtension::consumePermanently(const Handle& handle)
 
 } // namespace WebKit
 
-#endif // ENABLE(WEB_PROCESS_SANDBOX)
+#endif // ENABLE(SANDBOX_EXTENSIONS)
index 0875fe9..79b66d4 100644 (file)
@@ -3601,7 +3601,7 @@ void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
     if (!isValid())
         return;
 
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
     // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
     // is gated on a way of passing SandboxExtension::Handles in a Vector.
     for (size_t i = 0; i < fileURLs.size(); ++i) {
index f97a808..78999d1 100644 (file)
@@ -32,6 +32,8 @@
 
 #if PLATFORM(COCOA)
 
+#define ENABLE_SANDBOX_EXTENSIONS 1
+
 #if !PLATFORM(IOS)
 #define ENABLE_WEB_PROCESS_SANDBOX 1
 #endif
index 04a03d7..6a2c572 100644 (file)
@@ -3083,7 +3083,7 @@ void WebPage::didCancelForOpenPanel()
     m_activeOpenPanelResultListener = 0;
 }
 
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
 void WebPage::extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle& handle)
 {
     SandboxExtension::create(handle)->consumePermanently();
index e35af2c..235a146 100644 (file)
@@ -971,7 +971,7 @@ private:
 #endif
     void didChooseFilesForOpenPanel(const Vector<String>&);
     void didCancelForOpenPanel();
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
 #endif
 
index d065672..d085368 100644 (file)
@@ -233,7 +233,7 @@ messages -> WebPage LegacyReceiver {
 #endif
     DidChooseFilesForOpenPanel(Vector<String> fileURLs)
     DidCancelForOpenPanel()
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
     ExtendSandboxForFileFromOpenPanel(WebKit::SandboxExtension::Handle sandboxExtensionHandle)
 #endif
 
index 41219a6..3cd4a67 100644 (file)
@@ -159,7 +159,7 @@ static id NSApplicationAccessibilityFocusedUIElement(NSApplication*, SEL)
 
 void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, IPC::MessageDecoder&)
 {
-#if ENABLE(WEB_PROCESS_SANDBOX)
+#if ENABLE(SANDBOX_EXTENSIONS)
     SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle);
     SandboxExtension::consumePermanently(parameters.databaseDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);