Moving applet from Oracle jre: first tries

helpcrypto helpcrypto helpcrypto at gmail.com
Mon Oct 22 00:10:58 PDT 2012


Could any of you confirm JSObject is not returned as a valid
javascript object, or its my code not using it in the correct way?
(Should I fill a bug to confirm it?)

On Tue, Oct 16, 2012 at 1:24 PM, helpcrypto helpcrypto
<helpcrypto at gmail.com> wrote:
> Hello again.
>
> Now, I have detected an error? (not a crash) when using JSObject, that
> differs from 'official' oracle jre behaviour.
>
>         public class MyApplet extends Applet {
>                 public static Applet applet = null;
>                 @Override
>                 public void init() {
>                         applet = this;
>                 }
>                 public JSObject testFunction() {
>                         return AccessController.doPrivileged(new PrivilegedAction<JSObject>() {
>                                 @Override
>                                 public JSObject run() {
>                                         JSObject win = JSObject.getWindow(applet);
>                                         JSObject js = (JSObject) win.eval("new Object();");
>                                         //...
>                                         js.setMember("code", 0);
>                                         return js;
>                                         }
>                                 });
>                         }
>                 }
>         }
>
> On javascript side, invoking this way:
>         var obj=applet.testFunction();
>         alert(obj.code);
> Doesn't work, and says undefined. obj is [object] (bt not a valid js object) and
> I cant enumerate properties using:
>         var txt='';
>         for(var a in cert){
>                 txt+='obj['+a+']='+obj[a]+'\n';
>         }
>         alert(txt);
> The same code works on Oracle and obj.code==0 :)
>
> According to http://icedtea.classpath.org/wiki/IcedTea-Web, as Im
> using netscape.javascript.JSObject, I should add plugin.jar to my
> classpath when building, but it should work/run properly on pages.
>
> Any ideas? Should I add plugin.jar somewhere? Should I file another bug report?
>
> Thanks a lot for your help!



More information about the distro-pkg-dev mailing list