Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4475557

Can't evoke JSObject call method from applet in 1.3.x. Works in 1.2.2!

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.1
    • deploy
    • beta2
    • x86
    • windows_nt



      Name: yyT116575 Date: 06/27/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      The following demo applet shows the 1.3 bug.
       The button calls a JavaScript method which calls an Applet method which calls
      another JavaScript method.
       With the 1.3 plugin, the Applet hangs IE on JSObject.getWindow(this).call().
       With the 1.2.2 plugin it works fine!!!

       To reproduce:
       1) make sure you have no jre or the 1.2.2 jre installed.
       2) open the page in IE 5. The callback works fine and opens a dialog!
       3) edit the html file by commenting out the applet that uses 1.2.2 and
      uncomment the applet that uses 1.3
       4) open the page in IE 5. The callback hangs IE!!!

      /////////CallbackApplet.java source BEGIN/////////

      import javax.swing.JApplet;

      import netscape.javascript.JSObject;
      import netscape.javascript.JSException;

      public class CallbackApplet extends JApplet{
        protected String method;
          
        public CallbackApplet(){ super(); }
          
        public void registerCallback( String methodName ){
          System.out.println("*** called registerCallback(methodName=\""+methodName+"\" )");
          method = new String( methodName );
        }
          
        public void callTheCallback( String parameter )throws JSException {
          Object[] params = new String[1];
          params[0] = parameter;
              
          System.out.println("*** calling JSObject.getWindow( this ).call(\""+method+"\", {"+params[0]+"} ) ");
          JSObject.getWindow( this ).call( method, params );
          System.out.println("*** called JSObject.getWindow( this ).call(\""+method+"\", {"+params[0]+"} ) ");
        }
      }

      /////////CallbackApplet.java source END/////////
      /////////CallbackApplet.html source BEGIN/////////
      <HEAD>
      <SCRIPT LANGUAGE="JavaScript">
          function callbackFunction( message ){
              alert( "called callbackFunction( message='"+message+"' )" );
          }
      </SCRIPT>
      <SCRIPT LANGUAGE="JavaScript" FOR="window" EVENT="ONLOAD" >
          myApplet.registerCallback( "callbackFunction" );
      </SCRIPT>

      </HEAD>
      <BODY>
          <!--
              <OBJECT NAME="myApplet"
                      STYLE="z-index:2"
                      classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA"
                      width="100%" height="100%"
                      codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-
      131-win32.cab#Version=1,3,1,0">
                  <PARAM NAME="code" VALUE="CallbackApplet">
                  <PARAM NAME="codebase" VALUE=".">
                  <PARAM NAME="type" VALUE="application/x-java-applet;jpi-
      version=1.3.1">
                  <PARAM NAME="scriptable" VALUE="true">
                  <PARAM NAME="mayscript" value="true">
                  No JDK 1.3 support for APPLET!!
              </OBJECT>
              -->
          <CENTER><BUTTON onclick="myApplet.callTheCallback('sample message');"
      >Callback</BUTTON></CENTER>
              <OBJECT NAME="myApplet"
                      STYLE="z-index:2"
                      classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                      width="10%" height="10%"
                      codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-
      1_2_2-win.cab#Version=1,2,2,0">
                  <PARAM NAME="code" VALUE="CallbackApplet">
                  <PARAM NAME="codebase" VALUE=".">
                  <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
                  <PARAM NAME="scriptable" VALUE="true">
                  <PARAM NAME="mayscript" value="true">
                  No JDK 1.2 support for APPLET!!
              </OBJECT>
      </BODY>
      /////////CallbackApplet.html source END/////////
      (Review ID: 124070)
      ======================================================================

            stanleyh Stanley Ho (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: