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

reentrant java-javascript calls cause browser to freeze

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • deploy
    • x86
    • windows_xp

      Name: gm110360 Date: 05/12/2004


      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      windows xp
      5.1 (Build 2600 xpsp2)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      internet explorer version
      6.0.2800.1106.xpsp2.030422-1633

      A DESCRIPTION OF THE PROBLEM :
      if a java call is made to javascript via liveconnect, and the liveconnect calls back into java, a further outgoing call will cause internet explorer to freeze in some cases. Normally, reentrant calls work fine, but if you do a lot very quickly, the bug occurs. Funnily enough, right mouse clicking on the internet explorer button in the taskbar frees it up, until the next block.

      The code example I provide here causes the lock in a completely reproducable fashion, at least on my machine.
      REGRESSION: This worked a lot better under 1.4.2_03

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      double click on the test.html file
      observe lock
      right mouse click to free it up until next lock. Observe the output in the java console.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it should not lock
      ACTUAL -
      it locks

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ************************************
      TestApplet.java:
      ************************************

      import javax.swing.JApplet;
      import netscape.javascript.JSObject;

      public class TestApplet extends JApplet
      {
      public void start()
      {
      for (int i = 0; i < 100; i++)
      {

      JSObject.getWindow(TestApplet.this).call("enterJavascript", new Object[0]);
      }
      }

      public void enterJava()
      {
      System.out.println("here");
      JSObject.getWindow(TestApplet.this).call("reenterJavascript", new Object[]{"TEST"});
      }
      }


      ************************************
      test.html:
      ************************************

      <HTML>
      <HEAD>
      <SCRIPT TYPE="text/javascript" language="JavaScript">
               function reenterJavascript(s)
               {
               window.document.body.all.test.innerHTML=s;
               }
               function enterJavascript()
               {
               window.document.body.all.coreApplet.enterJava();
               }
      </SCRIPT>
      </HEAD>
      <BODY>
      <OBJECT ID="coreApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0" WIDTH = "0" HEIGHT = "0" >
      <PARAM NAME="name" VALUE="coreApplet"></PARAM>
      <PARAM NAME="CODE" VALUE = "TestApplet.class" ></PARAM>
      <PARAM NAME="type" VALUE = "application/x-java-applet;jpi-version=1.4.2"></PARAM>
      </OBJECT>
      <div id="test"></div>
      </BODY>
      </HTML>


      ---------- END SOURCE ----------
      (Incident Review ID: 261506)
      ======================================================================
      ###@###.### 10/18/04 20:10 GMT

            djayaramsunw Devananda Jayaraman (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: