WebKit:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2009 19:33:48 +0000 (19:33 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2009 19:33:48 +0000 (19:33 +0000)
2009-01-20  Anders Carlsson  <andersca@apple.com>

        Reviewed by Sam Weinig.

        Add ProxyInstance files.

        * WebKit.xcodeproj/project.pbxproj:

WebKit/mac:

2009-01-19  Anders Carlsson  <andersca@apple.com>

        Reviewed by Sam Weinig.

        Add and implement GetScriptableNPObject.

        * Plugins/Hosted/NetscapePluginHostProxy.mm:
        (WKPCGetScriptableNPObjectReply):
        Create a new reply struct and set it as the current reply.

        (WKPCEvaluate):
        Get rid of an unused variable.

        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
        (WebKit::NetscapePluginInstanceProxy::Reply::):
        (WebKit::NetscapePluginInstanceProxy::GetScriptableNPObjectReply::GetScriptableNPObjectReply):
        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
        (WebKit::NetscapePluginInstanceProxy::createBindingsInstance):
        Call _WKPHGetScriptableNPObject and wait for a reply.

        * Plugins/Hosted/ProxyInstance.h: Added.
        * Plugins/Hosted/ProxyInstance.mm: Added.
        Add empty files.

        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
        (-[WebHostedNetscapePluginView JSC::Bindings::createPluginBindingsInstance:JSC::Bindings::]):
        Call NetscapePluginInstanceProxy::createBindingsInstance.

        * Plugins/Hosted/WebKitPluginClient.defs:
        * Plugins/Hosted/WebKitPluginHost.defs:
        Add new declarations.

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

WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/mac/ChangeLog
WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
WebKit/mac/Plugins/Hosted/ProxyInstance.h [new file with mode: 0644]
WebKit/mac/Plugins/Hosted/ProxyInstance.mm [new file with mode: 0644]
WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs

index 141980e..db25388 100644 (file)
@@ -1,3 +1,11 @@
+2009-01-20  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add ProxyInstance files.
+        
+        * WebKit.xcodeproj/project.pbxproj:
+
 2009-01-04  David Kilzer  <ddkilzer@apple.com>
 
         Don't install internal headers in WebKit framework
index 8cb4e65..4fd055e 100644 (file)
@@ -17,6 +17,8 @@
                1A2D754D0DE480B900F0A648 /* WebIconFetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D754B0DE480B900F0A648 /* WebIconFetcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A2D754E0DE480B900F0A648 /* WebIconFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D754C0DE480B900F0A648 /* WebIconFetcher.mm */; };
                1A2D75500DE4810E00F0A648 /* WebIconFetcherInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D754F0DE4810E00F0A648 /* WebIconFetcherInternal.h */; };
+               1A2DBE9F0F251E3A0036F8A6 /* ProxyInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */; };
+               1A2DBEA00F251E3A0036F8A6 /* ProxyInstance.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */; };
                1A4DF5220EC8C74D006BD4B4 /* WebNetscapePluginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4DF5200EC8C74D006BD4B4 /* WebNetscapePluginView.h */; };
                1A4DF5230EC8C74D006BD4B4 /* WebNetscapePluginView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4DF5210EC8C74D006BD4B4 /* WebNetscapePluginView.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                1A4DF5E40EC8D104006BD4B4 /* WebBaseNetscapePluginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4DF5E20EC8D104006BD4B4 /* WebBaseNetscapePluginView.h */; };
                1A2D754B0DE480B900F0A648 /* WebIconFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconFetcher.h; sourceTree = "<group>"; };
                1A2D754C0DE480B900F0A648 /* WebIconFetcher.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebIconFetcher.mm; sourceTree = "<group>"; };
                1A2D754F0DE4810E00F0A648 /* WebIconFetcherInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconFetcherInternal.h; sourceTree = "<group>"; };
+               1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyInstance.h; sourceTree = "<group>"; };
+               1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProxyInstance.mm; sourceTree = "<group>"; };
                1A4DF5200EC8C74D006BD4B4 /* WebNetscapePluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapePluginView.h; sourceTree = "<group>"; };
                1A4DF5210EC8C74D006BD4B4 /* WebNetscapePluginView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapePluginView.mm; sourceTree = "<group>"; };
                1A4DF5E20EC8D104006BD4B4 /* WebBaseNetscapePluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBaseNetscapePluginView.h; sourceTree = "<group>"; };
                                1AAF5CE70EDDE1FE008D883D /* NetscapePluginHostProxy.mm */,
                                1AAF5CE80EDDE1FE008D883D /* NetscapePluginInstanceProxy.h */,
                                1AAF5CE90EDDE1FE008D883D /* NetscapePluginInstanceProxy.mm */,
