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

JavaScript calling Java timing issue

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b01
    • CPU:
      x86
    • OS:
      windows, windows_xp
    • Verification:
      Not verified

      Description

      The following sample demonstrates a problem of JavaScript calling Java. This issue is only reproducible with New Java Plug-In. It is not reproducible with Classic Java Plug-In in 6u10.

      Env:
      6u10, XP, IE.

      <applet code>
      import javax.swing.JApplet;
      public class SimpleApplet extends JApplet {
      private static final long serialVersionUID = -681454679772431812L;
      /** Initializes the applet GOSEApplet */
      public void init() {
      try {
      java.awt.EventQueue.invokeAndWait(new Runnable() {
      public void run() {
      System.out.println("SimpleApplet.init()");
      }
      });
      } catch (Exception ex) {
      ex.printStackTrace();
      }
      }

      public void start() {
      System.out.println("SimpleApplet.start()");
      }

      public void stop() {
      System.out.println("SimpleApplet.stop()");
      }


      public void destroy() {
      System.out.println("SimpleApplet.destroy()");
      }

      /*
      * Meant to be called by JavaScript on HTML page
      */
      public void echoPrint(String message) {
      System.out.println("In SimpleApplet.echoPrint(): "+message);
      }
      }
      </applet code>

      And here is the HTML page:
      <HTML>
      <HEAD>
      <TITLE> SimpleApplet </TITLE>
      </HEAD>
      <BODY>

      <OBJECT name="simpleApplet" classid="clsid:CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA" width="1" height="1">
      <PARAM name="name" value="simpleApplet">
      <PARAM name="code" value="SimpleApplet.class">
      <PARAM name="archive" value="SimpleApplet.jar">
      <PARAM name="codebase" value="applets">
      </OBJECT>

      <script type="text/javascript">
      document.simpleApplet.echoPrint("TEST1");
      </script>
      </BODY>
      </HTML>


      Expected Output:
      SimpleApplet.init()
      SimpleApplet.start()
      In SimpleApplet.echoPrint(): TEST1

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hdongorcl Hao Dong (Inactive)
                Reporter:
                ryeung Roger Yeung (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: