Title: [94456] trunk/Source/WebKit2
Revision
94456
Author
[email protected]
Date
2011-09-02 15:22:39 -0700 (Fri, 02 Sep 2011)

Log Message

NPN_SetException doesn't work with OOP plug-ins
https://bugs.webkit.org/show_bug.cgi?id=67524

Reviewed by Sam Weinig.

* DerivedSources.make:
Add PluginProcessConnection.messages.in.

* GNUmakefile.am:
Add generated files.

* Platform/CoreIPC/MessageID.h:
Add MessageClassPluginProcessConnection.

* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::initialize):
Set the set exception function.

* PluginProcess/WebProcessConnection.cpp:
(WebKit::ConnectionStack::current):
(WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher):
(WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher):
Add a helper class for managing a stack of CoreIPC connections, along with a RAII
object to push/pop connections onto it.

(WebKit::connectionStack):
Add getter.

(WebKit::WebProcessConnection::setGlobalException):
Get the current connection and send a PluginProcessConnection::SetException message to it.

(WebKit::WebProcessConnection::didReceiveMessage):
(WebKit::WebProcessConnection::didReceiveSyncMessage):
Create connection pushers.

* PluginProcess/WebProcessConnection.h:
Add setGlobalException.

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

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::setSetExceptionFunction):
New function for setting the 'setException' function.

(WebKit::NetscapePlugin::setException):
Call the 'setException' function.

* WebProcess/Plugins/PluginProcessConnection.cpp:
(WebKit::PluginProcessConnection::didReceiveSyncMessage):
Call the message receiver function.

(WebKit::PluginProcessConnection::setException):
Call the NPRuntimeObjectMap.
        
* WebProcess/Plugins/PluginProcessConnection.messages.in:
Add new messages file.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
When not using the plug-in process, make sure to call NetscapePlugin::setSetExceptionFunction.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (94455 => 94456)


--- trunk/Source/WebKit2/ChangeLog	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-02 22:22:39 UTC (rev 94456)
@@ -1,3 +1,68 @@
+2011-09-02  Anders Carlsson  <[email protected]>
+
+        NPN_SetException doesn't work with OOP plug-ins
+        https://bugs.webkit.org/show_bug.cgi?id=67524
+
+        Reviewed by Sam Weinig.
+
+        * DerivedSources.make:
+        Add PluginProcessConnection.messages.in.
+
+        * GNUmakefile.am:
+        Add generated files.
+
+        * Platform/CoreIPC/MessageID.h:
+        Add MessageClassPluginProcessConnection.
+
+        * PluginProcess/PluginProcess.cpp:
+        (WebKit::PluginProcess::initialize):
+        Set the set exception function.
+
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::ConnectionStack::current):
+        (WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher):
+        (WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher):
+        Add a helper class for managing a stack of CoreIPC connections, along with a RAII
+        object to push/pop connections onto it.
+
+        (WebKit::connectionStack):
+        Add getter.
+
+        (WebKit::WebProcessConnection::setGlobalException):
+        Get the current connection and send a PluginProcessConnection::SetException message to it.
+
+        (WebKit::WebProcessConnection::didReceiveMessage):
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        Create connection pushers.
+
+        * PluginProcess/WebProcessConnection.h:
+        Add setGlobalException.
+
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::setSetExceptionFunction):
+        New function for setting the 'setException' function.
+
+        (WebKit::NetscapePlugin::setException):
+        Call the 'setException' function.
+
+        * WebProcess/Plugins/PluginProcessConnection.cpp:
+        (WebKit::PluginProcessConnection::didReceiveSyncMessage):
+        Call the message receiver function.
+
+        (WebKit::PluginProcessConnection::setException):
+        Call the NPRuntimeObjectMap.
+        
+        * WebProcess/Plugins/PluginProcessConnection.messages.in:
+        Add new messages file.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+        When not using the plug-in process, make sure to call NetscapePlugin::setSetExceptionFunction.
+
 2011-09-02  Ada Chan  <[email protected]>
 
         Add WKContextGarbageCollectJavaScriptObjects() which does a garbage collection in the WebProcess

Modified: trunk/Source/WebKit2/DerivedSources.make (94455 => 94456)


--- trunk/Source/WebKit2/DerivedSources.make	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/DerivedSources.make	2011-09-02 22:22:39 UTC (rev 94456)
@@ -50,6 +50,7 @@
     NPObjectMessageReceiver \
     PluginControllerProxy \
     PluginProcess \
+    PluginProcessConnection \
     PluginProcessProxy \
     PluginProxy \
     WebApplicationCacheManager \

Modified: trunk/Source/WebKit2/GNUmakefile.am (94455 => 94456)


--- trunk/Source/WebKit2/GNUmakefile.am	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/GNUmakefile.am	2011-09-02 22:22:39 UTC (rev 94456)
@@ -82,6 +82,8 @@
 	DerivedSources/WebKit2/NPObjectMessageReceiverMessages.h \
 	DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp \
 	DerivedSources/WebKit2/PluginControllerProxyMessages.h \
+	DerivedSources/WebKit2/PluginProcessConnectionMessageReceiver.cpp \
+	DerivedSources/WebKit2/PluginProcessConnectionMessages.h \
 	DerivedSources/WebKit2/PluginProcessMessageReceiver.cpp \
 	DerivedSources/WebKit2/PluginProcessMessages.h \
 	DerivedSources/WebKit2/PluginProcessProxyMessageReceiver.cpp \

Modified: trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h (94455 => 94456)


--- trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h	2011-09-02 22:22:39 UTC (rev 94456)
@@ -80,6 +80,7 @@
     MessageClassPluginControllerProxy,
 
     // Messages sent by the plug-in process to the web process.
+    MessageClassPluginProcessConnection,
     MessageClassPluginProxy,
 
     // NPObject messages sent by both the plug-in process and the web process.

Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp (94455 => 94456)


--- trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp	2011-09-02 22:22:39 UTC (rev 94456)
@@ -30,6 +30,7 @@
 
 #include "ArgumentCoders.h"
 #include "Attachment.h"
+#include "NetscapePlugin.h"
 #include "NetscapePluginModule.h"
 #include "PluginProcessProxyMessages.h"
 #include "PluginProcessCreationParameters.h"
@@ -79,6 +80,8 @@
     m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop);
     m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
     m_connection->open();
+
+    NetscapePlugin::setSetExceptionFunction(WebProcessConnection::setGlobalException);
 }
 
 void PluginProcess::removeWebProcessConnection(WebProcessConnection* webProcessConnection)

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (94455 => 94456)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2011-09-02 22:22:39 UTC (rev 94456)
@@ -28,14 +28,62 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
+#include "ArgumentCoders.h"
 #include "NPRemoteObjectMap.h"
 #include "PluginControllerProxy.h"
 #include "PluginCreationParameters.h"
 #include "PluginProcess.h"
+#include "PluginProcessConnectionMessages.h"
 #include "RunLoop.h"
 
 namespace WebKit {
 
+
+class ConnectionStack {
+public:
+    CoreIPC::Connection* current()
+    {
+        return m_connectionStack.last();
+    }
+
+    class CurrentConnectionPusher {
+    public:
+        CurrentConnectionPusher(ConnectionStack& connectionStack, CoreIPC::Connection* connection)
+            : m_connectionStack(connectionStack)
+#if !ASSERT_DISABLED
+            , m_connection(connection)
+#endif
+        {
+            m_connectionStack.m_connectionStack.append(connection);
+        }
+
+        ~CurrentConnectionPusher()
+        {
+            ASSERT(m_connectionStack.current() == m_connection);
+            m_connectionStack.m_connectionStack.removeLast();
+        }
+
+    private:
+        ConnectionStack& m_connectionStack;
+#if !ASSERT_DISABLED
+        CoreIPC::Connection* m_connection;
+#endif
+    };
+
+private:
+    // It's OK for these to be weak pointers because we only push object on the stack
+    // from within didReceiveMessage and didReceiveSyncMessage and the Connection objects are
+    // already ref'd for the duration of those functions.
+    Vector<CoreIPC::Connection*, 4> m_connectionStack;
+};
+
+static ConnectionStack& connectionStack()
+{
+    DEFINE_STATIC_LOCAL(ConnectionStack, connectionStack, ());
+
+    return connectionStack;
+}
+
 PassRefPtr<WebProcessConnection> WebProcessConnection::create(CoreIPC::Connection::Identifier connectionIdentifier)
 {
     return adoptRef(new WebProcessConnection(connectionIdentifier));
@@ -98,8 +146,19 @@
     PluginProcess::shared().removeWebProcessConnection(this);
 }
 
+void WebProcessConnection::setGlobalException(const String& exceptionString)
+{
+    CoreIPC::Connection* connection = connectionStack().current();
+    if (!connection)
+        return;
+
+    connection->sendSync(Messages::PluginProcessConnection::SetException(exceptionString), Messages::PluginProcessConnection::SetException::Reply(), 0);
+}
+
 void WebProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
+    ConnectionStack::CurrentConnectionPusher currentConnection(connectionStack(), connection);
+
     if (!arguments->destinationID()) {
         ASSERT_NOT_REACHED();
         return;
@@ -110,12 +169,13 @@
         return;
 
     PluginController::PluginDestructionProtector protector(pluginControllerProxy->asPluginController());
-
     pluginControllerProxy->didReceivePluginControllerProxyMessage(connection, messageID, arguments);
 }
 
 void WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
 {
+    ConnectionStack::CurrentConnectionPusher currentConnection(connectionStack(), connection);
+
     uint64_t destinationID = arguments->destinationID();
 
     if (!destinationID) {

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h (94455 => 94456)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2011-09-02 22:22:39 UTC (rev 94456)
@@ -50,6 +50,8 @@
 
     void removePluginControllerProxy(PluginControllerProxy*, Plugin*);
 
+    static void setGlobalException(const String&);
+
 private:
     WebProcessConnection(CoreIPC::Connection::Identifier);
 

Modified: trunk/Source/WebKit2/WebKit2.pro (94455 => 94456)


--- trunk/Source/WebKit2/WebKit2.pro	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebKit2.pro	2011-09-02 22:22:39 UTC (rev 94456)
@@ -25,6 +25,7 @@
     $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/NPObjectMessageReceiverMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessages.h \
+    $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessConnectionMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessProxyMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProxyMessages.h \
@@ -63,6 +64,7 @@
     $$WEBKIT2_GENERATED_SOURCES_DIR/NPObjectMessageReceiverMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessageReceiver.cpp \
+    $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessConnectionMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessProxyMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProxyMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/WebApplicationCacheManagerMessageReceiver.cpp \

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (94455 => 94456)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-09-02 22:22:39 UTC (rev 94456)
@@ -76,6 +76,8 @@
 		1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24B5F111F531E800C38269 /* MachUtilities.h */; };
 		1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; };
 		1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; };
