Closed Bug 456337 Opened 18 years ago Closed 9 years ago

Firefox crash when JApplet is loaded in the browser, JApplet opens a JFrame and JFrame is closed. (Java 1.5 only, fine with Java 1.6)

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: satishmotwani1, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1b1pre) Gecko/20080918073230 Minefield/3.1b1pre Mozilla Firefox 3.0.1 (and 3.1b1) crashes when a JFrame is invoked from a JApplet loaded in the browser window. Firefox stops responding when you close the JFrame, and you have to kill the process in the task manager. This problem does not occur with Firefox 2.0.0.16 and Internet Explorer 6/7. This bug is reproducible with only Firefox 3 onwards. The bug occurs on Windows XP, Windows Vista and Windows 2003 Server. The JRE version used is 1.5.0_15. Reproducible: Always Steps to Reproduce: Create a folder "C:\javatest". under this folder, Copy the JApplet code into a file BigJApplet.java. Copy the JFrame code into a file SampleFrame.java Copy the testapplet.html code into a file testapplet.html Compile the classes using the following commands. javac -d "C:\javatest" SampleFrame.java javac -d "C:\javatest" BigJApplet.java The path may have any name instead of "C:\javatest", but it should be in the CLASSPATH variable under environment variables, for the applet to work. Add "C:\javatest" to the classpath. Open testapplet.html. The applet should be loaded and will show two buttons "use memory" and "open dialog" Click the "use memory" button to use up some memory. Clicking once will use approximately 8 MB in the JVM. Click the open dialog button. The Frame will be displayed. Close the Frame. Firefox will hang. The status of the program in Task Manager is Not Responding. The same sample code below works fine on Firefox 2.0.0.16 and IE. Our product opens a Frame from a JApplet to launch different modules, in the same manner as below code. Our product supports Firefox upto 2.0.0.16, but we cannot extend our support to 3.0.1 because of this bug. Please comment if you need any more information. Thanks, Satish Motwani // ---------------- Applet ------------------- package com.testcode; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * @author smotwani */ public class BigJApplet extends JApplet { private static final long serialVersionUID = -3481276366403385361L; public ArrayList biglist; //override Applet init method. public void init() { biglist = new ArrayList(); JPanel mainpanel = new JPanel(); getContentPane().add(mainpanel); buildPanel(mainpanel); } public void buildPanel(JPanel mainpanel) { JButton b1 = new JButton("use memory"); //add into arraylist JButton b2 = new JButton("open dialog"); //open a dialog mainpanel.add(b1); mainpanel.add(b2); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int d = 0; d < 8 * 1024; d++) { StringBuffer sb = new StringBuffer(); //along with inner i loop this will add 1 kb approx for (int k = 0; k < 128; k++) { //add 8 bytes (roughly) for (int i = 0; i < 8; i++) { sb.append(Integer.toString(i)); } } biglist.add(sb); System.out.println("added string to list " + d); } JOptionPane.showMessageDialog(null, "added strings to list"); } }); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openframe(); } }); } public void openframe() { SampleFrame frame = new SampleFrame("Sample Frame to open in applet"); System.out.println("opening the frame"); frame.setVisible(true); frame.setState(JFrame.NORMAL); frame.toFront(); } public void start() { } public void stop() { } public void destroy() { } } // ------------ End of Applet ------------------- // --------------- JFrame ----------------------- package com.testcode; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.WindowConstants; /** * @author smotwani */ public class SampleFrame extends JFrame { private static final long serialVersionUID = 3200574005538269993L; public JPanel framepanel; public SampleFrame(String title) throws HeadlessException { super(title); setSize(500, 500); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosing(e); } }); framepanel = new JPanel(); this.getContentPane().add(framepanel); framepanel.add(getMenu()); JButton closeButton = new JButton("Close"); framepanel.add(closeButton); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeframe(); } }); } public void closeframe() { this.setVisible(false); } public JMenuBar getMenu() { JMenuBar mb = new JMenuBar(); JMenu menu1 = new JMenu("File"); mb.add(menu1); JMenuItem closeMenuItem = new JMenuItem("Close"); menu1.add(closeMenuItem); return mb; } } // ------------------ End of JFrame ------------------------- // ------------------ testapplet.html ---------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> </head> <body> <APPLET CODE="com.testcode.BigJApplet" WIDTH=400 HEIGHT=400> </APPLET> </body> </html> // --------------- End of testapplet.html ----------------- 1. Open the testapplet.html file. 2. Click on the use memory button, once (or more in case problem is not reproducible. Firefox used about 90+ MB memory when it crashes) 3. Click open dialog button to open a JFrame. 4. Click on the top right close button to close the JFrame. 5. Firefox will stop responding. Actual Results: Firefox hangs. Expected Results: The applet should continue working fine after the JFrame is closed.
for (int k = 0; k < 128; k++) { //add 8 bytes (roughly) for (int i = 0; i < 8; i++) { sb.append(Integer.toString(i)); } } ====================== I had changed to k < 128 from k < 1024 for some testing, and I posted that directly without changing. Sorry about that. Please change the for condition to k < 1024 before testing. It really doesnt make any difference if you dont change it, though. You may use the code as is.
Hello, Updating to JRE 1.6.0 update 10 fixes this issue. I installed Firefox 3.0.3 and JRE 1.6.0 u10. I tried the sample code again to see if Firefox 3.0.3 has fixed it. Firefox no longer crashes with this version of JRE. However Firefox 3.0.3 continues to crash as earlier, if I use JRE 1.5.0_15 or later. Thanks, SatishMotwani
Component: General → Plug-ins
Product: Firefox → Core
QA Contact: general → plugins
Summary: Firefox (3.0.1 and 3.1b1 Minefield) crash when JApplet is loaded in the browser, JApplet opens a JFrame and JFrame is closed. → Firefox crash when JApplet is loaded in the browser, JApplet opens a JFrame and JFrame is closed. (Java 1.5 only, fine with Java 1.6)
I'm marking this bug as WONTFIX per bug #1269807. For more information see - https://blog.mozilla.org/futurereleases/2015/10/08/npapi-plugins-in-firefox/
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.