Bug 7917 - JSObject in LiveConnect not working.
Summary: JSObject in LiveConnect not working.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://ducati.homedns.org/testJava.html
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-22 11:12 PST by David Carson
Modified: 2006-03-23 23:13 PST (History)
0 users

See Also:


Attachments
Test page with Java jar file and source code. (4.86 KB, application/octet-stream)
2006-03-22 11:20 PST, David Carson
no flags Details
patch (2.11 KB, patch)
2006-03-22 11:47 PST, David Carson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Carson 2006-03-22 11:12:48 PST
Calls from Applet using JSObject not working. The code below shows the applet calls:

        private void showMessage(String str)
        {
            JSObject root = JSObject.getWindow(HelloApplet.this);
            JSObject document = (JSObject)(root.getMember("document"));
            JSObject body =(JSObject)(document.getMember("body"));
            JSObject br = (JSObject)(document.call(
                "createElement", new Object[] { "br" }));
            body.call("appendChild", new Object[] { br});
            JSObject text = (JSObject)(document.call(
                "createTextNode", new Object[] { str }));
            body.call("appendChild", new Object[] { text});
        }
Comment 1 David Carson 2006-03-22 11:20:07 PST
Created attachment 7234 [details]
Test page with Java jar file and source code.

For some reason, the test case can not be loaded from the local file system, it must be hosted on a web server. When loading from the local file system, the jar is not loaded. It is found, though, as the <applet> icon is different if the jar file is missing altogether.
Comment 2 David Carson 2006-03-22 11:47:21 PST
Created attachment 7235 [details]
patch

The wrong class name was being used when converting from the Java JSObject to the javascript object, and the wrong signature was being used for getting the FieldID, thus it never found it. Information about signatures used with GetFieldID (JNI call), see http://www.cs.fit.edu/~ryan/java/language/jni.html
Comment 3 Darin Adler 2006-03-22 11:54:52 PST
Comment on attachment 7235 [details]
patch

This fix looks great!

Can we get a test case for the "manual tests" directory?
Comment 4 David Kilzer (:ddkilzer) 2006-03-22 15:58:11 PST
(In reply to comment #3)
> Can we get a test case for the "manual tests" directory?

Can an http test be written for it, or does DumpRenderTree not do applets?
Comment 5 Darin Adler 2006-03-23 07:34:15 PST
(In reply to comment #4)
> Can an http test be written for it, or does DumpRenderTree not do applets?

We haven't been able to get DumpRenderTree working with Java.