+		1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2BB6CE14117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp */; };
+		1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2BB6CF14117B4D000F35D4 /* PluginProcessConnectionMessages.h */; };
 		1A2C307112D555450063DAA2 /* ContextMenuState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2C306F12D555450063DAA2 /* ContextMenuState.h */; };
 		1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; };
 		1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */; };
@@ -990,6 +992,9 @@
 		1A24B5F111F531E800C38269 /* MachUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachUtilities.h; sourceTree = "<group>"; };
 		1A24BED3120894D100FBB059 /* SharedMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedMemory.h; sourceTree = "<group>"; };
 		1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryMac.cpp; sourceTree = "<group>"; };
+		1A2BB6CC14117A5F000F35D4 /* PluginProcessConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProcessConnection.messages.in; sourceTree = "<group>"; };
+		1A2BB6CE14117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
+		1A2BB6CF14117B4D000F35D4 /* PluginProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnectionMessages.h; sourceTree = "<group>"; };
 		1A2C306F12D555450063DAA2 /* ContextMenuState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuState.h; sourceTree = "<group>"; };
 		1A2D8411127F64E8001EB962 /* NPObjectMessageReceiver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NPObjectMessageReceiver.messages.in; sourceTree = "<group>"; };
 		1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPObjectMessageReceiverMessageReceiver.cpp; sourceTree = "<group>"; };
@@ -2055,6 +2060,7 @@
 				1AA56F2811E92BC80061B882 /* PluginController.h */,
 				1A0EC905124C0AB8007EF4A5 /* PluginProcessConnection.cpp */,
 				1A0EC904124C0AB8007EF4A5 /* PluginProcessConnection.h */,
+				1A2BB6CC14117A5F000F35D4 /* PluginProcessConnection.messages.in */,
 				1A0EC90E124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp */,
 				1A0EC90D124C0AF5007EF4A5 /* PluginProcessConnectionManager.h */,
 				1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */,
@@ -3282,18 +3288,20 @@
 		C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
 			isa = PBXGroup;
 			children = (
-				1A64230612DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp */,
-				1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */,
 				512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
 				512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
 				1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */,
 				1AB7D6181288B9D900CFD08C /* DownloadProxyMessages.h */,
 				1A64229712DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp */,
 				1A64229812DD029200CAAE2C /* DrawingAreaMessages.h */,
+				1A64230612DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp */,
+				1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */,
 				1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */,
 				1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */,
 				1A8EF96C1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp */,
 				1A8EF96D1252AF6B00F7067F /* PluginControllerProxyMessages.h */,
+				1A2BB6CE14117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp */,
+				1A2BB6CF14117B4D000F35D4 /* PluginProcessConnectionMessages.h */,
 				1A0EC6BD124BBD9B007EF4A5 /* PluginProcessMessageReceiver.cpp */,
 				1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */,
 				1A043B5B124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp */,
@@ -3316,8 +3324,8 @@
 				F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */,
 				CD73BA48131ACD8E00EEDED2 /* WebFullScreenManagerMessageReceiver.cpp */,
 				CD73BA49131ACD8E00EEDED2 /* WebFullScreenManagerMessages.h */,
+				CD73BA45131ACC8800EEDED2 /* WebFullScreenManagerProxyMessageReceiver.cpp */,
 				CD73BA4A131ACD8F00EEDED2 /* WebFullScreenManagerProxyMessages.h */,
-				CD73BA45131ACC8800EEDED2 /* WebFullScreenManagerProxyMessageReceiver.cpp */,
 				BC0E605F12D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp */,
 				BC0E606012D6BA910012A72A /* WebGeolocationManagerMessages.h */,
 				BC0E618012D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp */,
@@ -3829,6 +3837,7 @@
 				5D51845613BCF9CC00C7FF4A /* APIClientTraits.h in Headers */,
 				1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */,
 				5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */,
+				1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -4497,6 +4506,7 @@
 				1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */,
 				5D51845513BCF9CC00C7FF4A /* APIClientTraits.cpp in Sources */,
 				5272B28A1406985D0096A5D0 /* StatisticsData.cpp in Sources */,
+				1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (94455 => 94456)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-09-02 22:22:39 UTC (rev 94456)
@@ -225,14 +225,18 @@
     controller()->setStatusbarText(statusbarText);
 }
 
