[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

ap at apple.com ap at apple.com
Thu Apr 8 01:59:23 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6c2214a926b2c7e33cf7ea56efa9a2764e6550aa
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 25 20:23:25 2010 +0000

            Reviewed by Geoffrey Garen.
    
            https://bugs.webkit.org/show_bug.cgi?id=35394
            <rdar://problem/7685262> Make passing objects between Java and plug-ins work
    
            * WebCore.PluginHostProcess.exp: WebKit now subclasses RuntimeObject, so it needed more exports.
    
            * bridge/runtime_object.cpp:
            (JSC::Bindings::callRuntimeObject):
            (JSC::Bindings::callRuntimeConstructor):
            Assert that a runtime object is passed as function.
    
            * bridge/runtime_object.h: Moved RuntimeObject into Bindings namespace, matching other
            related classes.
    
            * bridge/jni/jni_jsobject.mm:
            (JavaJSObject::toString): Pass rootObject to convertValueToJValue(). It's not needed when
            constructing a string, but this function now takes it for the sake of Object.
            (JavaJSObject::convertValueToJObject): Check that object class is JavaRuntimeObject, not
            just RuntimeObject.
    
            * bridge/jni/jsc/JNIBridgeJSC.cpp:
            (JavaField::setValueToInstance): Pass rootObject to convertValueToJValue().
            (JavaArray::setValueAt): Ditto.
    
            * bridge/jni/jsc/JNIUtilityPrivate.h: convertValueToJValue() now takes a RootObject argument,
            because one is needed to gcProtect an object ghtat is wrapped into JSObject.
    
            * bridge/jni/jsc/JNIUtilityPrivate.cpp: (JSC::Bindings::convertValueToJValue): Convert
            JavaScript objects to Java JSObject ones. This was already happening in other code paths,
            which we should change to use common code.
    
            * bridge/jni/jsc/JavaInstanceJSC.cpp:
            (JavaInstance::newRuntimeObject): Create an appropriate RuntimeObject subclass,
            which is JavaRuntimeObject for Java.
            (JavaInstance::invokeMethod): Unwrap returned JavaObjects that contain JS objects.
    
            * WebCore.xcodeproj/project.pbxproj:
            * bindings/objc/WebScriptObject.mm:
            (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
            * bridge/c/CRuntimeObject.cpp: Added.
            (JSC::Bindings::CRuntimeObject::CRuntimeObject):
            (JSC::Bindings::CRuntimeObject::~CRuntimeObject):
            (JSC::Bindings::CRuntimeObject::getInternalCInstance):
            * bridge/c/CRuntimeObject.h: Added.
            (JSC::Bindings::CRuntimeObject::classInfo):
            * bridge/c/c_instance.cpp:
            (JSC::Bindings::CInstance::newRuntimeObject):
            * bridge/c/c_instance.h:
            * bridge/c/c_utility.cpp:
            (JSC::Bindings::convertValueToNPVariant):
            * bridge/jni/jsc/JavaInstanceJSC.h:
            * bridge/jni/jsc/JavaRuntimeObject.cpp: Added.
            (JSC::Bindings::):
            (JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
            (JSC::Bindings::JavaRuntimeObject::~JavaRuntimeObject):
            (JSC::Bindings::JavaRuntimeObject::getInternalJavaInstance):
            * bridge/jni/jsc/JavaRuntimeObject.h: Added.
            (JSC::Bindings::JavaRuntimeObject::classInfo):
            * bridge/jsc/BridgeJSC.h:
            * bridge/objc/ObjCRuntimeObject.h: Added.
            (JSC::Bindings::ObjCRuntimeObject::classInfo):
            * bridge/objc/ObjCRuntimeObject.mm: Added.
            (JSC::Bindings::):
            (JSC::Bindings::ObjCRuntimeObject::ObjCRuntimeObject):
            (JSC::Bindings::ObjCRuntimeObject::~ObjCRuntimeObject):
            (JSC::Bindings::ObjCRuntimeObject::getInternalObjCInstance):
            * bridge/objc/objc_instance.h:
            * bridge/objc/objc_instance.mm:
            (ObjcInstance::newRuntimeObject):
            * bridge/objc/objc_runtime.mm:
            (JSC::Bindings::callObjCFallbackObject):
            * bridge/runtime_root.h:
            Added RuntimeObject subclasses for each instance type, and use them for type casting.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55250 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 518c953..e8ac022 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-02-25  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35394
+        <rdar://problem/7685262> Make passing objects between Java and plug-ins work
+
+        * java/Makefile: Added plugin.jar to classpath to make JSObject available in test applets.
+
+        * java/java-and-plugins-expected.txt: Added.
+        * java/java-and-plugins.html: Added.
+
+        * java/SharedApplet.java: Added test methods for java-and-plugins.html.
+
+        * java/argument-to-object-type-expected.txt:
+        * java/argument-to-object-type.html:
+        * java/array-return-expected.txt:
+        * java/array-return.html:
+        Removed plug-in element that got here due to a copy/paste mistake.
+
 2010-02-25  Pavel Feldman  <pfeldman at chromium.org>
 
         Web Inspector: evaluate-on-hover does not work on HTML files.
diff --git a/LayoutTests/java/Makefile b/LayoutTests/java/Makefile
index f734057..5f48bc4 100644
--- a/LayoutTests/java/Makefile
+++ b/LayoutTests/java/Makefile
@@ -23,8 +23,22 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 
+ifeq ($(findstring 10.4, $(shell sw_vers -productVersion)), 10.4)
+	BUILDING_ON_TIGER = 1
+endif
+
+ifeq ($(findstring 10.5, $(shell sw_vers -productVersion)), 10.5)
+	BUILDING_ON_LEOPARD = 1
+endif
+
 JC = javac
-JFLAGS =
+ifeq ($(or $(BUILDING_ON_TIGER), $(BUILDING_ON_LEOPARD)), 1)
+	CLASSPATH = /System/Library/Frameworks/JavaVM.framework/Home/lib/plugin.jar
+else
+	# The above path works on Tiger and Leopard, but is a broken link on SnowLeopard, <rdar://7578937>.
+    CLASSPATH := /System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/Contents/Resources/Java/plugin.jar
+endif
+JFLAGS = -classpath $(CLASSPATH)
 .SUFFIXES: .java .class
 
 .java.class:
diff --git a/LayoutTests/java/SharedApplet.java b/LayoutTests/java/SharedApplet.java
index 3072a91..f66acd8 100644
--- a/LayoutTests/java/SharedApplet.java
+++ b/LayoutTests/java/SharedApplet.java
@@ -1,5 +1,7 @@
 import java.applet.Applet;
+import java.lang.reflect.*;
 import java.util.*;
+import netscape.javascript.*;
 
 public class SharedApplet extends Applet
 {
@@ -18,4 +20,28 @@ public class SharedApplet extends Applet
         result.add("Three");
         return result;
     }
+
+    public Object getSelf() {
+        return this;
+    }
+
+    public Object testGetProperty(JSObject obj, String propertyName) {
+        return obj.getMember(propertyName);
+    }
+
+    public Object testGetMember(JSObject obj, String memberName) {
+        return obj.getMember(memberName);
+    }
+
+    public void remember(Object obj) {
+        rememberedObject = obj;
+    }
+
+    public Object getAndForgetRememberedObject() {
+        Object result = rememberedObject;
+        rememberedObject = null;
+        return result;
+    }
+
+    private Object rememberedObject;
 }
diff --git a/LayoutTests/java/argument-to-object-type-expected.txt b/LayoutTests/java/argument-to-object-type-expected.txt
index 2d5a936..66d619b 100644
--- a/LayoutTests/java/argument-to-object-type-expected.txt
+++ b/LayoutTests/java/argument-to-object-type-expected.txt
@@ -6,4 +6,4 @@ PASS document.javaTest.objectToString(5) == "5.0" is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
- 
+
diff --git a/LayoutTests/java/argument-to-object-type.html b/LayoutTests/java/argument-to-object-type.html
index 797c7de..0848cf2 100644
--- a/LayoutTests/java/argument-to-object-type.html
+++ b/LayoutTests/java/argument-to-object-type.html
@@ -14,7 +14,6 @@ if (window.layoutTestController)
 Calling Java method which accepts Object always passes a null argument.</p>
 
 <div id="console"></div>
-<embed name="plg" type="application/x-webkit-test-netscape"></embed>
 <APPLET CODE="SharedApplet.class" NAME="javaTest" WIDTH=150 HEIGHT=25 MAYSCRIPT></APPLET>
 <script>
 
diff --git a/LayoutTests/java/array-return-expected.txt b/LayoutTests/java/array-return-expected.txt
index c1d3bbd..77f9d4c 100644
--- a/LayoutTests/java/array-return-expected.txt
+++ b/LayoutTests/java/array-return-expected.txt
@@ -7,4 +7,4 @@ PASS stringList.get(0) == "One" is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
- 
+
diff --git a/LayoutTests/java/array-return.html b/LayoutTests/java/array-return.html
index 47f44b0..c7988aa 100644
--- a/LayoutTests/java/array-return.html
+++ b/LayoutTests/java/array-return.html
@@ -14,7 +14,6 @@ if (window.layoutTestController)
 Applet methods can not return arrays to JS.</p>
 
 <div id="console"></div>
-<embed name="plg" type="application/x-webkit-test-netscape"></embed>
 <APPLET CODE="SharedApplet.class" NAME="javaTest" WIDTH=150 HEIGHT=25 MAYSCRIPT></APPLET>
 <script>
 
diff --git a/LayoutTests/java/java-and-plugins-expected.txt b/LayoutTests/java/java-and-plugins-expected.txt
new file mode 100644
index 0000000..0d30eb0
--- /dev/null
+++ b/LayoutTests/java/java-and-plugins-expected.txt
@@ -0,0 +1,16 @@
+Test that Java objects can be passed to NPAPI plug-ins, and vice versa.
+
+Some tests below are written in a way that works around issues with preserving object identity. They can be simplified once these issues are fixed.
+
+PASS document.plg.getAndForgetRememberedObject() + "" is document.javaTest.getSelf() + ""
+PASS document.plg.getAndForgetRememberedObject().getSelf().getSelf() + "" is document.javaTest.getSelf() + ""
+PASS document.plg.testHasMethod(document.javaTest, "getSelf") is true
+PASS document.plg.testHasMethod(document.javaTest, "doesNotExist") is false
+PASS document.plg.testHasMethod(document.javaTest.getSelf(), "getSelf") is true
+PASS document.plg.testHasMethod(document.javaTest.getSelf(), "doesNotExist") is false
+PASS document.javaTest.getAndForgetRememberedObject().objectPointer is document.plg.testObject.objectPointer
+PASS typeof document.javaTest.testGetMember(document.plg, "testDOMAccess") is "function"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+ 
diff --git a/LayoutTests/java/java-and-plugins.html b/LayoutTests/java/java-and-plugins.html
new file mode 100644
index 0000000..55bea0d
--- /dev/null
+++ b/LayoutTests/java/java-and-plugins.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+<script>
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitJavaEnabled", "1");
+</script>
+</head>
+<body>
+
+<p>Test that Java objects can be passed to NPAPI plug-ins, and vice versa.</p>
+<p>Some tests below are written in a way that works around issues with preserving object identity.
+They can be simplified once these issues are fixed.</p>
+
+<div id="console"></div>
+<embed name="plg" type="application/x-webkit-test-netscape"></embed>
+<applet CODE="SharedApplet.class" NAME="javaTest" WIDTH=150 HEIGHT=25 MAYSCRIPT></applet>
+<script>
+
+document.plg.remember(document.javaTest.getSelf());
+shouldBe('document.plg.getAndForgetRememberedObject() + ""', 'document.javaTest.getSelf() + ""');
+document.plg.remember(document.javaTest.getSelf());
+shouldBe('document.plg.getAndForgetRememberedObject().getSelf().getSelf() + ""', 'document.javaTest.getSelf() + ""');
+
+shouldBe('document.plg.testHasMethod(document.javaTest, "getSelf")', 'true');
+shouldBe('document.plg.testHasMethod(document.javaTest, "doesNotExist")', 'false');
+shouldBe('document.plg.testHasMethod(document.javaTest.getSelf(), "getSelf")', 'true');
+shouldBe('document.plg.testHasMethod(document.javaTest.getSelf(), "doesNotExist")', 'false');
+
+document.javaTest.remember(document.plg.testObject);
+shouldBe('document.javaTest.getAndForgetRememberedObject().objectPointer', 'document.plg.testObject.objectPointer');
+
+shouldBe('typeof document.javaTest.testGetMember(document.plg, "testDOMAccess")', '"function"');
+
+successfullyParsed = true;
+</script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a1bdec0..7125187 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,80 @@
+2010-02-25  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35394
+        <rdar://problem/7685262> Make passing objects between Java and plug-ins work
+
+        * WebCore.PluginHostProcess.exp: WebKit now subclasses RuntimeObject, so it needed more exports.
+
+        * bridge/runtime_object.cpp:
+        (JSC::Bindings::callRuntimeObject):
+        (JSC::Bindings::callRuntimeConstructor):
+        Assert that a runtime object is passed as function.
+
+        * bridge/runtime_object.h: Moved RuntimeObject into Bindings namespace, matching other
+        related classes.
+
+        * bridge/jni/jni_jsobject.mm:
+        (JavaJSObject::toString): Pass rootObject to convertValueToJValue(). It's not needed when
+        constructing a string, but this function now takes it for the sake of Object.
+        (JavaJSObject::convertValueToJObject): Check that object class is JavaRuntimeObject, not
+        just RuntimeObject.
+
+        * bridge/jni/jsc/JNIBridgeJSC.cpp:
+        (JavaField::setValueToInstance): Pass rootObject to convertValueToJValue().
+        (JavaArray::setValueAt): Ditto.
+
+        * bridge/jni/jsc/JNIUtilityPrivate.h: convertValueToJValue() now takes a RootObject argument,
+        because one is needed to gcProtect an object ghtat is wrapped into JSObject.
+
+        * bridge/jni/jsc/JNIUtilityPrivate.cpp: (JSC::Bindings::convertValueToJValue): Convert
+        JavaScript objects to Java JSObject ones. This was already happening in other code paths,
+        which we should change to use common code.
+
+        * bridge/jni/jsc/JavaInstanceJSC.cpp:
+        (JavaInstance::newRuntimeObject): Create an appropriate RuntimeObject subclass,
+        which is JavaRuntimeObject for Java.
+        (JavaInstance::invokeMethod): Unwrap returned JavaObjects that contain JS objects.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/objc/WebScriptObject.mm:
+        (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
+        * bridge/c/CRuntimeObject.cpp: Added.
+        (JSC::Bindings::CRuntimeObject::CRuntimeObject):
+        (JSC::Bindings::CRuntimeObject::~CRuntimeObject):
+        (JSC::Bindings::CRuntimeObject::getInternalCInstance):
+        * bridge/c/CRuntimeObject.h: Added.
+        (JSC::Bindings::CRuntimeObject::classInfo):
+        * bridge/c/c_instance.cpp:
+        (JSC::Bindings::CInstance::newRuntimeObject):
+        * bridge/c/c_instance.h:
+        * bridge/c/c_utility.cpp:
+        (JSC::Bindings::convertValueToNPVariant):
+        * bridge/jni/jsc/JavaInstanceJSC.h:
+        * bridge/jni/jsc/JavaRuntimeObject.cpp: Added.
+        (JSC::Bindings::):
+        (JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
+        (JSC::Bindings::JavaRuntimeObject::~JavaRuntimeObject):
+        (JSC::Bindings::JavaRuntimeObject::getInternalJavaInstance):
+        * bridge/jni/jsc/JavaRuntimeObject.h: Added.
+        (JSC::Bindings::JavaRuntimeObject::classInfo):
+        * bridge/jsc/BridgeJSC.h:
+        * bridge/objc/ObjCRuntimeObject.h: Added.
+        (JSC::Bindings::ObjCRuntimeObject::classInfo):
+        * bridge/objc/ObjCRuntimeObject.mm: Added.
+        (JSC::Bindings::):
+        (JSC::Bindings::ObjCRuntimeObject::ObjCRuntimeObject):
+        (JSC::Bindings::ObjCRuntimeObject::~ObjCRuntimeObject):
+        (JSC::Bindings::ObjCRuntimeObject::getInternalObjCInstance):
+        * bridge/objc/objc_instance.h:
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::newRuntimeObject):
+        * bridge/objc/objc_runtime.mm:
+        (JSC::Bindings::callObjCFallbackObject):
+        * bridge/runtime_root.h:
+        Added RuntimeObject subclasses for each instance type, and use them for type casting.
+
 2010-02-25  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Rubber-stamped by Xan Lopez.
diff --git a/WebCore/WebCore.PluginHostProcess.exp b/WebCore/WebCore.PluginHostProcess.exp
index fa32b5f..ae95867 100644
--- a/WebCore/WebCore.PluginHostProcess.exp
+++ b/WebCore/WebCore.PluginHostProcess.exp
@@ -1,15 +1,25 @@
 # This file gets appended to WebCore.exp when USE(PLUGIN_HOST_PROCESS) is 1.
 
-__ZN3JSC13RuntimeObject6s_infoE
 __ZN3JSC8Bindings10RootObjectD1Ev
+__ZN3JSC8Bindings13RuntimeObject11getCallDataERNS_8CallDataE
+__ZN3JSC8Bindings13RuntimeObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8Bindings13RuntimeObject16getConstructDataERNS_13ConstructDataE
+__ZN3JSC8Bindings13RuntimeObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC8Bindings13RuntimeObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC8Bindings13RuntimeObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC8Bindings13RuntimeObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC8Bindings13RuntimeObject6s_infoE
+__ZN3JSC8Bindings13RuntimeObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS0_8InstanceEEE
+__ZN3JSC8Bindings13RuntimeObjectD2Ev
 __ZN3JSC8Bindings8Instance19createRuntimeObjectEPNS_9ExecStateE
 __ZN3JSC8Bindings8InstanceC2EN3WTF10PassRefPtrINS0_10RootObjectEEE
 __ZN3JSC8Bindings8InstanceD2Ev
-__ZN7WebCore13IdentifierRep3getEi
 __ZN7WebCore13IdentifierRep3getEPKc
+__ZN7WebCore13IdentifierRep3getEi
 __ZN7WebCore13IdentifierRep7isValidEPS0_
 __ZN7WebCore16ScriptController16createRootObjectEPv
 __ZN7WebCore16ScriptController17canExecuteScriptsENS_33ReasonForCallingCanExecuteScriptsE
 __ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE
 __ZN7WebCore6String26fromUTF8WithLatin1FallbackEPKcm
 __ZN7WebCore6String8fromUTF8EPKcm
+__ZNK3JSC8Bindings13RuntimeObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 04d4029..e2680f9 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4717,6 +4717,12 @@
 		E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E12EDBE90B308E0B002704B6 /* EventTarget.cpp */; };
 		E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E15A36D61104572000B7B639 /* XMLNSNames.h */; };
 		E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15A36D81104572700B7B639 /* XMLNSNames.cpp */; };
+		E169803D1133542D00894115 /* CRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E169803C1133542D00894115 /* CRuntimeObject.h */; };
+		E16980491133644700894115 /* CRuntimeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E16980481133644700894115 /* CRuntimeObject.cpp */; };
+		E16982551134629D00894115 /* ObjCRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E16982541134629D00894115 /* ObjCRuntimeObject.h */; };
+		E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = E169825F1134636A00894115 /* ObjCRuntimeObject.mm */; };
+		E1698264113467F300894115 /* JavaRuntimeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1698263113467F300894115 /* JavaRuntimeObject.cpp */; };
+		E16982681134680700894115 /* JavaRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E16982671134680700894115 /* JavaRuntimeObject.h */; };
 		E17A4A1B0D97991D00FC10C6 /* DOMSVGAltGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAC0D974A00000541AE /* DOMSVGAltGlyphElement.h */; };
 		E17A4A1C0D97991D00FC10C6 /* DOMSVGAltGlyphElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAE0D974A00000541AE /* DOMSVGAltGlyphElementInternal.h */; };
 		E182568F0EF2B02D00933242 /* JSWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */; };
@@ -10002,6 +10008,12 @@
 		E12EDBE90B308E0B002704B6 /* EventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTarget.cpp; sourceTree = "<group>"; };
 		E15A36D61104572000B7B639 /* XMLNSNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLNSNames.h; sourceTree = "<group>"; };
 		E15A36D81104572700B7B639 /* XMLNSNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNSNames.cpp; sourceTree = "<group>"; };
+		E169803C1133542D00894115 /* CRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CRuntimeObject.h; sourceTree = "<group>"; };
+		E16980481133644700894115 /* CRuntimeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRuntimeObject.cpp; sourceTree = "<group>"; };
+		E16982541134629D00894115 /* ObjCRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCRuntimeObject.h; sourceTree = "<group>"; };
+		E169825F1134636A00894115 /* ObjCRuntimeObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCRuntimeObject.mm; sourceTree = "<group>"; };
+		E1698263113467F300894115 /* JavaRuntimeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaRuntimeObject.cpp; path = jsc/JavaRuntimeObject.cpp; sourceTree = "<group>"; };
+		E16982671134680700894115 /* JavaRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaRuntimeObject.h; path = jsc/JavaRuntimeObject.h; sourceTree = "<group>"; };
 		E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContext.cpp; sourceTree = "<group>"; };
 		E182568E0EF2B02D00933242 /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = "<group>"; };
 		E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextCustom.cpp; sourceTree = "<group>"; };
@@ -10435,6 +10447,8 @@
 		1A569CC50D7E2B82007C3983 /* c */ = {
 			isa = PBXGroup;
 			children = (
+				E16980481133644700894115 /* CRuntimeObject.cpp */,
+				E169803C1133542D00894115 /* CRuntimeObject.h */,
 				1A569CC60D7E2B82007C3983 /* c_class.cpp */,
 				1A569CC70D7E2B82007C3983 /* c_class.h */,
 				1A569CC80D7E2B82007C3983 /* c_instance.cpp */,
@@ -10467,6 +10481,8 @@
 		1A569CE20D7E2B82007C3983 /* objc */ = {
 			isa = PBXGroup;
 			children = (
+				E169825F1134636A00894115 /* ObjCRuntimeObject.mm */,
+				E16982541134629D00894115 /* ObjCRuntimeObject.h */,
 				1A569CE30D7E2B82007C3983 /* objc_class.h */,
 				1A569CE40D7E2B82007C3983 /* objc_class.mm */,
 				1A569CE50D7E2B82007C3983 /* objc_header.h */,
@@ -11175,6 +11191,8 @@
 				59E560A61105336600AA1258 /* JavaClassJSC.h */,
 				59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */,
 				59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */,
+				E1698263113467F300894115 /* JavaRuntimeObject.cpp */,
+				E16982671134680700894115 /* JavaRuntimeObject.h */,
 				59BC393E11054A1300FD85DB /* JavaStringJSC.h */,
 				59E842671109E5AE000305AD /* JNIBridgeJSC.cpp */,
 				59E842651109E5A2000305AD /* JNIBridgeJSC.h */,
@@ -18552,6 +18570,9 @@
 				9F2A322E1125A0A2003C3056 /* JavaScriptProfileNode.h in Headers */,
 				7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */,
 				7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */,
+				E169803D1133542D00894115 /* CRuntimeObject.h in Headers */,
+				E16982551134629D00894115 /* ObjCRuntimeObject.h in Headers */,
+				E16982681134680700894115 /* JavaRuntimeObject.h in Headers */,
 				65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
 				5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */,
 				0BC2C7781134A8FC000B2F61 /* CanvasSurface.h in Headers */,
@@ -20737,6 +20758,9 @@
 				9F2A322D1125A0A2003C3056 /* JavaScriptProfileNode.cpp in Sources */,
 				6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */,
 				6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */,
+				E16980491133644700894115 /* CRuntimeObject.cpp in Sources */,
+				E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */,
+				E1698264113467F300894115 /* JavaRuntimeObject.cpp in Sources */,
 				596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */,
 				0BC2C7771134A8FC000B2F61 /* CanvasSurface.cpp in Sources */,
 			);
diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm
index b346654..bd281c4 100644
--- a/WebCore/bindings/objc/WebScriptObject.mm
+++ b/WebCore/bindings/objc/WebScriptObject.mm
@@ -35,6 +35,7 @@
 #import "JSDOMWindowCustom.h"
 #import "JSHTMLElement.h"
 #import "JSPluginElementFunctions.h"
+#import "ObjCRuntimeObject.h"
 #import "PlatformString.h"
 #import "StringSourceProvider.h"
 #import "WebCoreObjCExtras.h"
@@ -518,9 +519,9 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
             ObjcInstance* instance = static_cast<ObjcInstance*>(pluginInstance(el));
             if (instance)
                 return instance->getObject();
-        } else if (object->inherits(&RuntimeObject::s_info)) {
-            RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(object);
-            ObjcInstance* instance = static_cast<ObjcInstance*>(runtimeObject->getInternalInstance());
+        } else if (object->inherits(&ObjCRuntimeObject::s_info)) {
+            ObjCRuntimeObject* runtimeObject = static_cast<ObjCRuntimeObject*>(object);
+            ObjcInstance* instance = runtimeObject->getInternalObjCInstance();
             if (instance)
                 return instance->getObject();
             return nil;
diff --git a/WebCore/bridge/c/CRuntimeObject.cpp b/WebCore/bridge/c/CRuntimeObject.cpp
new file mode 100644
index 0000000..47425a2
--- /dev/null
+++ b/WebCore/bridge/c/CRuntimeObject.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#include "config.h"
+
+#if ENABLE(NETSCAPE_PLUGIN_API)
+
+#include "CRuntimeObject.h"
+#include "c_instance.h"
+
+namespace JSC {
+namespace Bindings {
+
+const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_info, 0, 0 };
+
+CRuntimeObject::CRuntimeObject(ExecState* exec, PassRefPtr<CInstance> instance)
+    : RuntimeObject(exec, instance)
+{
+}
+
+CRuntimeObject::~CRuntimeObject()
+{
+}
+
+CInstance* CRuntimeObject::getInternalCInstance() const
+{
+    return static_cast<CInstance*>(getInternalInstance());
+}
+
+
+}
+}
+
+#endif
diff --git a/WebCore/bridge/c/CRuntimeObject.h b/WebCore/bridge/c/CRuntimeObject.h
new file mode 100644
index 0000000..b53387a
--- /dev/null
+++ b/WebCore/bridge/c/CRuntimeObject.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#ifndef CRuntimeObject_h
+#define CRuntimeObject_h
+
+#if ENABLE(NETSCAPE_PLUGIN_API)
+
+#include "runtime_object.h"
+
+namespace JSC {
+namespace Bindings {
+
+class CInstance;
+
+class CRuntimeObject : public RuntimeObject {
+public:
+    CRuntimeObject(ExecState*, PassRefPtr<CInstance>);
+    virtual ~CRuntimeObject();
+
+    CInstance* getInternalCInstance() const;
+
+    static const ClassInfo s_info;
+
+private:
+    virtual const ClassInfo* classInfo() const { return &s_info; }
+};
+
+}
+}
+
+#endif
+#endif
diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp
index 1b05259..bb9b2ee 100644
--- a/WebCore/bridge/c/c_instance.cpp
+++ b/WebCore/bridge/c/c_instance.cpp
@@ -29,15 +29,16 @@
 
 #include "c_instance.h"
 
+#include "CRuntimeObject.h"
+#include "IdentifierRep.h"
 #include "c_class.h"
 #include "c_runtime.h"
 #include "c_utility.h"
-#include "IdentifierRep.h"
 #include "npruntime_impl.h"
 #include "runtime_root.h"
+#include <interpreter/CallFrame.h>
 #include <runtime/ArgList.h>
 #include <runtime/Error.h>
-#include <interpreter/CallFrame.h>
 #include <runtime/JSLock.h>
 #include <runtime/JSNumberCell.h>
 #include <runtime/PropertyNameArray.h>
@@ -89,6 +90,11 @@ CInstance::~CInstance()
     _NPN_ReleaseObject(_object);
 }
 
+RuntimeObject* CInstance::newRuntimeObject(ExecState* exec)
+{
+    return new (exec) CRuntimeObject(exec, this);
+}
+
 Class *CInstance::getClass() const
 {
     if (!_class)
diff --git a/WebCore/bridge/c/c_instance.h b/WebCore/bridge/c/c_instance.h
index abbabad..b1ad6e7 100644
--- a/WebCore/bridge/c/c_instance.h
+++ b/WebCore/bridge/c/c_instance.h
@@ -77,6 +77,8 @@ public:
 private:
     CInstance(NPObject*, PassRefPtr<RootObject>);
 
+    virtual RuntimeObject* newRuntimeObject(ExecState*);
+
     mutable CClass *_class;
     NPObject *_object;
 };
diff --git a/WebCore/bridge/c/c_utility.cpp b/WebCore/bridge/c/c_utility.cpp
index 420a822..04d47c3 100644
--- a/WebCore/bridge/c/c_utility.cpp
+++ b/WebCore/bridge/c/c_utility.cpp
@@ -30,6 +30,7 @@
 
 #include "c_utility.h"
 
+#include "CRuntimeObject.h"
 #include "JSDOMWindow.h"
 #include "NP_jsobject.h"
 #include "c_instance.h"
@@ -85,9 +86,9 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result)
         NULL_TO_NPVARIANT(*result);
     } else if (value.isObject()) {
         JSObject* object = asObject(value);
-        if (object->classInfo() == &RuntimeObject::s_info) {
-            RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(object);
-            CInstance* instance = static_cast<CInstance*>(runtimeObject->getInternalInstance());
+        if (object->classInfo() == &CRuntimeObject::s_info) {
+            CRuntimeObject* runtimeObject = static_cast<CRuntimeObject*>(object);
+            CInstance* instance = runtimeObject->getInternalCInstance();
             if (instance) {
                 NPObject* obj = instance->getObject();
                 _NPN_RetainObject(obj);
diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm
index 4ea4ee2..5e036ab 100644
--- a/WebCore/bridge/jni/jni_jsobject.mm
+++ b/WebCore/bridge/jni/jni_jsobject.mm
@@ -29,6 +29,7 @@
 #if ENABLE(MAC_JAVA_BRIDGE)
 
 #include "Frame.h"
+#include "JavaRuntimeObject.h"
 #include "JNIBridge.h"
 #include "JNIUtility.h"
 #include "JNIUtilityPrivate.h"
@@ -418,7 +419,7 @@ jstring JavaJSObject::toString() const
     JSObject *thisObj = const_cast<JSObject*>(_imp);
     ExecState* exec = rootObject->globalObject()->globalExec();
     
-    return (jstring)convertValueToJValue (exec, thisObj, object_type, "java.lang.String").l;
+    return static_cast<jstring>(convertValueToJValue(exec, rootObject, thisObj, object_type, "java.lang.String").l);
 }
 
 void JavaJSObject::finalize() const
@@ -518,9 +519,9 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const
             // object.  If we have a wrapper around a Java instance, return that
             // instance, otherwise create a new Java JavaJSObject with the JSObject*
             // as its nativeHandle.
-            if (object->classInfo() && strcmp(object->classInfo()->className, "RuntimeObject") == 0) {
-                RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(object);
-                JavaInstance* runtimeInstance = static_cast<JavaInstance*>(runtimeObject->getInternalInstance());
+            if (object->inherits(&JavaRuntimeObject::s_info)) {
+                JavaRuntimeObject* runtimeObject = static_cast<JavaRuntimeObject*>(object);
+                JavaInstance* runtimeInstance = runtimeObject->getInternalJavaInstance();
                 if (!runtimeInstance)
                     return 0;
                 
diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
index b598263..bcc3274 100644
--- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
@@ -181,7 +181,7 @@ void JavaField::dispatchSetValueToInstance(ExecState* exec, const JavaInstance*
 void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const
 {
     const JavaInstance* instance = static_cast<const JavaInstance*>(i);
-    jvalue javaValue = convertValueToJValue(exec, aValue, m_JNIType, type());
+    jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_JNIType, type());
 
     LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii());
 
@@ -278,7 +278,7 @@ void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) cons
         javaClassName = strdup(&m_type[2]);
         javaClassName[strchr(javaClassName, ';')-javaClassName] = 0;
     }
-    jvalue aJValue = convertValueToJValue(exec, aValue, arrayType, javaClassName);
+    jvalue aJValue = convertValueToJValue(exec, m_rootObject.get(), aValue, arrayType, javaClassName);
 
     switch (arrayType) {
     case object_type:
diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp
index 38f74eb..d3f64dd 100644
--- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp
+++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp
@@ -29,6 +29,7 @@
 
 #if ENABLE(MAC_JAVA_BRIDGE)
 
+#include "JavaRuntimeObject.h"
 #include "JNIBridgeJSC.h"
 #include "runtime_array.h"
 #include "runtime_object.h"
@@ -168,7 +169,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray
     return jarray;
 }
 
-jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, const char* javaClassName)
+jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue value, JNIType jniType, const char* javaClassName)
 {
     JSLock lock(SilenceAssertionsOnly);
 
@@ -182,12 +183,12 @@ jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, con
             // FIXME: JavaJSObject::convertValueToJObject functionality is almost exactly the same,
             // these functions should use common code.
 
-            // First see if we have a Java instance.
             if (value.isObject()) {
                 JSObject* object = asObject(value);
-                if (object->classInfo() == &RuntimeObject::s_info) {
-                    RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(object);
-                    JavaInstance* instance = static_cast<JavaInstance*>(runtimeObject->getInternalInstance());
+                if (object->inherits(&JavaRuntimeObject::s_info)) {
+                    // Unwrap a Java instance.
+                    JavaRuntimeObject* runtimeObject = static_cast<JavaRuntimeObject*>(object);
+                    JavaInstance* instance = runtimeObject->getInternalJavaInstance();
                     if (instance)
                         result.l = instance->javaInstance();
                 } else if (object->classInfo() == &RuntimeArray::s_info) {
@@ -198,6 +199,16 @@ jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, con
                 } else if (object->classInfo() == &JSArray::info) {
                     // Input is a Javascript Array. We need to create it to a Java Array.
                     result.l = convertArrayInstanceToJavaArray(exec, asArray(value), javaClassName);
+                } else if (!result.l && (!strcmp(javaClassName, "java.lang.Object")) || (!strcmp(javaClassName, "netscape.javascript.JSObject"))) {
+                    // Wrap objects in JSObject instances.
+                    JNIEnv* env = getJNIEnv();
+                    jclass jsObjectClass = env->FindClass("sun/plugin/javascript/webkit/JSObject");
+                    jmethodID constructorID = env->GetMethodID(jsObjectClass, "<init>", "(J)V");
+                    if (constructorID) {
+                        jlong nativeHandle = ptr_to_jlong(object);
+                        rootObject->gcProtect(object);
+                        result.l = env->NewObject(jsObjectClass, constructorID, nativeHandle);
+                    }
                 }
             }
 
diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h
index 0297f97..8d4652d 100644
--- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h
+++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h
@@ -39,7 +39,9 @@ class JSObject;
 
 namespace Bindings {
 
-jvalue convertValueToJValue(ExecState*, JSValue, JNIType, const char* javaClassName);
+class RootObject;
+
+jvalue convertValueToJValue(ExecState*, RootObject*, JSValue, JNIType, const char* javaClassName);
 bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription);
 
 } // namespace Bindings
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
index 4fc7e8e..ade26bb 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
@@ -28,6 +28,7 @@
 
 #if ENABLE(MAC_JAVA_BRIDGE)
 
+#include "JavaRuntimeObject.h"
 #include "JNIBridgeJSC.h"
 #include "JNIUtility.h"
 #include "JNIUtilityPrivate.h"
@@ -55,6 +56,11 @@ JavaInstance::~JavaInstance()
     delete m_class;
 }
 
+RuntimeObject* JavaInstance::newRuntimeObject(ExecState* exec)
+{
+    return new (exec) JavaRuntimeObject(exec, this);
+}
+
 #define NUM_LOCAL_REFS 64
 
 void JavaInstance::virtualBegin()
@@ -135,7 +141,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, const MethodList& methodList
 
     for (i = 0; i < count; i++) {
         JavaParameter* aParameter = jMethod->parameterAt(i);
-        jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type());
+        jArgs[i] = convertValueToJValue(exec, m_rootObject.get(), args.at(i), aParameter->getJNIType(), aParameter->type());
         LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, args.at(i).toString(exec).ascii());
     }
 
@@ -215,10 +221,24 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, const MethodList& methodList
                 const char* arrayType = jMethod->returnType();
                 if (arrayType[0] == '[')
                     resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject);
-                else
-                    resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec);
+                else {
+                    jobject classOfInstance = callJNIMethod<jobject>(result.l, "getClass", "()Ljava/lang/Class;");
+                    jstring className = static_cast<jstring>(callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;"));
+                    if (!strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject")) {
+                        // Pull the nativeJSObject value from the Java instance.  This is a pointer to the JSObject.
+                        JNIEnv* env = getJNIEnv();
+                        jfieldID fieldID = env->GetFieldID(static_cast<jclass>(classOfInstance), "nativeJSObject", "J");
+                        jlong nativeHandle = env->GetLongField(result.l, fieldID);
+                        // FIXME: Handling of undefined values differs between functions in JNIUtilityPrivate.cpp and those in those in jni_jsobject.mm,
+                        // and so it does between different versions of LiveConnect spec. There should not be multiple code paths to do the same work.
+                        if (nativeHandle == 1 /* UndefinedHandle */)
+                            return jsUndefined();
+                        return static_cast<JSObject*>(jlong_to_ptr(nativeHandle));
+                    } else
+                        return JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec);
+                }
             } else
-                resultValue = jsUndefined();
+                return jsUndefined();
         }
         break;
 
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
index a46c6d3..4bebdff 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.h
@@ -92,6 +92,9 @@ public:
 
 protected:
     JavaInstance(jobject instance, PassRefPtr<RootObject>);
+
+    virtual RuntimeObject* newRuntimeObject(ExecState*);
+
     virtual void virtualBegin();
     virtual void virtualEnd();
 
diff --git a/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp b/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
new file mode 100644
index 0000000..dc58b71
--- /dev/null
+++ b/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#include "config.h"
+
+#include "JavaInstanceJSC.h"
+#include "JavaRuntimeObject.h"
+
+namespace JSC {
+namespace Bindings {
+
+const ClassInfo JavaRuntimeObject::s_info = { "JavaRuntimeObject", &RuntimeObject::s_info, 0, 0 };
+
+JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, PassRefPtr<JavaInstance> instance)
+    : RuntimeObject(exec, instance)
+{
+}
+
+JavaRuntimeObject::~JavaRuntimeObject()
+{
+}
+
+JavaInstance* JavaRuntimeObject::getInternalJavaInstance() const
+{
+    return static_cast<JavaInstance*>(getInternalInstance());
+}
+
+
+
+}
+}
diff --git a/WebCore/bridge/jni/jsc/JavaRuntimeObject.h b/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
new file mode 100644
index 0000000..d9bf693
--- /dev/null
+++ b/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#ifndef JavaRuntimeObject_h
+#define JavaRuntimeObject_h
+
+#include "runtime_object.h"
+
+namespace JSC {
+namespace Bindings {
+
+class JavaInstance;
+
+class JavaRuntimeObject : public RuntimeObject {
+public:
+    JavaRuntimeObject(ExecState*, PassRefPtr<JavaInstance>);
+    virtual ~JavaRuntimeObject();
+
+    JavaInstance* getInternalJavaInstance() const;
+
+    static const ClassInfo s_info;
+
+private:
+    virtual const ClassInfo* classInfo() const { return &s_info; }
+};
+
+}
+}
+
+#endif
diff --git a/WebCore/bridge/jsc/BridgeJSC.h b/WebCore/bridge/jsc/BridgeJSC.h
index 8a10815..423abd2 100644
--- a/WebCore/bridge/jsc/BridgeJSC.h
+++ b/WebCore/bridge/jsc/BridgeJSC.h
@@ -40,13 +40,13 @@ class ArgList;
 class Identifier;
 class JSGlobalObject;
 class PropertyNameArray;
-class RuntimeObject;
 
 namespace Bindings {
 
 class Instance;
 class Method;
 class RootObject;
+class RuntimeObject;
 
 typedef Vector<Method*> MethodList;
 
diff --git a/WebCore/bridge/objc/ObjCRuntimeObject.h b/WebCore/bridge/objc/ObjCRuntimeObject.h
new file mode 100644
index 0000000..5c44157
--- /dev/null
+++ b/WebCore/bridge/objc/ObjCRuntimeObject.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#ifndef ObjCRuntimeObject_h
+#define ObjCRuntimeObject_h
+
+#include "runtime_object.h"
+
+namespace JSC {
+namespace Bindings {
+
+class ObjcInstance;
+
+class ObjCRuntimeObject : public RuntimeObject {
+public:
+    ObjCRuntimeObject(ExecState*, PassRefPtr<ObjcInstance>);
+    virtual ~ObjCRuntimeObject();
+
+    ObjcInstance* getInternalObjCInstance() const;
+
+    static const ClassInfo s_info;
+
+private:
+    virtual const ClassInfo* classInfo() const { return &s_info; }
+};
+
+}
+}
+
+#endif
diff --git a/WebCore/bridge/objc/ObjCRuntimeObject.mm b/WebCore/bridge/objc/ObjCRuntimeObject.mm
new file mode 100644
index 0000000..c7c4e98
--- /dev/null
+++ b/WebCore/bridge/objc/ObjCRuntimeObject.mm
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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. 
+ */
+
+#import "config.h"
+
+#import "ObjCRuntimeObject.h"
+#import "objc_instance.h"
+
+namespace JSC {
+namespace Bindings {
+
+const ClassInfo ObjCRuntimeObject::s_info = { "ObjCRuntimeObject", &RuntimeObject::s_info, 0, 0 };
+
+ObjCRuntimeObject::ObjCRuntimeObject(ExecState* exec, PassRefPtr<ObjcInstance> instance)
+    : RuntimeObject(exec, instance)
+{
+}
+
+ObjCRuntimeObject::~ObjCRuntimeObject()
+{
+}
+
+ObjcInstance* ObjCRuntimeObject::getInternalObjCInstance() const
+{
+    return static_cast<ObjcInstance*>(getInternalInstance());
+}
+
+
+}
+}
diff --git a/WebCore/bridge/objc/objc_instance.h b/WebCore/bridge/objc/objc_instance.h
index 64cd491..e1f73c3 100644
--- a/WebCore/bridge/objc/objc_instance.h
+++ b/WebCore/bridge/objc/objc_instance.h
@@ -68,7 +68,9 @@ private:
     static void moveGlobalExceptionToExecState(ExecState*);
 
     ObjcInstance(ObjectStructPtr, PassRefPtr<RootObject>);
-    
+
+    virtual RuntimeObject* newRuntimeObject(ExecState*);
+
     RetainPtr<ObjectStructPtr> _instance;
     mutable ObjcClass *_class;
     ObjectStructPtr _pool;
diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm
index 86b701b..314658c 100644
--- a/WebCore/bridge/objc/objc_instance.mm
+++ b/WebCore/bridge/objc/objc_instance.mm
@@ -27,6 +27,7 @@
 #import "objc_instance.h"
 
 #import "FoundationExtras.h"
+#import "ObjCRuntimeObject.h"
 #import "WebScriptObject.h"
 #import <objc/objc-auto.h>
 #import <runtime/Error.h>
@@ -61,6 +62,11 @@ static NSMapTable *createInstanceWrapperCache()
 #endif
 }
 
+RuntimeObject* ObjcInstance::newRuntimeObject(ExecState* exec)
+{
+    return new (exec) ObjCRuntimeObject(exec, this);
+}
+
 void ObjcInstance::setGlobalException(NSString* exception, JSGlobalObject* exceptionEnvironment)
 {
     HardRelease(s_exception);
diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm
index f85df9a..652f4d1 100644
--- a/WebCore/bridge/objc/objc_runtime.mm
+++ b/WebCore/bridge/objc/objc_runtime.mm
@@ -27,6 +27,7 @@
 #include "objc_runtime.h"
 
 #include "JSDOMBinding.h"
+#include "ObjCRuntimeObject.h"
 #include "WebScriptObject.h"
 #include "objc_instance.h"
 #include "runtime_array.h"
@@ -216,34 +217,33 @@ void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue, PutPrope
 
 static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args)
 {
-    if (!thisValue.inherits(&RuntimeObject::s_info))
+    if (!thisValue.inherits(&ObjCRuntimeObject::s_info))
         return throwError(exec, TypeError);
 
     JSValue result = jsUndefined();
 
-    RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(asObject(thisValue));
-    Instance* instance = runtimeObject->getInternalInstance();
+    ObjCRuntimeObject* runtimeObject = static_cast<ObjCRuntimeObject*>(asObject(thisValue));
+    ObjcInstance* objcInstance = runtimeObject->getInternalObjCInstance();
 
-    if (!instance)
+    if (!objcInstance)
         return RuntimeObject::throwInvalidAccessError(exec);
     
-    instance->begin();
+    objcInstance->begin();
 
-    ObjcInstance* objcInstance = static_cast<ObjcInstance*>(instance);
     id targetObject = objcInstance->getObject();
     
     if ([targetObject respondsToSelector:@selector(invokeUndefinedMethodFromWebScript:withArguments:)]){
-        ObjcClass* objcClass = static_cast<ObjcClass*>(instance->getClass());
+        ObjcClass* objcClass = static_cast<ObjcClass*>(objcInstance->getClass());
         OwnPtr<ObjcMethod> fallbackMethod(new ObjcMethod(objcClass->isa(), @selector(invokeUndefinedMethodFromWebScript:withArguments:)));
         const Identifier& nameIdentifier = static_cast<ObjcFallbackObjectImp*>(function)->propertyName();
         RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.data(), nameIdentifier.size()));
         fallbackMethod->setJavaScriptName(name.get());
         MethodList methodList;
         methodList.append(fallbackMethod.get());
-        result = instance->invokeMethod(exec, methodList, args);
+        result = objcInstance->invokeMethod(exec, methodList, args);
     }
             
-    instance->end();
+    objcInstance->end();
 
     return result;
 }
diff --git a/WebCore/bridge/runtime_object.cpp b/WebCore/bridge/runtime_object.cpp
index 872cea3..3e21a8f 100644
--- a/WebCore/bridge/runtime_object.cpp
+++ b/WebCore/bridge/runtime_object.cpp
@@ -34,8 +34,7 @@
 using namespace WebCore;
 
 namespace JSC {
-
-using namespace Bindings;
+namespace Bindings {
 
 const ClassInfo RuntimeObject::s_info = { "RuntimeObject", 0, 0, 0 };
 
@@ -258,6 +257,7 @@ JSValue RuntimeObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint
 
 static JSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec, JSObject* function, JSValue, const ArgList& args)
 {
+    ASSERT(function->inherits(&RuntimeObject::s_info));
     RefPtr<Instance> instance(static_cast<RuntimeObject*>(function)->getInternalInstance());
     instance->begin();
     JSValue result = instance->invokeDefaultMethod(exec, args);
@@ -280,6 +280,7 @@ CallType RuntimeObject::getCallData(CallData& callData)
 
 static JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, const ArgList& args)
 {
+    ASSERT(constructor->inherits(&RuntimeObject::s_info));
     RefPtr<Instance> instance(static_cast<RuntimeObject*>(constructor)->getInternalInstance());
     instance->begin();
     JSValue result = instance->invokeConstruct(exec, args);
@@ -322,3 +323,4 @@ JSObject* RuntimeObject::throwInvalidAccessError(ExecState* exec)
 }
 
 }
+}
diff --git a/WebCore/bridge/runtime_object.h b/WebCore/bridge/runtime_object.h
index 66d50ed..5049d0e 100644
--- a/WebCore/bridge/runtime_object.h
+++ b/WebCore/bridge/runtime_object.h
@@ -30,10 +30,11 @@
 #include <runtime/JSGlobalObject.h>
 
 namespace JSC {
+namespace Bindings {
 
 class RuntimeObject : public JSObject {
 public:
-    RuntimeObject(ExecState*, PassRefPtr<Bindings::Instance>);
+    RuntimeObject(ExecState*, PassRefPtr<Instance>);
     virtual ~RuntimeObject();
 
     virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
@@ -48,7 +49,7 @@ public:
 
     void invalidate();
 
-    Bindings::Instance* getInternalInstance() const { return m_instance.get(); }
+    Instance* getInternalInstance() const { return m_instance.get(); }
 
     static JSObject* throwInvalidAccessError(ExecState*);
 
@@ -66,7 +67,7 @@ public:
 
 protected:
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
-    RuntimeObject(ExecState*, NonNullPassRefPtr<Structure>, PassRefPtr<Bindings::Instance>);
+    RuntimeObject(ExecState*, NonNullPassRefPtr<Structure>, PassRefPtr<Instance>);
 
 private:
     virtual const ClassInfo* classInfo() const { return &s_info; }
@@ -75,9 +76,10 @@ private:
     static JSValue fieldGetter(ExecState*, const Identifier&, const PropertySlot&);
     static JSValue methodGetter(ExecState*, const Identifier&, const PropertySlot&);
 
-    RefPtr<Bindings::Instance> m_instance;
+    RefPtr<Instance> m_instance;
 };
     
-} // namespace
+}
+}
 
 #endif
diff --git a/WebCore/bridge/runtime_root.h b/WebCore/bridge/runtime_root.h
index 5435c3e..04f382a 100644
--- a/WebCore/bridge/runtime_root.h
+++ b/WebCore/bridge/runtime_root.h
@@ -41,11 +41,11 @@ namespace JSC {
 
 class Interpreter;
 class JSGlobalObject;
-class RuntimeObject;
 
 namespace Bindings {
 
 class RootObject;
+class RuntimeObject;
 
 typedef HashCountedSet<JSObject*> ProtectCountSet;
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 134a252..66a30de 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-25  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35394
+        <rdar://problem/7685262> Make passing objects between Java and plug-ins work
+
+        * WebKit.xcodeproj/project.pbxproj: Added new files.
+
 2010-02-04  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index dda5966..f78f7a7 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -348,6 +348,8 @@
 		DD89682009AA87240097E7F0 /* WebElementDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = DD89681E09AA87240097E7F0 /* WebElementDictionary.h */; };
 		DD89682109AA87240097E7F0 /* WebElementDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD89681F09AA87240097E7F0 /* WebElementDictionary.mm */; };
 		E15663190FB61C1F00C199CA /* WebDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = E15663180FB61C1F00C199CA /* WebDownload.mm */; };
+		E169836211346D1B00894115 /* ProxyRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E169836111346D1B00894115 /* ProxyRuntimeObject.h */; };
+		E169836C11346D5600894115 /* ProxyRuntimeObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = E169836B11346D5600894115 /* ProxyRuntimeObject.mm */; };
 		ED5B9524111B725A00472298 /* WebLocalizableStrings.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED5B9523111B725A00472298 /* WebLocalizableStrings.mm */; };
 		ED6BE2E7088C32B50044DEDC /* WebNSAttributedStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */; };
 		ED6BE2E8088C32B50044DEDC /* WebNSAttributedStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.mm */; };
@@ -645,6 +647,8 @@
 		DD89681E09AA87240097E7F0 /* WebElementDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebElementDictionary.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		DD89681F09AA87240097E7F0 /* WebElementDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebElementDictionary.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		E15663180FB61C1F00C199CA /* WebDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDownload.mm; sourceTree = "<group>"; };
+		E169836111346D1B00894115 /* ProxyRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyRuntimeObject.h; sourceTree = "<group>"; };
+		E169836B11346D5600894115 /* ProxyRuntimeObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProxyRuntimeObject.mm; sourceTree = "<group>"; };
 		ED21B9810528F7AA003299AC /* WebDocumentInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocumentInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		ED2B2474033A2DA800C1A526 /* WebNSPasteboardExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSPasteboardExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		ED2B2475033A2DA800C1A526 /* WebNSPasteboardExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSPasteboardExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -819,6 +823,8 @@
 				1AAF5CE90EDDE1FE008D883D /* NetscapePluginInstanceProxy.mm */,
 				1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */,
 				1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */,
+				E169836111346D1B00894115 /* ProxyRuntimeObject.h */,
+				E169836B11346D5600894115 /* ProxyRuntimeObject.mm */,
 				1AAF5FBD0EDE3A92008D883D /* WebHostedNetscapePluginView.h */,
 				1AAF5FBE0EDE3A92008D883D /* WebHostedNetscapePluginView.mm */,
 				1AAF588A0EDCCEA3008D883D /* WebKitPluginAgent.defs */,
@@ -1546,6 +1552,7 @@
 				939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
 				0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */,
 				41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */,
+				E169836211346D1B00894115 /* ProxyRuntimeObject.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1889,6 +1896,7 @@
 				0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
 				41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
 				ED5B9524111B725A00472298 /* WebLocalizableStrings.mm in Sources */,
+				E169836C11346D5600894115 /* ProxyRuntimeObject.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index d80a775..ca25309 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,25 @@
+2010-02-25  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35394
+        <rdar://problem/7685262> Make passing objects between Java and plug-ins work
+
+        Added a ProxyInstance implementation of RuntimeObject.
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::addValueToArray):
+        * Plugins/Hosted/ProxyInstance.h:
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyInstance::newRuntimeObject):
+        (WebKit::ProxyInstance::getClass):
+        * Plugins/Hosted/ProxyRuntimeObject.h: Added.
+        (WebKit::ProxyRuntimeObject::classInfo):
+        * Plugins/Hosted/ProxyRuntimeObject.mm: Added.
+        (WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
+        (WebKit::ProxyRuntimeObject::~ProxyRuntimeObject):
+        (WebKit::ProxyRuntimeObject::getInternalProxyInstance):
+
 2010-02-24  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 1ae54f7..0870df7 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -30,6 +30,7 @@
 #import "HostedNetscapePluginStream.h"
 #import "NetscapePluginHostProxy.h"
 #import "ProxyInstance.h"
+#import "ProxyRuntimeObject.h"
 #import "WebDataSourceInternal.h"
 #import "WebFrameInternal.h"
 #import "WebHostedNetscapePluginView.h"
@@ -1206,9 +1207,9 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta
         [array addObject:[NSNumber numberWithInt:NullValueType]];
     else if (value.isObject()) {
         JSObject* object = asObject(value);
-        if (object->classInfo() == &RuntimeObject::s_info) {
-            RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(object);
-            if (ProxyInstance* instance = static_cast<ProxyInstance*>(runtimeObject->getInternalInstance())) {
+        if (object->classInfo() == &ProxyRuntimeObject::s_info) {
+            ProxyRuntimeObject* runtimeObject = static_cast<ProxyRuntimeObject*>(object);
+            if (ProxyInstance* instance = runtimeObject->getInternalProxyInstance()) {
                 [array addObject:[NSNumber numberWithInt:NPObjectValueType]];
                 [array addObject:[NSNumber numberWithInt:instance->objectID()]];
             }
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.h b/WebKit/mac/Plugins/Hosted/ProxyInstance.h
index 6e8ac47..a56f367 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.h
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.h
@@ -58,8 +58,10 @@ public:
     
 private:
     ProxyInstance(PassRefPtr<JSC::Bindings::RootObject>, NetscapePluginInstanceProxy*, uint32_t objectID);
-    
-    virtual JSC::Bindings::Class *getClass() const;
+
+    virtual JSC::Bindings::RuntimeObject* newRuntimeObject(JSC::ExecState*);
+
+    virtual JSC::Bindings::Class* getClass() const;
 
     virtual JSC::JSValue invokeMethod(JSC::ExecState*, const JSC::Bindings::MethodList&, const JSC::ArgList& args);
 
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index c7a0ebe..961347b 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -28,6 +28,7 @@
 #import "ProxyInstance.h"
 
 #import "NetscapePluginHostProxy.h"
+#import "ProxyRuntimeObject.h"
 #import <WebCore/IdentifierRep.h>
 #import <WebCore/JSDOMWindow.h>
 #import <WebCore/npruntime_impl.h>
@@ -128,7 +129,12 @@ ProxyInstance::~ProxyInstance()
     invalidate();
 }
     
-JSC::Bindings::Class *ProxyInstance::getClass() const
+RuntimeObject* ProxyInstance::newRuntimeObject(ExecState* exec)
+{
+    return new (exec) ProxyRuntimeObject(exec, this);
+}
+
+JSC::Bindings::Class* ProxyInstance::getClass() const
 {
     return proxyClass();
 }
diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
new file mode 100644
index 0000000..af3c5db
--- /dev/null
+++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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 ProxyRuntimeObject_h
+#define ProxyRuntimeObject_h
+
+#include <WebCore/runtime_object.h>
+
+namespace WebKit {
+
+class ProxyInstance;
+
+class ProxyRuntimeObject : public JSC::Bindings::RuntimeObject {
+public:
+    ProxyRuntimeObject(JSC::ExecState*, PassRefPtr<ProxyInstance>);
+    virtual ~ProxyRuntimeObject();
+
+    ProxyInstance* getInternalProxyInstance() const;
+
+    static const JSC::ClassInfo s_info;
+
+private:
+    virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+};
+
+}
+
+#endif
+#endif
diff --git a/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
new file mode 100644
index 0000000..5ba6e15
--- /dev/null
+++ b/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 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 COMPUTER, 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)
+
+#include "ProxyInstance.h"
+#include "ProxyRuntimeObject.h"
+
+using namespace JSC;
+
+namespace WebKit {
+
+
+const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObject::s_info, 0, 0 };
+
+ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, PassRefPtr<ProxyInstance> instance)
+    : RuntimeObject(exec, instance)
+{
+}
+
+ProxyRuntimeObject::~ProxyRuntimeObject()
+{
+}
+
+ProxyInstance* ProxyRuntimeObject::getInternalProxyInstance() const
+{
+    return static_cast<ProxyInstance*>(getInternalInstance());
+}
+
+
+}
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list