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

In Java to JavaScript communication, JSObject.getWindow().call() locks up IE

    XMLWordPrintable

Details

    • b26
    • b32
    • x86
    • windows_xp
    • Verified

    Description

      FULL PRODUCT VERSION :
      JRE version 6 Update 10 (build 1.6.0_10-rc-b28)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional, version 5.1, (2600.xpsp_gfe.070227-2300:Service Pack 2)

      A DESCRIPTION OF THE PROBLEM :
      When JApplet uses netscape.javascript.JSObject.call()-function, Internet Explorer 6 stucks. Javascript method eval functions normally. I use Microsoft Visual Web Developer 2008 to launch the aspx-page. The web page-applet system works normally in JRE 1.6.0_05 and also worked normally in JRE 6 update 10 build 14 (beta) before I updated to RC.


      ACTUAL -
      IE 6 gets stucked. Only Windows Task Manager can stop html-page.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JLabel;
      import javax.swing.JPanel;
      import netscape.javascript.JSObject;//...jre/lib/plugin.jar

      public class TestApplet extends javax.swing.JApplet{

          public void init() {
              try {
                  java.awt.EventQueue.invokeAndWait(new Runnable() {
                      public void run() {
                          System.err.println("Thread = " + Thread.currentThread());
                          initComponents();
                          startProgram();
                      }
                  });
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
          public void startProgram(){
                  try {
                      JSObject win = JSObject.getWindow(this);
                      if (win != null){
                          win.eval("alert('Javascript Alert')");
                          win.call("FunctionX", null);// Call FunctionX() in HTML page
                      }
                  }
                  catch (Exception ex) {
                      System.err.println("This browser may not support Java to Javascript communication");
                  }
          }
          
           private void initComponents() {
              JPanel jp = new JPanel();
              JLabel jl = new JLabel("This is JLabel");
              jp.add(jl);
              this.getContentPane().add(jp);
          }

         public void myFunction(){
                  try {
                      JSObject win = JSObject.getWindow(this);
                      if (win != null){
                          win.eval("alert('I got the message')");
                      }
                  }
                  catch (Exception ex) {
                      System.err.println("This browser may not support Java to Javascript communication");
                  }
          }
      }

      and html-page

      <body>
      <form id="form1">
      <div>
      <H1> Test Applet
      </H1>
      <br />

      <script>
      functionX(){
          document.TestApplet.myFunction();
      }
      </script>

      <APPLET MAYSCRIPT CODE=TestApplet.class NAME=TestApplet archive="TestApplet.jar" WIDTH=100% HEIGHT=90%
      </APPLET>
            
      </div>
      </form>
      </body>
      </html>
      ---------- END SOURCE ----------

      Release Regression From : 6u7
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

      Attachments

        Issue Links

          Activity

            People

              kbr Kenneth Russell (Inactive)
              ryeung Roger Yeung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: