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

Netscape freeze when Javascript loads applet

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      OS : Windows2000 / Windows XP
      Java Plug-in : JRE 1.4.1_01
      Browser : NN 7.0 / NN 6.2

      Procedure to reproduce the problem:
       1. Open SampleApplet.html with NN.
       2. Press [Load] button
       3. JDialog opens after a while(About 10 sec.)
       4. Browser freezes

      Trying with JRE1.3.1_06 also reproducible.

      Sample programs:
      === SampleApplet.html =====================================================

      <HTML>
      <HEAD>
          <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
      <TITLE>

      </TITLE>
      <script language="JavaScript">
      <!--
          function test_jscall(form){
              result = document.SampleApplet.test_jscall();
              alert("Congratulation!");
          }
      //-->
      </script>

      </HEAD>
      <BODY>
      <b>JavaScript Calling JavaApplet</b>
      <BR>

      <!--"CONVERTED_APPLET"-->
      <!-- HTML CONVERTER -->

      <APPLET CODE="SampleApplet.class"
              WIDTH="50"
              HEIGHT="50"
              NAME="SampleApplet"
              ALIGN="middle"
              VSPACE="0"
              HSPACE="0"
              MAYSCRIPT="true" >
      </APPLET>

      <FORM>
          <p align="left">

              <b>test_safe()</b><br>
              <input type="button" value="test_jscall()" onClick="test_jscall(this.form)"><br>
          </p>
      </FORM>
      <hr>

      </BODY>
      </HTML>
      ===========================================================================

      === SampleApplet.java =====================================================
      import javax.swing.*;
      import java.io.*;
      public class SampleApplet extends JApplet
      {
          JDialog d = null;

          public void init()
          {
              d = new JDialog();
              d.pack();
          }

          public void test_jscall()
          {
              try {
                  System.out.println("Hi");
                  SwingUtilities.invokeAndWait(new Runnable() {
                          public void run() {
                              d.setTitle("HelloWorld");
                              d.setSize(200,200);
                              d.setVisible(true);
                          }
                      });
                  System.out.println("Bye");
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      ===========================================================================

        Attachments

          Activity

            People

            Assignee:
            zgu Zhengyu Gu
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: