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

JSObject in JPI 1.2.2-004 crashes IE 5.0

XMLWordPrintable

    • 1.3.1
    • x86
    • generic

        Problem Description
        ===================
        By pressing the button in the applet continuosly, the browser which uses Java Plugin 1.2.2-004 (IE under NT) will crash. The test programs are attached.

        This appears to be being caused by the JSObject reference to the document window
        (refer the attached example) being garbage collected prematurely. This is the cause of the browser crashes.

        According to the documentation for using Liveconnect technologies, this example,
        and the way used, shouldn't cause any problems.

        Note: This does not happen on JPI version 1.2.2-001.

        Testing Environment:
        ====================
        1. Win NT 4.0 SP 5 and IE 5/4
        2. Java(TM) Plug-in: Version 1.2.2.p004
           Using JRE version 1.2.2
           JAR cache disabled.

        Note, it has the same result on IE 4.

        Test Case:
        ==========

        //Test1.java
           import javax.swing.JApplet;
           import javax.swing.JButton;
           import java.awt.event.ActionListener;
           import java.awt.event.ActionEvent;
           import java.net.*;
           import netscape.javascript.JSObject;


           public class Test1 extends JApplet implements ActionListener{
           
              JButton button = new JButton("Press Me");
              JSObject jsObject;
              public void init() {
              
                 System.out.println("init()");
                 //System.gc();
                 try {
                    jsObject = JSObject.getWindow(this); //Cause the IE crashed
                 }
                    catch(Exception e){
                       e.printStackTrace();
                    }
                 getContentPane().add(button);
                 button.addActionListener(this);
              
              }
           
           
              public void start(){
                 System.out.println("start()");
              }
           
              public void stop(){
                 System.out.println("stop()");
              }
           
              public void destroy(){
                 System.out.println("destroy()");
              
              }
           
              public void actionPerformed(ActionEvent ae){
                 System.out.println("Action Performed");
                 loadPage("file://d:/Test1.html");
              }
           
              public void loadPage(String page){
              
                 try {
                    URL url = new URL(page);
                    System.out.println("Created Url");
                    getAppletContext().showDocument(url);
                    System.out.println("showing document" );
                 }
                    catch (Exception e){
                       System.out.println("Exception Has happened");
                       e.printStackTrace();
                    }
                 System.out.println("ending loadPage");
              
              }
           }

        --- Test1.html ----
        <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
        <html>
        <head>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
           <meta name="GENERATOR" content="Mozilla/4.6 [en] (WinNT; I) [Netscape]">
           <title>TestApplet.html</title>
        </head>
        <body>
        <!--"CONVERTED_APPLET"--><!-- CONVERTER VERSION 1.0 --><object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        WIDTH = 300 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"><param NAME = CODE VALUE = "Test1.class"><PARAM NAME=MAYSCRIPT VALUE=true><param NAME="type" VALUE="application/x-java-applet;version=1.2"><COMMENT><embed type="application/x-java-applet;version=1.2" java_CODE = "Test1.class" MAYSCRIPT=true CODE="Test1.class" WIDTH = 300 HEIGHT = 300 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><noembed></COMMENT></noembed></embed></object><!--
        <APPLET CODE = "Test1.class" WIDTH = 300 HEIGHT = 300 >


        </APPLET>
        --><!--"END_CONVERTED_APPLET"-->
        </body>
        </html>

        Attached File:
        ==============
        drwtsn32.log

              djayaramsunw Devananda Jayaraman (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: