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

REGRESSION: Calling submit via LiveConnect in start method of applet crashes IE

XMLWordPrintable

    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Internet Explorer version 6.0.2900.2180.xpsp_sp2_rtm.040803-2158

      A DESCRIPTION OF THE PROBLEM :
      If an applet is created after the page is initially loaded via JavaScript and the applet uses LiveConnect to submit a form on the page in it's start method the browser crashes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the applet included in the source below an open the HTML page also included in IE.
      2. Click the "New Applet" button.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A new applet should load and submit the form back to itself (resulting in effectively no change).
      ACTUAL -
      The browser crashes.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ------------- Applet Code -----------
      import javax.swing.*;
      import netscape.javascript.*;

      public class SwingJSObject extends JApplet {

          public void start() {
              JSObject window = JSObject.getWindow(this);
              window.call("submitFunction", null);
          }
      }



      --------- HTML ---------------
      <HTML>
      <HEAD><TITLE>Test</TITLE>

      <script language="JavaScript">

      function startApplet() {
      var mydiv = document.getElementById('auxdiv');
      mydiv.innerHTML = '<applet name="applet2" CODE="SwingJSObject" WIDTH="500" HEIGHT="500" MAYSCRIPT><param name="callSubmit" value="true" /></applet>"';
      }

      function submitFunction() {
      document.testForm.submit();
      }
      </script>
      </HEAD>
      <BODY>
      <form name="testForm">
      <input type="button" name="newapplet" value="New Applet" onclick="startApplet()" />
      <div id="auxdiv" name="auxdiv" width="500" height="500">
      </div>
      </form>
      </BODY>
      </HTML>


      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Trigger the form submit using a component listener and the componentShown notification to trigger the event instead of using the start method. Alternatively inserting a short delay with a timer also avoids the problem. Using SwingUtilities.invokeLater does not avoid the problem.

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-04-15 22:13:27 GMT

            ccheung Calvin Cheung
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: