Provide an API to run sandboxed plug-ins outside of their sandbox
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2013 22:54:21 +0000 (22:54 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2013 22:54:21 +0000 (22:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116578

Reviewed by Andreas Kling.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add new overload.

* PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
(WebKit::PluginProcessMainDelegate::getExtraInitializationData):
Handle "disable-sandbox".

* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit::PluginServiceInitializerDelegate::getExtraInitializationData):
Handle "disable-sandbox".

* PluginProcess/PluginProcess.h:
Move Type to PluginProcessAttributes and remove hash traits for type.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializePluginProcess):
Update for new type name.

(WebKit::PluginProcess::initializeSandbox):
Return early if the sandbox is disabled.

* Shared/Plugins/Netscape/PluginInformation.cpp:
(WebKit::getPluginModuleInformation):
PluginInfoStore::policyForPlugin has been renamed to PluginInfoStore::defaultLoadPolicyForPlugin.

* Shared/Plugins/PluginModuleInfo.h:
Add PluginModuleLoadUnsandboxed.

* Shared/Plugins/PluginProcessAttributes.h: Added.
Add new header with various plug-in process attributes.

* Shared/Plugins/PluginProcessCreationParameters.h:
Change type enum.

* UIProcess/API/C/WKAPICast.h:
(WebKit::toWKPluginLoadPolicy):
(WebKit::toPluginModuleLoadPolicy):
Handle the unsandboxed enum.

* UIProcess/API/C/WKPage.h:
Add kWKPluginLoadPolicyLoadUnsandboxed.

* UIProcess/Plugins/PluginInfoStore.h:
Rename policyForPlugin to defaultLoadPolicyForPlugin.

* UIProcess/Plugins/PluginProcessManager.cpp:
(WebKit::PluginProcessManager::pluginProcessToken):
Add new helper function for getting a token given plug-in attributes.

(WebKit::PluginProcessManager::getPluginProcessConnection):
This now takes a pluginProcessToken.

(WebKit::PluginProcessManager::getSitesWithData):
Make sure to call pluginProcessToken.

(WebKit::PluginProcessManager::clearSiteData):
Ditto.

(WebKit::PluginProcessManager::getOrCreatePluginProcess):
This now takes a token.

* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::create):
(WebKit::PluginProcessProxy::PluginProcessProxy):
Pass the PluginProcessAttributes as well as the plug-in process token.

(WebKit::PluginProcessProxy::getLaunchOptions):
Pass the plug-in process attributes to platformGetLaunchOptions.

(WebKit::PluginProcessProxy::didClose):
Pass the token to PluginProcessCrashed.

(WebKit::PluginProcessProxy::didFinishLaunching):
Update for type change.

* UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
(WebKit::shouldBlockPlugin):
(WebKit::PluginInfoStore::defaultLoadPolicyForPlugin):
Rename policyForPlugin to defaultLoadPolicyForPlugin.

* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::platformGetLaunchOptions):
Set the "disable-sandbox" data if needed.

(WebKit::PluginProcessProxy::platformInitializePluginProcess):
(WebKit::PluginProcessProxy::openPluginPreferencePane):
Get the module info from m_pluginProcessAttributes.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
This now returns a token.

* UIProcess/WebPageProxy.messages.in:
FindPlugin now returns a token instead of the path.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getPluginProcessConnection):
Pass the token to the plug-in process manager.

* UIProcess/WebProcessProxy.messages.in:
This now takes a token.

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

* WebProcess/Plugins/PluginProcessConnection.cpp:
(WebKit::PluginProcessConnection::PluginProcessConnection):
This now takes a token.

* WebProcess/Plugins/PluginProcessConnection.h:
(WebKit::PluginProcessConnection::create):
(WebKit::PluginProcessConnection::pluginProcessToken):
Create this with a token instead of a path and process type.

* WebProcess/Plugins/PluginProcessConnectionManager.cpp:
(WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
This now takes a token.

(WebKit::PluginProcessConnectionManager::pluginProcessCrashed):
Ditto.

* WebProcess/Plugins/PluginProcessConnectionManager.messages.in:
PluginProcessCrashed now takes a token.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::create):
(WebKit::PluginProxy::PluginProxy):
These now take tokens.

(WebKit::PluginProxy::initialize):
Pass the token when getting the connection.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
Get the token from the UI process and pass it to the PluginProxy.

(WebKit::WebPage::canPluginHandleResponse):
Update now that FindPlugin returns a token.

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

34 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/HandleMessage.h
Source/WebKit2/PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm
Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
Source/WebKit2/PluginProcess/PluginProcess.h
Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp
Source/WebKit2/Shared/Plugins/PluginModuleInfo.h
Source/WebKit2/Shared/Plugins/PluginProcessAttributes.h [new file with mode: 0644]
Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h
Source/WebKit2/UIProcess/WebProcessProxy.messages.in
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp
Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h
Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.messages.in
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index d93d59f..19ebe10 100644 (file)
@@ -1,3 +1,150 @@
+2013-05-21  Anders Carlsson  <andersca@apple.com>
+
+        Provide an API to run sandboxed plug-ins outside of their sandbox
+        https://bugs.webkit.org/show_bug.cgi?id=116578
+
+        Reviewed by Andreas Kling.
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        Add new overload.
+
+        * PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
+        (WebKit::PluginProcessMainDelegate::getExtraInitializationData):
+        Handle "disable-sandbox".
+
+        * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
+        (WebKit::PluginServiceInitializerDelegate::getExtraInitializationData):
+        Handle "disable-sandbox".
+        
+        * PluginProcess/PluginProcess.h:
+        Move Type to PluginProcessAttributes and remove hash traits for type.
+        
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::PluginProcess::platformInitializePluginProcess):
+        Update for new type name.
+
+        (WebKit::PluginProcess::initializeSandbox):
+        Return early if the sandbox is disabled.
+
+        * Shared/Plugins/Netscape/PluginInformation.cpp:
+        (WebKit::getPluginModuleInformation):
+        PluginInfoStore::policyForPlugin has been renamed to PluginInfoStore::defaultLoadPolicyForPlugin.
+
+        * Shared/Plugins/PluginModuleInfo.h:
+        Add PluginModuleLoadUnsandboxed.
+
+        * Shared/Plugins/PluginProcessAttributes.h: Added.
+        Add new header with various plug-in process attributes.
+
+        * Shared/Plugins/PluginProcessCreationParameters.h:
+        Change type enum.
+
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toWKPluginLoadPolicy):
+        (WebKit::toPluginModuleLoadPolicy):
+        Handle the unsandboxed enum.
+
+        * UIProcess/API/C/WKPage.h:
+        Add kWKPluginLoadPolicyLoadUnsandboxed.
+
+        * UIProcess/Plugins/PluginInfoStore.h:
+        Rename policyForPlugin to defaultLoadPolicyForPlugin.
+
+        * UIProcess/Plugins/PluginProcessManager.cpp:
+        (WebKit::PluginProcessManager::pluginProcessToken):
+        Add new helper function for getting a token given plug-in attributes.
+
+        (WebKit::PluginProcessManager::getPluginProcessConnection):
+        This now takes a pluginProcessToken.
+
+        (WebKit::PluginProcessManager::getSitesWithData):
+        Make sure to call pluginProcessToken.
+
+        (WebKit::PluginProcessManager::clearSiteData):
+        Ditto.
+
+        (WebKit::PluginProcessManager::getOrCreatePluginProcess):
+        This now takes a token.
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::create):
+        (WebKit::PluginProcessProxy::PluginProcessProxy):
+        Pass the PluginProcessAttributes as well as the plug-in process token.
+
+        (WebKit::PluginProcessProxy::getLaunchOptions):
+        Pass the plug-in process attributes to platformGetLaunchOptions.
+
+        (WebKit::PluginProcessProxy::didClose):
+        Pass the token to PluginProcessCrashed.
+
+        (WebKit::PluginProcessProxy::didFinishLaunching):
+        Update for type change.
+
+        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+        (WebKit::shouldBlockPlugin):
+        (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin):
+        Rename policyForPlugin to defaultLoadPolicyForPlugin.
+
+        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+        (WebKit::PluginProcessProxy::platformGetLaunchOptions):
+        Set the "disable-sandbox" data if needed.
+
+        (WebKit::PluginProcessProxy::platformInitializePluginProcess):
+        (WebKit::PluginProcessProxy::openPluginPreferencePane):
+        Get the module info from m_pluginProcessAttributes.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::findPlugin):
+        This now returns a token.
+
+        * UIProcess/WebPageProxy.messages.in:
+        FindPlugin now returns a token instead of the path.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::getPluginProcessConnection):
+        Pass the token to the plug-in process manager.
+
+        * UIProcess/WebProcessProxy.messages.in:
+        This now takes a token.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::PluginProcessConnection):
+        This now takes a token.
+
+        * WebProcess/Plugins/PluginProcessConnection.h:
+        (WebKit::PluginProcessConnection::create):
+        (WebKit::PluginProcessConnection::pluginProcessToken):
+        Create this with a token instead of a path and process type.
+
+        * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
+        (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
+        This now takes a token.
+
+        (WebKit::PluginProcessConnectionManager::pluginProcessCrashed):
+        Ditto.
+
+        * WebProcess/Plugins/PluginProcessConnectionManager.messages.in:
+        PluginProcessCrashed now takes a token.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::create):
+        (WebKit::PluginProxy::PluginProxy):
+        These now take tokens.
+
+        (WebKit::PluginProxy::initialize):
+        Pass the token when getting the connection.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+        Get the token from the UI process and pass it to the PluginProxy.
+
+        (WebKit::WebPage::canPluginHandleResponse):
+        Update now that FindPlugin returns a token.
+
 2013-05-21  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] [CMake] Add support for building WebKit2
index 7758574..4095e9f 100644 (file)
@@ -185,12 +185,6 @@ void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, Arguments2<R
     (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, replyArgs.argument1, replyArgs.argument2);
 }
 
-template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2>
-void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
-{
-    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2);
-}
-    
 template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3>
 void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function)
 {
@@ -203,6 +197,18 @@ void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, Arguments3<R
     (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
 }
 
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2>
+void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2);
+}
+
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2, typename R3>
+void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
+}
+
 // Dispatch functions with delayed reply arguments.
 template<typename C, typename MF, typename R>
 void callMemberFunction(const Arguments0&, PassRefPtr<R> delayedReply, C* object, MF function)
index 1166616..73045d3 100644 (file)
@@ -87,6 +87,10 @@ public:
             return false;
         extraInitializationData.add("plugin-path", pluginPath);
 
+        String disableSandbox = m_commandLine["disable-sandbox"];
+        if (!disableSandbox.isEmpty())
+            extraInitializationData.add("disable-sandbox", disableSandbox);
+
         return true;
     }
 
index 10fe1cb..87fcc4f 100644 (file)
@@ -51,6 +51,10 @@ public:
             return false;
         extraInitializationData.add("plugin-path", pluginPath);
 
+        String disableSandbox = xpc_dictionary_get_string(extraDataInitializationDataObject, "disable-sandbox");
+        if (!disableSandbox.isEmpty())
+            extraInitializationData.add("disable-sandbox", disableSandbox);
+
         return true;
     }
 };
index 73ce0ac..0a87b2d 100644 (file)
@@ -41,12 +41,6 @@ struct PluginProcessCreationParameters;
 class PluginProcess : public ChildProcess {
     WTF_MAKE_NONCOPYABLE(PluginProcess);
 public:
-    enum Type {
-        // Start with value one since default HashTraits<> disallows zero as key.
-        TypeRegularProcess = 1,
-        TypeSnapshotProcess
-    };
-
     static PluginProcess& shared();
 
     void removeWebProcessConnection(WebProcessConnection*);
@@ -118,13 +112,6 @@ private:
 
 } // namespace WebKit
 
-namespace WTF {
-
-template<> struct DefaultHash<WebKit::PluginProcess::Type> { typedef DefaultHash<uint32_t>::Hash Hash; };
-template<> struct IsInteger<WebKit::PluginProcess::Type> { static const bool value = true; };
-
-} // namespace WTF
-
 #endif // ENABLE(PLUGIN_PROCESS)
 
 #endif // PluginProcess_h
index 534e523..586e091 100644 (file)
@@ -294,7 +294,7 @@ static void muteAudio(void)
 void PluginProcess::platformInitializePluginProcess(const PluginProcessCreationParameters& parameters)
 {
     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
-    if (parameters.processType == TypeSnapshotProcess)
+    if (parameters.processType == PluginProcessTypeSnapshot)
         muteAudio();
 }
 
@@ -341,6 +341,9 @@ void PluginProcess::initializeProcessName(const ChildProcessInitializationParame
 
 void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
 {
+    if (parameters.extraInitializationData.get("disable-sandbox") == "1")
+        return;
+
     String sandboxProfile = pluginSandboxProfile(m_pluginBundleIdentifier);
     if (sandboxProfile.isEmpty())
         return;
index 1a69508..0eb4422 100644 (file)
@@ -101,7 +101,7 @@ void getPluginModuleInformation(const PluginModuleInfo& plugin, ImmutableDiction
 #if ENABLE(NETSCAPE_PLUGIN_API)
     map.set(pluginInformationPathKey(), WebString::create(plugin.path));
     map.set(pluginInformationDisplayNameKey(), WebString::create(plugin.info.name));
-    map.set(pluginInformationDefaultLoadPolicyKey(), WebUInt64::create(toWKPluginLoadPolicy(PluginInfoStore::policyForPlugin(plugin))));
+    map.set(pluginInformationDefaultLoadPolicyKey(), WebUInt64::create(toWKPluginLoadPolicy(PluginInfoStore::defaultLoadPolicyForPlugin(plugin))));
 
     getPlatformPluginModuleInformation(plugin, map);
 #endif
index 6c58ad9..b415245 100644 (file)
@@ -38,6 +38,9 @@ enum PluginModuleLoadPolicy {
     // The plug-in module should be loaded normally.
     PluginModuleLoadNormally,
 
+    // The plug-in module should be loaded normally. If the plug-in has a sandbox, it will be disabled.
+    PluginModuleLoadUnsandboxed,
+
     // The plug-in should be blocked from being instantiated.
     // Note that the plug-in will still be seen by e.g. navigator.plugins
     PluginModuleBlocked,
diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessAttributes.h b/Source/WebKit2/Shared/Plugins/PluginProcessAttributes.h
new file mode 100644 (file)
index 0000000..b4e7808
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 PluginProcessAttributes_h
+#define PluginProcessAttributes_h
+
+#include "PluginModuleInfo.h"
+
+namespace WebKit {
+
+enum PluginProcessType {
+    PluginProcessTypeNormal,
+    PluginProcessTypeSnapshot,
+};
+
+enum PluginProcessSandboxPolicy {
+    PluginProcessSandboxPolicyNormal,
+    PluginProcessSandboxPolicyUnsandboxed,
+};
+
+struct PluginProcessAttributes {
+    PluginModuleInfo moduleInfo;
+    PluginProcessType processType;
+    PluginProcessSandboxPolicy sandboxPolicy;
+};
+
+} // namespace WebKit
+
+#endif // PluginProcessAttributes_h
index e827ae4..865834a 100644 (file)
@@ -28,7 +28,7 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
-#include "PluginProcess.h"
+#include "PluginProcessAttributes.h"
 
 #if PLATFORM(MAC)
 #include "MachPort.h"
@@ -47,7 +47,7 @@ struct PluginProcessCreationParameters {
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder&, PluginProcessCreationParameters&);
 
-    PluginProcess::Type processType;
+    PluginProcessType processType;
     bool supportsAsynchronousPluginInitialization;
 
     double minimumLifetime;
index 9162be7..64c3799 100644 (file)
@@ -410,6 +410,8 @@ inline WKPluginLoadPolicy toWKPluginLoadPolicy(PluginModuleLoadPolicy pluginModu
     switch (pluginModuleLoadPolicy) {
     case PluginModuleLoadNormally:
         return kWKPluginLoadPolicyLoadNormally;
+    case PluginModuleLoadUnsandboxed:
+        return kWKPluginLoadPolicyLoadUnsandboxed;
     case PluginModuleBlocked:
         return kWKPluginLoadPolicyBlocked;
     case PluginModuleInactive:
@@ -429,6 +431,8 @@ inline PluginModuleLoadPolicy toPluginModuleLoadPolicy(WKPluginLoadPolicy plugin
         return PluginModuleBlocked;
     case kWKPluginLoadPolicyInactive:
         return PluginModuleInactive;
+    case kWKPluginLoadPolicyLoadUnsandboxed:
+        return PluginModuleLoadUnsandboxed;
     }
     
     ASSERT_NOT_REACHED();
index 7761ca9..176578f 100644 (file)
@@ -53,6 +53,7 @@ enum {
     kWKPluginLoadPolicyLoadNormally = 0,
     kWKPluginLoadPolicyBlocked,
     kWKPluginLoadPolicyInactive,
+    kWKPluginLoadPolicyLoadUnsandboxed,
 };
 typedef uint32_t WKPluginLoadPolicy;
 
index 3b41b39..6e144cd 100644 (file)
@@ -71,7 +71,7 @@ public:
     // Returns the info for the plug-in with the given path.
     PluginModuleInfo infoForPluginWithPath(const String& pluginPath) const;
 
-    static PluginModuleLoadPolicy policyForPlugin(const PluginModuleInfo&);
+    static PluginModuleLoadPolicy defaultLoadPolicyForPlugin(const PluginModuleInfo&);
     static bool reactivateInactivePlugin(const PluginModuleInfo&);
 
     void setClient(PluginInfoStoreClient* client) { m_client = client; }
index 834c87f..2279aae 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "PluginProcessProxy.h"
 #include "WebContext.h"
+#include <wtf/CryptographicallyRandomNumber.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/WTFString.h>
 
@@ -45,12 +46,42 @@ PluginProcessManager::PluginProcessManager()
 {
 }
 
-void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PluginProcess::Type processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
+uint64_t PluginProcessManager::pluginProcessToken(const PluginModuleInfo& pluginModuleInfo, PluginProcessType pluginProcessType, PluginProcessSandboxPolicy pluginProcessSandboxPolicy)
 {
-    ASSERT(!pluginPath.isNull());
+    // See if we know this token already.
+    for (size_t i = 0; i < m_pluginProcessTokens.size(); ++i) {
+        const PluginProcessAttributes& attributes = m_pluginProcessTokens[i].first;
+
+        if (attributes.moduleInfo.path == pluginModuleInfo.path
+            && attributes.processType == pluginProcessType
+            && attributes.sandboxPolicy == pluginProcessSandboxPolicy)
+            return m_pluginProcessTokens[i].second;
+    }
+
+    uint64_t token;
+    while (true) {
+        cryptographicallyRandomValues(&token, sizeof(token));
+
+        if (m_knownTokens.isValidValue(token) && !m_knownTokens.contains(token))
+            break;
+    }
+
+    PluginProcessAttributes attributes;
+    attributes.moduleInfo = pluginModuleInfo;
+    attributes.processType = pluginProcessType;
+    attributes.sandboxPolicy = pluginProcessSandboxPolicy;
+
+    m_pluginProcessTokens.append(std::make_pair(std::move(attributes), token));
+    m_knownTokens.add(token);
+
+    return token;
+}
 
-    PluginModuleInfo plugin = pluginInfoStore.infoForPluginWithPath(pluginPath);
-    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, processType);
+void PluginProcessManager::getPluginProcessConnection(uint64_t pluginProcessToken, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
+{
+    ASSERT(pluginProcessToken);
+
+    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken);
     pluginProcess->getPluginProcessConnection(reply);
 }
 
@@ -64,38 +95,35 @@ void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginPr
 
 void PluginProcessManager::getSitesWithData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID)
 {
-    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess);
+    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
     pluginProcess->getSitesWithData(webPluginSiteDataManager, callbackID);
 }
 
 void PluginProcessManager::clearSiteData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
 {
-    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess);
+    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
     pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID);
 }
 
-PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath, PluginProcess::Type processType)
+PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(uint64_t pluginProcessToken)
 {
     for (size_t i = 0; i < m_pluginProcesses.size(); ++i) {
-        RefPtr<PluginProcessProxy>& pluginProcessProxy = m_pluginProcesses[i];
-        if (pluginProcessProxy->pluginInfo().path == pluginPath && pluginProcessProxy->processType() == processType)
-            return pluginProcessProxy.get();
+        if (m_pluginProcesses[i]->pluginProcessToken() == pluginProcessToken)
+            return m_pluginProcesses[i].get();
     }
 
-    return 0;
-}
+    for (size_t i = 0; i < m_pluginProcessTokens.size(); ++i) {
+        auto& attributesAndToken = m_pluginProcessTokens[i];
+        if (attributesAndToken.second == pluginProcessToken) {
+            RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, attributesAndToken.first, attributesAndToken.second);
+            PluginProcessProxy* pluginProcessPtr = pluginProcess.get();
 
-PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin, PluginProcess::Type processType)
-{
-    if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path, processType))
-        return pluginProcess;
-
-    RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin, processType);
-    PluginProcessProxy* pluginProcessPtr = pluginProcess.get();
-
-    m_pluginProcesses.append(pluginProcess.release());
+            m_pluginProcesses.append(pluginProcess.release());
+            return pluginProcessPtr;
+        }
+    }
 
-    return pluginProcessPtr;
+    return nullptr;
 }
 
 } // namespace WebKit
index fe51058..307c398 100644 (file)
 
 #include "PluginModuleInfo.h"
 #include "PluginProcess.h"
+#include "PluginProcessAttributes.h"
 #include "WebProcessProxyMessages.h"
 #include <wtf/Forward.h>
+#include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
@@ -51,7 +53,9 @@ class PluginProcessManager {
 public:
     static PluginProcessManager& shared();
 
-    void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PluginProcess::Type, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
+    uint64_t pluginProcessToken(const PluginModuleInfo&, PluginProcessType, PluginProcessSandboxPolicy);
+
+    void getPluginProcessConnection(uint64_t pluginProcessToken, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
     void removePluginProcessProxy(PluginProcessProxy*);
 
     void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID);
@@ -64,8 +68,10 @@ public:
 private:
     PluginProcessManager();
 
-    PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&, PluginProcess::Type);
-    PluginProcessProxy* pluginProcessWithPath(const String& pluginPath, PluginProcess::Type);
+    PluginProcessProxy* getOrCreatePluginProcess(uint64_t pluginProcessToken);
+
+    Vector<std::pair<PluginProcessAttributes, uint64_t>> m_pluginProcessTokens;
+    HashSet<uint64_t> m_knownTokens;
 
     Vector<RefPtr<PluginProcessProxy>> m_pluginProcesses;
 };
index 86c7054..ca8ac87 100644 (file)
@@ -53,21 +53,21 @@ static const double snapshottingMinimumLifetime = 30;
 static const double shutdownTimeout = 1 * 60;
 static const double snapshottingShutdownTimeout = 15;
 
-PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType)
+PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginProcessAttributes& pluginProcessAttributes, uint64_t pluginProcessToken)
 {
-    return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo, processType));
+    return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginProcessAttributes, pluginProcessToken));
 }
 
-PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType)
+PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginProcessAttributes& pluginProcessAttributes, uint64_t pluginProcessToken)
     : m_pluginProcessManager(PluginProcessManager)
-    , m_pluginInfo(pluginInfo)
+    , m_pluginProcessAttributes(pluginProcessAttributes)
+    , m_pluginProcessToken(pluginProcessToken)
     , m_numPendingConnectionRequests(0)
 #if PLATFORM(MAC)
     , m_modalWindowIsShowing(false)
     , m_fullscreenWindowIsShowing(false)
     , m_preFullscreenAppPresentationOptions(0)
 #endif
-    , m_processType(processType)
 {
     connect();
 }
@@ -79,7 +79,7 @@ PluginProcessProxy::~PluginProcessProxy()
 void PluginProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
 {
     launchOptions.processType = ProcessLauncher::PluginProcess;
-    platformGetLaunchOptions(launchOptions, m_pluginInfo);
+    platformGetLaunchOptions(launchOptions, m_pluginProcessAttributes);
 }
 
 // Asks the plug-in process to create a new connection to a web process. The connection identifier will be 
@@ -173,7 +173,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*)
 
     const Vector<WebContext*>& contexts = WebContext::allContexts();
     for (size_t i = 0; i < contexts.size(); ++i)
-        contexts[i]->sendToAllProcesses(Messages::PluginProcessConnectionManager::PluginProcessCrashed(m_pluginInfo.path, m_processType));
+        contexts[i]->sendToAllProcesses(Messages::PluginProcessConnectionManager::PluginProcessCrashed(m_pluginProcessToken));
 
     // This will cause us to be deleted.
     pluginProcessCrashedOrFailedToLaunch();
@@ -202,8 +202,8 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio
     m_connection->open();
     
     PluginProcessCreationParameters parameters;
-    parameters.processType = m_processType;
-    if (m_processType == PluginProcess::TypeSnapshotProcess) {
+    parameters.processType = m_pluginProcessAttributes.processType;
+    if (parameters.processType == PluginProcessTypeSnapshot) {
         parameters.minimumLifetime = snapshottingMinimumLifetime;
         parameters.terminationTimeout = snapshottingShutdownTimeout;
     } else {
index 4578e35..12ab50c 100644 (file)
@@ -32,6 +32,7 @@
 #include "Connection.h"
 #include "PluginModuleInfo.h"
 #include "PluginProcess.h"
+#include "PluginProcessAttributes.h"
 #include "ProcessLauncher.h"
 #include "WebProcessProxyMessages.h"
 #include <wtf/Deque.h>
@@ -64,12 +65,13 @@ struct RawPluginMetaData {
 
 class PluginProcessProxy : public ChildProcessProxy {
 public:
-    static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type);
+    static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginProcessAttributes&, uint64_t pluginProcessToken);
     ~PluginProcessProxy();
 
-    const PluginModuleInfo& pluginInfo() const { return m_pluginInfo; }
+    const PluginProcessAttributes& pluginProcessAttributes() const { return m_pluginProcessAttributes; }
+    uint64_t pluginProcessToken() const { return m_pluginProcessToken; }
 
-    // Asks the plug-in process to create a new connection to a web process. The connection identifier will be 
+    // Asks the plug-in process to create a new connection to a web process. The connection identifier will be
     // encoded in the given argument encoder and sent back to the connection of the given web process.
     void getPluginProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
     
@@ -81,8 +83,6 @@ public:
 
     bool isValid() const { return m_connection; }
 
-    PluginProcess::Type processType() const { return m_processType; }
-
 #if PLATFORM(MAC)
     void setProcessSuppressionEnabled(bool);
 
@@ -98,10 +98,10 @@ public:
 #endif
 
 private:
-    PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type);
+    PluginProcessProxy(PluginProcessManager*, const PluginProcessAttributes&, uint64_t pluginProcessToken);
 
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) OVERRIDE;
-    void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&, const PluginModuleInfo&);
+    void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&, const PluginProcessAttributes&);
 
     void pluginProcessCrashedOrFailedToLaunch();
 
@@ -140,9 +140,9 @@ private:
 
     // The plug-in host process manager.
     PluginProcessManager* m_pluginProcessManager;
-    
-    // Information about the plug-in.
-    PluginModuleInfo m_pluginInfo;
+
+    PluginProcessAttributes m_pluginProcessAttributes;
+    uint64_t m_pluginProcessToken;
 
     // The connection to the plug-in host process.
     RefPtr<CoreIPC::Connection> m_connection;
@@ -172,8 +172,6 @@ private:
     bool m_fullscreenWindowIsShowing;
     unsigned m_preFullscreenAppPresentationOptions;
 #endif
-
-    PluginProcess::Type m_processType;
 };
 
 } // namespace WebKit
index a1ea681..5fbeab2 100644 (file)
@@ -109,7 +109,7 @@ static bool checkForPreferredPlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugi
 
 static bool shouldBlockPlugin(const PluginModuleInfo& plugin)
 {
-    return PluginInfoStore::policyForPlugin(plugin) == PluginModuleBlocked;
+    return PluginInfoStore::defaultLoadPolicyForPlugin(plugin) == PluginModuleBlocked;
 }
 
 bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin)
@@ -140,7 +140,7 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu
     return true;
 }
 
-PluginModuleLoadPolicy PluginInfoStore::policyForPlugin(const PluginModuleInfo& plugin)
+PluginModuleLoadPolicy PluginInfoStore::defaultLoadPolicyForPlugin(const PluginModuleInfo& plugin)
 {
     if (WKShouldBlockPlugin(plugin.bundleIdentifier, plugin.versionString))
         return PluginModuleBlocked;
index 3ca924f..91f82c0 100644 (file)
@@ -134,11 +134,15 @@ static bool shouldUseXPC()
 }
 #endif
 
-void PluginProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions, const PluginModuleInfo& pluginInfo)
+void PluginProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions, const PluginProcessAttributes& pluginProcessAttributes)
 {
-    launchOptions.architecture = pluginInfo.pluginArchitecture;
-    launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginInfo);
-    launchOptions.extraInitializationData.add("plugin-path", pluginInfo.path);
+    launchOptions.architecture = pluginProcessAttributes.moduleInfo.pluginArchitecture;
+    launchOptions.executableHeap = PluginProcessProxy::pluginNeedsExecutableHeap(pluginProcessAttributes.moduleInfo);
+    launchOptions.extraInitializationData.add("plugin-path", pluginProcessAttributes.moduleInfo.path);
+
+    // FIXME: Don't allow this if the UI process is sandboxed.
+    if (pluginProcessAttributes.sandboxPolicy == PluginProcessSandboxPolicyUnsandboxed)
+        launchOptions.extraInitializationData.add("disable-sandbox", "1");
 
 #if HAVE(XPC)
     launchOptions.useXPC = shouldUseXPC();
@@ -148,7 +152,7 @@ void PluginProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions
 void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
 {
     // For now only Flash is known to behave with asynchronous plug-in initialization.
-    parameters.supportsAsynchronousPluginInitialization = m_pluginInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin";
+    parameters.supportsAsynchronousPluginInitialization = m_pluginProcessAttributes.moduleInfo.bundleIdentifier == "com.macromedia.Flash Player.plugin";
 
 #if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
     mach_port_t renderServerPort = [[CARemoteLayerServer sharedServer] serverPort];
@@ -331,12 +335,12 @@ void PluginProcessProxy::setProcessSuppressionEnabled(bool processSuppressionEna
 
 void PluginProcessProxy::openPluginPreferencePane()
 {
-    if (!m_pluginInfo.preferencePanePath)
+    if (!m_pluginProcessAttributes.moduleInfo.preferencePanePath)
         return;
 
-    NSURL *preferenceURL = [NSURL fileURLWithPath:m_pluginInfo.preferencePanePath];
+    NSURL *preferenceURL = [NSURL fileURLWithPath:m_pluginProcessAttributes.moduleInfo.preferencePanePath];
     if (!preferenceURL) {
-        LOG_ERROR("Creating URL for preference pane path \"%@\" failed.", (NSString *)m_pluginInfo.preferencePanePath);
+        LOG_ERROR("Creating URL for preference pane path \"%@\" failed.", (NSString *)m_pluginProcessAttributes.moduleInfo.preferencePanePath);
         return;
     }
 
@@ -351,7 +355,7 @@ void PluginProcessProxy::openPluginPreferencePane()
 
     OSStatus error = LSOpenFromURLSpec(&prefSpec, 0);
     if (error != noErr)
-        LOG_ERROR("LSOpenFromURLSpec to open \"%@\" failed with error %d.", (NSString *)m_pluginInfo.preferencePanePath, error);
+        LOG_ERROR("LSOpenFromURLSpec to open \"%@\" failed with error %d.", (NSString *)m_pluginProcessAttributes.moduleInfo.preferencePanePath, error);
 }
 
 } // namespace WebKit
index f8bde14..fca2724 100644 (file)
@@ -44,6 +44,7 @@
 #include "NotificationPermissionRequestManager.h"
 #include "PageClient.h"
 #include "PluginInformation.h"
+#include "PluginProcessManager.h"
 #include "PrintInfo.h"
 #include "SessionState.h"
 #include "TextChecker.h"
@@ -1398,7 +1399,7 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPageProxy::findPlugin(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, const bool allowOnlyApplicationPlugins, String& pluginPath, String& newMimeType, uint32_t& pluginLoadPolicy)
+void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy)
 {
     MESSAGE_CHECK_URL(urlString);
 
@@ -1407,10 +1408,12 @@ void WebPageProxy::findPlugin(const String& mimeType, const String& urlString, c
 
     PluginData::AllowedPluginTypes allowedPluginTypes = allowOnlyApplicationPlugins ? PluginData::OnlyApplicationPlugins : PluginData::AllPlugins;
     PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString), allowedPluginTypes);
-    if (!plugin.path)
+    if (!plugin.path) {
+        pluginProcessToken = 0;
         return;
+    }
 
-    pluginLoadPolicy = PluginInfoStore::policyForPlugin(plugin);
+    pluginLoadPolicy = PluginInfoStore::defaultLoadPolicyForPlugin(plugin);
 
 #if PLATFORM(MAC)
     RefPtr<ImmutableDictionary> pluginInformation = createPluginInformationDictionary(plugin, frameURLString, String(), pageURLString, String(), String());
@@ -1420,11 +1423,25 @@ void WebPageProxy::findPlugin(const String& mimeType, const String& urlString, c
     UNUSED_PARAM(pageURLString);
 #endif
 
-    if (pluginLoadPolicy != PluginModuleLoadNormally)
+    PluginProcessSandboxPolicy pluginProcessSandboxPolicy;
+    switch (pluginLoadPolicy) {
+    case PluginModuleLoadNormally:
+        pluginProcessSandboxPolicy = PluginProcessSandboxPolicyNormal;
+        break;
+    case PluginModuleLoadUnsandboxed:
+        pluginProcessSandboxPolicy = PluginProcessSandboxPolicyUnsandboxed;
+        break;
+
+    case PluginModuleBlocked:
+    case PluginModuleInactive:
+        pluginProcessToken = 0;
         return;
+    }
 
-    pluginPath = plugin.path;
+    pluginProcessSandboxPolicy = PluginProcessSandboxPolicyUnsandboxed;
+    pluginProcessToken = PluginProcessManager::shared().pluginProcessToken(plugin, static_cast<PluginProcessType>(processType), pluginProcessSandboxPolicy);
 }
+
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
 #if ENABLE(GESTURE_EVENTS)
index 17d4d16..fff8c71 100644 (file)
@@ -1047,7 +1047,7 @@ private:
     void sendWheelEvent(const WebWheelEvent&);
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void findPlugin(const String& mimeType, const String& urlString, const String& frameURLString, const String& pageURLString, const bool allowOnlyApplicationPlugins, String& pluginPath, String& newMIMEType, uint32_t& pluginLoadPolicy);
+    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy);
 #endif
 
     PageClient* m_pageClient;
index 6e820bd..a7eeb54 100644 (file)
@@ -315,7 +315,7 @@ messages -> WebPageProxy {
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    FindPlugin(WTF::String mimeType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString, bool allowOnlyApplicationPlugins) -> (WTF::String pluginPath, WTF::String newMIMEType, uint32_t pluginLoadPolicy)
+    FindPlugin(WTF::String mimeType, uint32_t processType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString, bool allowOnlyApplicationPlugins) -> (uint64_t pluginProcessToken, WTF::String newMIMEType, uint32_t pluginLoadPolicy)
 #endif
 
     DidUpdateInWindowState()
index 38c866a..244339b 100644 (file)
@@ -332,9 +332,9 @@ void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins)
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
 #if ENABLE(PLUGIN_PROCESS)
-void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
+void WebProcessProxy::getPluginProcessConnection(uint64_t pluginProcessToken, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
 {
-    PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, static_cast<PluginProcess::Type>(processType), reply);
+    PluginProcessManager::shared().getPluginProcessConnection(pluginProcessToken, reply);
 }
 
 #elif ENABLE(NETSCAPE_PLUGIN_API)
index 0212d2d..cd5e652 100644 (file)
@@ -147,7 +147,7 @@ private:
     void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins);
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(PLUGIN_PROCESS)
-    void getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
+    void getPluginProcessConnection(uint64_t pluginProcessToken, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>);
 #elif ENABLE(NETSCAPE_PLUGIN_API)
     void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID);
     void didClearPluginSiteData(uint64_t callbackID);
index ad4284f..fe6d3a2 100644 (file)
@@ -41,7 +41,7 @@ messages -> WebProcessProxy LegacyReceiver {
     GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins)
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(PLUGIN_PROCESS)
-    GetPluginProcessConnection(WTF::String pluginPath, uint32_t processType) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed
+    GetPluginProcessConnection(uint64_t pluginProcessToken) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed
 #endif
 #if ENABLE(NETSCAPE_PLUGIN_API) && !ENABLE(PLUGIN_PROCESS)
     void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID)
index ff8e41d..eed01f7 100644 (file)
                1AB7D78E1288CD9A00CFD08C /* WKDownload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */; };
                1AC25FC212A48F6000BD2671 /* PluginProcessShim.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */; };
                1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC4C82816B876A90069DCCD /* MessageFlags.h */; };
+               1AC5FFC2174BFD1B0001483D /* PluginProcessAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC5FFC1174BFD1B0001483D /* PluginProcessAttributes.h */; };
                1AC86FF3130B46D3002C1257 /* WKPluginSiteDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC86FF1130B46D3002C1257 /* WKPluginSiteDataManager.cpp */; };
                1AC86FF4130B46D3002C1257 /* WKPluginSiteDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC86FF2130B46D3002C1257 /* WKPluginSiteDataManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1AC8702D130B49A2002C1257 /* WebPluginSiteDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC8702B130B49A2002C1257 /* WebPluginSiteDataManager.h */; };
                1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessShim.mm; sourceTree = "<group>"; };
                1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = PluginProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
                1AC4C82816B876A90069DCCD /* MessageFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageFlags.h; sourceTree = "<group>"; };
+               1AC5FFC1174BFD1B0001483D /* PluginProcessAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessAttributes.h; sourceTree = "<group>"; };
                1AC86FF1130B46D3002C1257 /* WKPluginSiteDataManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPluginSiteDataManager.cpp; sourceTree = "<group>"; };
                1AC86FF2130B46D3002C1257 /* WKPluginSiteDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginSiteDataManager.h; sourceTree = "<group>"; };
                1AC8702B130B49A2002C1257 /* WebPluginSiteDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginSiteDataManager.h; sourceTree = "<group>"; };
                                1A2D84A1127F6AD1001EB962 /* NPVariantData.h */,
                                1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */,
                                1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */,
+                               1AC5FFC1174BFD1B0001483D /* PluginProcessAttributes.h */,
                                1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */,
                                1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */,
                                1A4A9F3112B844E2008FE984 /* PluginQuirks.h */,
                                BC9B38A110F538BE00443A15 /* WebFrameProxy.h in Headers */,
                                BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */,
                                BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */,
+                               1AC5FFC2174BFD1B0001483D /* PluginProcessAttributes.h in Headers */,
                                BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */,
                                BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */,
                                BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */,
index 3d4552b..162aabd 100644 (file)
@@ -42,11 +42,10 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization)
+PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, uint64_t pluginProcessToken, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization)
     : m_pluginProcessConnectionManager(pluginProcessConnectionManager)
-    , m_pluginPath(pluginPath)
+    , m_pluginProcessToken(pluginProcessToken)
     , m_supportsAsynchronousPluginInitialization(supportsAsynchronousPluginInitialization)
-    , m_processType(processType)
 {
     m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, RunLoop::main());
 
index 188295c..e55be5a 100644 (file)
@@ -31,8 +31,8 @@
 #include "Connection.h"
 #include "Plugin.h"
 #include "PluginProcess.h"
+#include "PluginProcessAttributes.h"
 #include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
 
 // A CoreIPC connection to a plug-in process.
 
@@ -44,13 +44,13 @@ class PluginProxy;
     
 class PluginProcessConnection : public RefCounted<PluginProcessConnection>, CoreIPC::Connection::Client {
 public:
-    static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization)
+    static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, uint64_t pluginProcessToken, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization)
     {
-        return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, processType, connectionIdentifier, supportsAsynchronousPluginInitialization));
+        return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginProcessToken, connectionIdentifier, supportsAsynchronousPluginInitialization));
     }
     ~PluginProcessConnection();
 
-    const String& pluginPath() const { return m_pluginPath; }
+    uint64_t pluginProcessToken() const { return m_pluginProcessToken; }
 
     CoreIPC::Connection* connection() const { return m_connection.get(); }
 
@@ -61,10 +61,8 @@ public:
 
     bool supportsAsynchronousPluginInitialization() const { return m_supportsAsynchronousPluginInitialization; }
 
-    PluginProcess::Type processType() const { return m_processType; }
-
 private:
-    PluginProcessConnection(PluginProcessConnectionManager*, const String& pluginPath, PluginProcess::Type, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization);
+    PluginProcessConnection(PluginProcessConnectionManager*, uint64_t pluginProcessToken, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization);
 
     // CoreIPC::Connection::Client
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
@@ -77,7 +75,7 @@ private:
     void setException(const String&);
 
     PluginProcessConnectionManager* m_pluginProcessConnectionManager;
-    String m_pluginPath;
+    uint64_t m_pluginProcessToken;
 
     // The connection from the web process to the plug-in process.
     RefPtr<CoreIPC::Connection> m_connection;
@@ -88,8 +86,6 @@ private:
     RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap;
     
     bool m_supportsAsynchronousPluginInitialization;
-
-    PluginProcess::Type m_processType;
 };
 
 } // namespace WebKit
index 9a8dc43..903158b 100644 (file)
@@ -61,17 +61,18 @@ void PluginProcessConnectionManager::initializeConnection(CoreIPC::Connection* c
     connection->addWorkQueueMessageReceiver(Messages::PluginProcessConnectionManager::messageReceiverName(), m_queue.get(), this);
 }
 
-PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath, PluginProcess::Type processType)
+PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(uint64_t pluginProcessToken)
 {
-    for (size_t i = 0; i < m_pluginProcessConnections.size(); ++i) {
-        RefPtr<PluginProcessConnection>& pluginProcessConnection = m_pluginProcessConnections[i];
-        if (pluginProcessConnection->pluginPath() == pluginPath && pluginProcessConnection->processType() == processType)
-            return pluginProcessConnection.get();
-    }
+    auto it = std::find_if(m_pluginProcessConnections.begin(), m_pluginProcessConnections.end(), [=](const RefPtr<PluginProcessConnection>& connection) {
+        return connection->pluginProcessToken() == pluginProcessToken;
+    });
+
+    if (it != m_pluginProcessConnections.end())
+        return it->get();
 
     CoreIPC::Attachment encodedConnectionIdentifier;
     bool supportsAsynchronousInitialization;
-    if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginPath, processType),
+    if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginProcessToken),
                                                      Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0))
         return 0;
 
@@ -85,14 +86,14 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect
         return 0;
 #endif
 
-    RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, processType, connectionIdentifier, supportsAsynchronousInitialization);
+    RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginProcessToken, connectionIdentifier, supportsAsynchronousInitialization);
     m_pluginProcessConnections.append(pluginProcessConnection);
 
     {
-        MutexLocker locker(m_pathsAndConnectionsMutex);
-        ASSERT(!m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), processType)));
+        MutexLocker locker(m_tokensAndConnectionsMutex);
+        ASSERT(!m_tokensAndConnections.contains(pluginProcessToken));
 
-        m_pathsAndConnections.set(std::make_pair(pluginPath, processType), pluginProcessConnection->connection());
+        m_tokensAndConnections.set(pluginProcessToken, pluginProcessConnection->connection());
     }
 
     return pluginProcessConnection.get();
@@ -104,19 +105,19 @@ void PluginProcessConnectionManager::removePluginProcessConnection(PluginProcess
     ASSERT(vectorIndex != notFound);
 
     {
-        MutexLocker locker(m_pathsAndConnectionsMutex);
-        ASSERT(m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType())));
+        MutexLocker locker(m_tokensAndConnectionsMutex);
+        ASSERT(m_tokensAndConnections.contains(pluginProcessConnection->pluginProcessToken()));
         
-        m_pathsAndConnections.remove(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType()));
+        m_tokensAndConnections.remove(pluginProcessConnection->pluginProcessToken());
     }
 
     m_pluginProcessConnections.remove(vectorIndex);
 }
 
-void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath, uint32_t opaquePluginType)
+void PluginProcessConnectionManager::pluginProcessCrashed(uint64_t pluginProcessToken)
 {
-    MutexLocker locker(m_pathsAndConnectionsMutex);
-    CoreIPC::Connection* connection = m_pathsAndConnections.get(std::make_pair(pluginPath, static_cast<PluginProcess::Type>(opaquePluginType)));
+    MutexLocker locker(m_tokensAndConnectionsMutex);
+    CoreIPC::Connection* connection = m_tokensAndConnections.get(pluginProcessToken);
 
     // It's OK for connection to be null here; it will happen if this web process doesn't know
     // anything about the plug-in process.
index 02d7049..69bc478 100644 (file)
@@ -49,7 +49,7 @@ public:
 
     void initializeConnection(CoreIPC::Connection*);
 
-    PluginProcessConnection* getPluginProcessConnection(const String& pluginPath, PluginProcess::Type);
+    PluginProcessConnection* getPluginProcessConnection(uint64_t pluginProcessToken);
     void removePluginProcessConnection(PluginProcessConnection*);
 
     void didReceivePluginProcessConnectionManagerMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&);
@@ -60,14 +60,14 @@ private:
     // CoreIPC::Connection::WorkQueueMessageReceiver.
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
 
-    void pluginProcessCrashed(const String& pluginPath, uint32_t opaquePluginType);
+    void pluginProcessCrashed(uint64_t pluginProcessToken);
 
     RefPtr<WorkQueue> m_queue;
 
     Vector<RefPtr<PluginProcessConnection>> m_pluginProcessConnections;
 
-    Mutex m_pathsAndConnectionsMutex;
-    HashMap<std::pair<String, PluginProcess::Type>, RefPtr<CoreIPC::Connection>> m_pathsAndConnections;
+    Mutex m_tokensAndConnectionsMutex;
+    HashMap<uint64_t, RefPtr<CoreIPC::Connection>> m_tokensAndConnections;
 };
 
 }
index 673d7b4..36a98c5 100644 (file)
@@ -23,7 +23,7 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 messages -> PluginProcessConnectionManager {
-    PluginProcessCrashed(WTF::String pluginPath, uint32_t processType)
+    PluginProcessCrashed(uint64_t pluginProcessToken)
 }
 
 #endif
index 7990dd7..1ba855c 100644 (file)
@@ -56,13 +56,13 @@ static uint64_t generatePluginInstanceID()
     return ++uniquePluginInstanceID;
 }
 
-PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath, PluginProcess::Type processType, bool isRestartedProcess)
+PassRefPtr<PluginProxy> PluginProxy::create(uint64_t pluginProcessToken, bool isRestartedProcess)
 {
-    return adoptRef(new PluginProxy(pluginPath, processType, isRestartedProcess));
+    return adoptRef(new PluginProxy(pluginProcessToken, isRestartedProcess));
 }
 
-PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processType, bool isRestartedProcess)
-    : m_pluginPath(pluginPath)
+PluginProxy::PluginProxy(uint64_t pluginProcessToken, bool isRestartedProcess)
+    : m_pluginProcessToken(pluginProcessToken)
     , m_pluginInstanceID(generatePluginInstanceID())
     , m_pluginBackingStoreContainsValidData(false)
     , m_isStarted(false)
@@ -70,7 +70,6 @@ PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processTy
     , m_wantsWheelEvents(false)
     , m_remoteLayerClientID(0)
     , m_waitingOnAsynchronousInitialization(false)
-    , m_processType(processType)
     , m_isRestartedProcess(isRestartedProcess)
 {
 }
@@ -87,7 +86,7 @@ void PluginProxy::pluginProcessCrashed()
 bool PluginProxy::initialize(const Parameters& parameters)
 {
     ASSERT(!m_connection);
-    m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginPath, m_processType);
+    m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginProcessToken);
     
     if (!m_connection)
         return false;
index f74f025..f14a11c 100644 (file)
@@ -56,7 +56,7 @@ struct PluginCreationParameters;
 
 class PluginProxy : public Plugin {
 public:
-    static PassRefPtr<PluginProxy> create(const String& pluginPath, PluginProcess::Type, bool isRestartedProcess);
+    static PassRefPtr<PluginProxy> create(uint64_t pluginProcessToken, bool isRestartedProcess);
     ~PluginProxy();
 
     uint64_t pluginInstanceID() const { return m_pluginInstanceID; }
@@ -68,7 +68,7 @@ public:
     bool isBeingAsynchronouslyInitialized() const { return m_waitingOnAsynchronousInitialization; }
 
 private:
-    explicit PluginProxy(const String& pluginPath, PluginProcess::Type, bool isRestartedProcess);
+    explicit PluginProxy(uint64_t pluginProcessToken, bool isRestartedProcess);
 
     // Plugin
     virtual bool initialize(const Parameters&);
@@ -172,11 +172,11 @@ private:
 
     void didCreatePlugin(bool wantsWheelEvents, uint32_t remoteLayerClientID);
     void didFailToCreatePlugin();
-    
+
     void didCreatePluginInternal(bool wantsWheelEvents, uint32_t remoteLayerClientID);
     void didFailToCreatePluginInternal();
 
-    String m_pluginPath;
+    uint64_t m_pluginProcessToken;
 
     RefPtr<PluginProcessConnection> m_connection;
     uint64_t m_pluginInstanceID;
@@ -217,7 +217,6 @@ private:
     RetainPtr<CALayer> m_pluginLayer;
 #endif
 
-    PluginProcess::Type m_processType;
     bool m_isRestartedProcess;
 };
 
index cc2d467..7add96b 100644 (file)
@@ -41,6 +41,7 @@
 #include "NotificationPermissionRequestManager.h"
 #include "PageBanner.h"
 #include "PageOverlay.h"
+#include "PluginProcessAttributes.h"
 #include "PluginProxy.h"
 #include "PluginView.h"
 #include "PrintInfo.h"
@@ -527,19 +528,21 @@ void WebPage::initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagno
 #if ENABLE(NETSCAPE_PLUGIN_API)
 PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters, String& newMIMEType)
 {
-    String pluginPath;
-    uint32_t pluginLoadPolicy;
-
     String frameURLString = frame->coreFrame()->loader()->documentLoader()->responseURL().string();
     String pageURLString = m_page->mainFrame()->loader()->documentLoader()->responseURL().string();
+    PluginProcessType processType = pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcessTypeSnapshot : PluginProcessTypeNormal;
 
     bool allowOnlyApplicationPlugins = !frame->coreFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
-    if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginPath, newMIMEType, pluginLoadPolicy))) {
+
+    uint64_t pluginProcessToken;
+    uint32_t pluginLoadPolicy;
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, static_cast<uint32_t>(processType), parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy))) {
         return 0;
     }
 
     switch (static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy)) {
     case PluginModuleLoadNormally:
+    case PluginModuleLoadUnsandboxed:
         break;
 
     case PluginModuleBlocked:
@@ -555,7 +558,7 @@ PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* plu
         return 0;
     }
 
-    if (pluginPath.isNull()) {
+    if (!pluginProcessToken) {
 #if PLATFORM(MAC)
         String path = parameters.url.path();
         if (MIMETypeRegistry::isPDFOrPostScriptMIMEType(parameters.mimeType) || (parameters.mimeType.isEmpty() && (path.endsWith(".pdf", false) || path.endsWith(".ps", false)))) {
@@ -571,16 +574,10 @@ PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* plu
         return 0;
     }
 
-#if ENABLE(PLUGIN_PROCESS)
-
-    PluginProcess::Type processType = (pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcess::TypeSnapshotProcess : PluginProcess::TypeRegularProcess);
     bool isRestartedProcess = (pluginElement->displayState() == HTMLPlugInElement::Restarting || pluginElement->displayState() == HTMLPlugInElement::RestartingWithPendingMouseClick);
-    return PluginProxy::create(pluginPath, processType, isRestartedProcess);
-#else
-    NetscapePlugin::setSetExceptionFunction(NPRuntimeObjectMap::setGlobalException);
-    return NetscapePlugin::create(NetscapePluginModule::getOrCreate(pluginPath));
-#endif
+    return PluginProxy::create(pluginProcessToken, isRestartedProcess);
 }
+
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
 EditorState WebPage::editorState() const
@@ -3809,15 +3806,15 @@ void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
 bool WebPage::canPluginHandleResponse(const ResourceResponse& response)
 {
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    String pluginPath;
-    String newMIMEType;
     uint32_t pluginLoadPolicy;
-
     bool allowOnlyApplicationPlugins = !m_mainFrame->coreFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
-    if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginPath, newMIMEType, pluginLoadPolicy)))
+
+    uint64_t pluginProcessToken;
+    String newMIMEType;
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), PluginProcessTypeNormal, response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy)))
         return false;
 
-    return pluginLoadPolicy != PluginModuleBlocked && !pluginPath.isEmpty();
+    return pluginLoadPolicy != PluginModuleBlocked && pluginProcessToken;
 #else
     return false;
 #endif