+static void (*setExceptionFunction)(const String&);
+
+void NetscapePlugin::setSetExceptionFunction(void (*function)(const String&))
+{
+    ASSERT(!setExceptionFunction || setExceptionFunction == function);
+    setExceptionFunction = function;
+}
+
 void NetscapePlugin::setException(const String& exceptionString)
 {
-#if ENABLE(PLUGIN_PROCESS)
-    // FIXME: If the plug-in is running in its own process, this needs to send a CoreIPC message instead of
-    // calling the runtime object map directly.
-#else
-    NPRuntimeObjectMap::setGlobalException(exceptionString);
-#endif
+    ASSERT(setExceptionFunction);
+    setExceptionFunction(exceptionString);
 }
 
 bool NetscapePlugin::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (94455 => 94456)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-09-02 22:22:39 UTC (rev 94456)
@@ -90,6 +90,8 @@
     bool evaluate(NPObject*, const String&scriptString, NPVariant* result);
     bool isPrivateBrowsingEnabled();
 
+    static void setSetExceptionFunction(void (*)(const String&));
+
     // These return retained objects.
     NPObject* windowScriptNPObject();
     NPObject* pluginElementNPObject();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp (94455 => 94456)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp	2011-09-02 22:22:39 UTC (rev 94456)
@@ -29,6 +29,7 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "NPRemoteObjectMap.h"
+#include "NPRuntimeObjectMap.h"
 #include "PluginProcessConnectionManager.h"
 #include "PluginProxy.h"
 #include "WebProcess.h"
@@ -134,9 +135,14 @@
         return;
     }
 
-    ASSERT(arguments->destinationID());
+    uint64_t destinationID = arguments->destinationID();
 
-    PluginProxy* pluginProxy = m_plugins.get(arguments->destinationID());
+    if (!destinationID) {
+        didReceiveSyncPluginProcessConnectionMessage(connection, messageID, arguments, reply);
+        return;
+    }
+
+    PluginProxy* pluginProxy = m_plugins.get(destinationID);
     if (!pluginProxy)
         return;
 
@@ -162,6 +168,11 @@
     WebProcess::shared().connection()->send(Messages::WebProcessProxy::PluginSyncMessageSendTimedOut(m_pluginPath), 0);
 }
 
+void PluginProcessConnection::setException(const String& exceptionString)
+{
+    NPRuntimeObjectMap::setGlobalException(exceptionString);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h (94455 => 94456)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h	2011-09-02 22:22:39 UTC (rev 94456)
@@ -68,6 +68,10 @@
     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID);
     virtual void syncMessageSendTimedOut(CoreIPC::Connection*);
 
+    // Message handlers.
+    void didReceiveSyncPluginProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
+    void setException(const String&);
+
     PluginProcessConnectionManager* m_pluginProcessConnectionManager;
     String m_pluginPath;
 

Added: trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.messages.in (0 => 94456)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.messages.in	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.messages.in	2011-09-02 22:22:39 UTC (rev 94456)
@@ -0,0 +1,30 @@
+# Copyright (C) 2011 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.
+
+#if ENABLE(PLUGIN_PROCESS)
+
+messages -> PluginProcessConnection {
+    # Set a global _javascript_ exception.
+    SetException(WTF::String exceptionString) -> ()
+}
+
+#endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (94455 => 94456)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-09-02 22:22:16 UTC (rev 94455)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-09-02 22:22:39 UTC (rev 94456)
@@ -342,6 +342,7 @@
 #if ENABLE(PLUGIN_PROCESS)
     return PluginProxy::create(pluginPath);
 #else
+    NetscapePlugin::setSetExceptionFunction(NPRuntimeObjectMap::setGlobalException);
     return NetscapePlugin::create(NetscapePluginModule::getOrCreate(pluginPath));
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to