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

Applet using javascript fails to exit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • deploy
    • beta2
    • x86
    • windows_nt



      Name: yyT116575 Date: 04/10/2001


      java version "1.3.0_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
      Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)


      I know there are already several bugs associated with using javascript from java
      code with the plug-in, but with the latest 1.3.0_02 version many of them seemed
      to have gone away. Well there is still one left that is causing problems. The
      problem arises on Windows NT using IE with the 1.3.0_02 plugin.

      I have an html page which we will call the original page. The original page
      launches a second page using javascript. We will call the second page the
      launched page. The launched page contains only a single OBJECT tag for an applet
      using the java plugin 1.3.0_02 for IE. When the applet in the launched page is
      running it uses java to javascript communication as part of it's function.

      Now, if you close the original page, and then close the launched page, the
      IEXPLORER.EXE process that is running the plug-in hangs, and never dies. If you
      instead close the launched page, and then the original page, the IEXPLORER.EXE
      process exits cleanly. I made a test applet which I am including that
      illustrates the problem. I also removed the java to javascript communication in
      the applet, and this made the problem go away, so this is definately part of the
      problem.

      Although the applet works fine, the orfaned IEXPLORER.EXE processes are a big
      pain. They never go away, so during shutdown NT hangs waiting for them to die.
      They chew up system resources. Also they stack up in the System tray on the
      right which looks really wierd. We are nearing the commercial release date for
      our product, and need this resolved.

      The following files are included: index.html Foo.html Foo.java

      Steps to reproduce.
      1. Separate out included files and compile Foo.java.
      2. Point IE browser at index.html. This should launch second window.
      3. Close first IE browser window pointing at index.html.
      4. Close second browser window which contains applet.
      5. Note that IEXPLORER.EXE that was spawned never dies.

      Here are the files:

      index.html

      <html>
      <head>
      <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
       
      function launch() {
          var day = new Date();
          var newWindow = window.open("Foo.html", day.getTime(),'height=400,width=400,resizable');
          return (newWindow);
      }
       
      </SCRIPT>
      </head>
      <body onLoad=launch()>
      <p>
      Loading applet
      <p>
      </body>
      </html>


      Foo.html

      <html>
      <head>
      <title>SwingSet demo</title>
      </head>
      <body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>
      <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
      width=400 height=400>
      <PARAM NAME="code" VALUE="Foo">
      <PARAM NAME="codebase" VALUE=".">
      <PARAM NAME="MAYSCRIPT" VALUE="true">
      <PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.0_02">
      </OBJECT>
      </body>
      </html>


      Foo.java

      import javax.swing.*;
      import java.awt.*;
      import netscape.javascript.JSObject;
       
      public class Foo extends JApplet {
       
          public void init() {
              GridBagLayout gridbag = new GridBagLayout();
              GridBagConstraints c = new GridBagConstraints();
              getContentPane().setLayout(gridbag);
              JButton button = new JButton("Hello World");
              gridbag.setConstraints(button, c);
              getContentPane().add(button);
          }
       
          public void start() {
              try {
                  JSObject window = JSObject.getWindow(this);
                  Object top = window.getMember("top");
                  System.out.println("GOT TOP " + top);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      (Review ID: 120492)
      ======================================================================

            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: