Bug 20177 - LiveConnect does not work returning arrays from Java applet to JavaScript
Summary: LiveConnect does not work returning arrays from Java applet to JavaScript
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-25 18:15 PDT by steve lindholm
Modified: 2008-07-25 18:19 PDT (History)
0 users

See Also:


Attachments
html file for testcase (501 bytes, text/html)
2008-07-25 18:18 PDT, steve lindholm
no flags Details
java file for testcase (290 bytes, text/plain)
2008-07-25 18:19 PDT, steve lindholm
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description steve lindholm 2008-07-25 18:15:43 PDT
I am having trouble returning arrays of strings from a Java applet to
JavaScript on Safari 3.1.2. It works fine on Firefox 3.0.1.

Here's the documentation on how it's supposed to work:

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Data_Type_Conversions:JavaScript_to_Java_Conversions

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Data_Type_Conversions:Java_to_JavaScript_Conversions

Here's are two simple files demonstrating the problem. Compile test19.java with javac test19.java. Under firefox, you will see two diagnostic alerts followed by "Success!" On Safari the diagnostics will be obviously wrong and then the script will halt.

test19.html:

<html>
<head>
<title>tests whether applets can return string arrays</title>
</head>
<script type="text/javascript">
       function clicker ()
       {
               var arr;
               arr  = document.test19.test ();
               alert (typeof arr);
               alert (arr.toString ());
               if (arr[0] == "foo" && arr[1] == "bar")
                       alert ("success!");
               else
                       alert ("failure!");
       }
</script>
<body>
<button onclick="clicker ()">Write Config</button>
<applet name="test19" code="test19.class" width="1" height="1"
mayscript></applet>
</body>
</html>


test19.java:

import java.applet.Applet;

public class test19 extends Applet
{
       public void init () { }

       public void start () { }

       public void stop () { }

       public void destroy () { }

       public String [] test ()
       {
               String [] ret = new String[2];
               ret[0] = "foo";
               ret[1] = "bar";
               return ret;
       }
}
Comment 1 steve lindholm 2008-07-25 18:18:05 PDT
Created attachment 22490 [details]
html file for testcase
Comment 2 steve lindholm 2008-07-25 18:19:40 PDT
Created attachment 22491 [details]
java file for testcase