+                               1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */,
+                               1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */,
                                1AAF5FBD0EDE3A92008D883D /* WebHostedNetscapePluginView.h */,
                                1AAF5FBE0EDE3A92008D883D /* WebHostedNetscapePluginView.mm */,
                                1AAF588A0EDCCEA3008D883D /* WebKitPluginAgent.defs */,
                                9398109B0824BF01008DF038 /* WebViewInternal.h in Headers */,
                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
                                1A7F9C4C0DD3DDEA0028F8A5 /* nptextinput.h in Headers */,
+                               1A2DBE9F0F251E3A0036F8A6 /* ProxyInstance.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                939811070824BF01008DF038 /* WebView.mm in Sources */,
                                939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */,
                                939810DD0824BF01008DF038 /* npapi.mm in Sources */,
+                               1A2DBEA00F251E3A0036F8A6 /* ProxyInstance.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 2058deb..aea1055 100644 (file)
@@ -1,3 +1,35 @@
+2009-01-19  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Add and implement GetScriptableNPObject.
+        
+        * Plugins/Hosted/NetscapePluginHostProxy.mm:
+        (WKPCGetScriptableNPObjectReply):
+        Create a new reply struct and set it as the current reply.
+        
+        (WKPCEvaluate):
+        Get rid of an unused variable.
+        
+        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+        (WebKit::NetscapePluginInstanceProxy::Reply::):
+        (WebKit::NetscapePluginInstanceProxy::GetScriptableNPObjectReply::GetScriptableNPObjectReply):
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::createBindingsInstance):
+        Call _WKPHGetScriptableNPObject and wait for a reply.
+        
+        * Plugins/Hosted/ProxyInstance.h: Added.
+        * Plugins/Hosted/ProxyInstance.mm: Added.
+        Add empty files.
+        
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView JSC::Bindings::createPluginBindingsInstance:JSC::Bindings::]):
+        Call NetscapePluginInstanceProxy::createBindingsInstance.
+        
+        * Plugins/Hosted/WebKitPluginClient.defs:
+        * Plugins/Hosted/WebKitPluginHost.defs:
+        Add new declarations.
+
 2009-01-19  Sam Weinig  <sam@webkit.org>
 
         Rubber-stamped by Gavin Barraclough.
index 3ee7b08..00b8988 100644 (file)
@@ -226,6 +226,20 @@ kern_return_t WKPCInvalidateRect(mach_port_t clientPort, uint32_t pluginID, doub
     return KERN_SUCCESS;
 }
 
+kern_return_t WKPCGetScriptableNPObjectReply(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID)
+{
+    NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
+    if (!hostProxy)
+        return KERN_FAILURE;
+    
+    NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
+    if (!instanceProxy)
+        return KERN_FAILURE;
+
+    instanceProxy->setCurrentReply(new NetscapePluginInstanceProxy::GetScriptableNPObjectReply(objectID));
+    return KERN_SUCCESS;
+}
+
 kern_return_t WKPCInstantiatePluginReply(mach_port_t clientPort, uint32_t pluginID, kern_return_t result, uint32_t renderContextID, boolean_t useSoftwareRenderer)
 {
     NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
@@ -289,7 +303,7 @@ kern_return_t WKPCEvaluate(mach_port_t clientPort, uint32_t pluginID, uint32_t o
     
     boolean_t returnValue = instanceProxy->evaluate(objectID, script, resultData, resultLength);
     
-    kern_return_t kr = _WKPHEvaluateReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);
+    _WKPHEvaluateReply(hostProxy->port(), instanceProxy->pluginID(), returnValue, resultData, resultLength);
     mig_deallocate(reinterpret_cast<vm_address_t>(resultData), resultLength);
         
     return KERN_SUCCESS;
index d5cd453..3c5a73a 100644 (file)
@@ -42,6 +42,12 @@ namespace WebCore {
     class String;
 }
 
+namespace JSC {
+    namespace Bindings {
+        class Instance;
+        class RootObject;
+    }
+}
 @class WebHostedNetscapePluginView;
 
 namespace WebKit {
@@ -105,10 +111,13 @@ public:
     void status(const char* message);
     NPError loadURL(const char* url, const char* target, const char* postData, uint32_t postDataLength, LoadURLFlags, uint32_t& requestID);
 
+    PassRefPtr<JSC::Bindings::Instance> createBindingsInstance(PassRefPtr<JSC::Bindings::RootObject>);
+    
     // Reply structs
     struct Reply {
         enum Type {
-            InstantiatePlugin
+            InstantiatePlugin,
+            GetScriptableNPObject
         };
         
         Reply(Type type) : m_type(type) { }
@@ -133,6 +142,18 @@ public:
         boolean_t m_useSoftwareRenderer;
     };
 
+    struct GetScriptableNPObjectReply : public Reply {
+        static const int ReplyType = GetScriptableNPObject;
+        
+        GetScriptableNPObjectReply(uint32_t objectID)
+            : Reply(GetScriptableNPObject)
+            , m_objectID(objectID)
+        {
+        }
+            
+        uint32_t m_objectID;
+    };
+    
     void setCurrentReply(Reply* reply)
     {
         ASSERT(!m_currentReply.get());
index b0e7af2..cdf0d0a 100644 (file)
@@ -29,6 +29,7 @@
 
 #import "HostedNetscapePluginStream.h"
 #import "NetscapePluginHostProxy.h"
+#import "ProxyInstance.h"
 #import "WebDataSourceInternal.h"
 #import "WebFrameInternal.h"
 #import "WebHostedNetscapePluginView.h"
@@ -56,6 +57,7 @@ extern "C" {
 }
 
 using namespace JSC;
+using namespace JSC::Bindings;
 using namespace std;
 using namespace WebCore;
 
@@ -880,6 +882,19 @@ void NetscapePluginInstanceProxy::demarshalValues(ExecState* exec, data_t values
         result.append(value);
 }
 
+PassRefPtr<Instance> NetscapePluginInstanceProxy::createBindingsInstance(PassRefPtr<RootObject>)
+{
+    if (_WKPHGetScriptableNPObject(m_pluginHostProxy->port(), m_pluginID) != KERN_SUCCESS)
+        return 0;
+    
+    auto_ptr<GetScriptableNPObjectReply> reply = waitForReply<GetScriptableNPObjectReply>();
+    if (!reply.get())
+        return 0;
+    
+    // FIXME: Implement
+    return 0;
+}
+
 } // namespace WebKit
 
 #endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.h b/WebKit/mac/Plugins/Hosted/ProxyInstance.h
new file mode 100644 (file)
index 0000000..653cb22
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2009 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. ``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
+ * 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 USE(PLUGIN_HOST_PROCESS)
+
+#ifndef ProxyInstance_h
+#define ProxyInstance_h
+
+#include <WebCore/runtime.h>
+
+namespace WebKit {
+}
+
+#endif // ProxyInstance_h
+#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
new file mode 100644 (file)
index 0000000..6ac9969
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2008 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. ``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
+ * 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 USE(PLUGIN_HOST_PROCESS)
+
+#import "ProxyInstance.h"
+
+namespace WebKit {
+
+} // namespace WebKit
+
+#endif // USE(PLUGIN_HOST_PROCESS)
+
index a273fdb..ddc5f4d 100644 (file)
@@ -34,6 +34,8 @@
 #import "WebUIDelegate.h"
 
 #import <CoreFoundation/CoreFoundation.h>
+#import <WebCore/runtime.h>
+#import <WebCore/runtime_root.h>
 #import <WebCore/WebCoreObjCExtras.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/Assertions.h>
@@ -284,6 +286,11 @@ extern "C" {
     }
 }
 
+- (PassRefPtr<JSC::Bindings::Instance>)createPluginBindingsInstance:(PassRefPtr<JSC::Bindings::RootObject>)rootObject
+{
+    return _proxy->createBindingsInstance(rootObject);
+}
+
 @end
 
 #endif
index 9162a1f..b279c17 100644 (file)
@@ -140,5 +140,9 @@ simpleroutine InstantiatePluginReply(clientPort :mach_port_t;
                                      renderContextID :uint32_t;
                                      useSoftwareRenderer :boolean_t);
 
+simpleroutine GetScriptableNPObjectReply(clientPort :mach_port_t;
+                                         pluginID :uint32_t;
+                                         objectID :uint32_t);
+
 
 
index 3266fdb..90d9858 100644 (file)
@@ -119,6 +119,11 @@ simpleroutine StreamDidFail(pluginHostPort :mach_port_t;
                             streamID :uint32_t;
                             reason :int16_t);
 
+// NPRuntime
+
+simpleroutine GetScriptableNPObject(pluginHostPort :mach_port_t;
+                                    pluginID :uint32_t);
+
 // Replies
 
 simpleroutine EvaluateReply(pluginHostPort :mach_port_t;