-
Bug
-
Resolution: Fixed
-
P2
-
1.3.0_02, 1.3.0_03, 1.4.0
-
03
-
x86
-
windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2047458 | 1.4.0_01 | Ajit Bhale | P2 | Closed | Fixed | 01 |
The problem is that the browser and plug-in become locked-up after a modal
dialog is shown when invoked via JavaScript. I have been able to reproduce
this problem with Java Plug-in 1.3.0_0(1-5), 1.3.1, and 1.4.0. As the most
simple scenario, imagine an HTML document with an Applet and a form with a
button that has a JavaScript method that is called when the button is pressed.
The onPressed event calls a JavaScript method that gets the Applet and then
makes a call into a method that brings up a modal dialog. This modal dialog
can be a Swing Dialog such as JOptionPane or a custom dialog. It does not
matter.
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b77, mixed mode)
http://developer.java.sun.com/developer/bugParade/bugs/4192193.html (Bug ID
4192193). The problem itself has not been fixed and all suggestion workarounds
that I have seen do not provide a correct solutions.
TESTCASEBEGIN
Follow these steps to reproduce this bug:
1. Create an HTML document as follows:
<!-- saved from url=(0022)http://internet.e-mail -->
<HTML>
<HEAD>
<TITLE>Freezer</TITLE>
</HEAD>
<SCRIPT>
function showJOptionDialog()
{
var applet = document.applets["FreezerApplet"];
applet.showJOptionDialog();
}
function showCustomDialog()
{
var applet = document.applets["FreezerApplet"];
applet.showCustomDialog();
}
</SCRIPT>
<BODY>
<CENTER>
<form>
<table border="0" width="100%">
<tr>
<td>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.3 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 320 HEIGHT = 200 id = "FreezerApplet"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-
win32.cab#Version=1,3,0,0">
<PARAM NAME = CODE VALUE
= "DialogFreezingProblemWhenInvokedFromJavaScriptTestApplet" >
<PARAM NAME = ARCHIVE VALUE = "DialogFreezer.jar" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME = SCRIPTABLE VALUE = true >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.3"
CODE = "DialogFreezingProblemWhenInvokedFromJavaScriptTestApplet"
ARCHIVE = "DialogFreezer.jar"
WIDTH = 320 HEIGHT = 200
MAYSCRIPT = true
scriptable=true
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<NOEMBED>
</COMMENT>
</NOEMBED></EMBED>
</OBJECT>
<!--"END_CONVERTED_APPLET"-->
</td>
</tr>
<tr>
<td>
<input type="button" value="Bring up Swing Dialog" name="B1"
onClick="showJOptionDialog()">
<input type="button" value="Bring up Custom Dialog" name="B2"
onClick="showCustomDialog()">
</select>
</td>
</tr>
</table>
</form>
</CENTER>
</BODY>
</HTML>
-------------------------------------------------------------------------------
2. Create DialogFreezingProblemWhenInvokedFromJavaScriptTestApplet.java as
follows:
import javax.swing.*;
import java.awt.*;
public class DialogFreezingProblemWhenInvokedFromJavaScriptTestApplet extends
JApplet {
public void start() {
super.start();
}
public void stop() {
super.stop();
}
public void init() {
super.init();
}
public void showJOptionDialog() {
System.out.println("showJOptionDialog() enter");
JOptionPane.showMessageDialog(this, "Message", "Title",
JOptionPane.INFORMATION_MESSAGE);
System.out.println("showJOptionDialog() exit");
}
public void showCustomDialog() {
System.out.println("showCustomDialog() enter");
Frame f = (Frame)SwingUtilities.getRoot(this);
JDialog d = new CustomJDialog(f, "Custom Dialog", true);
d.show();
System.out.println("showCustomDialog() exit");
}
}
-------------------------------------------------------------------------------
3. Create CustomJDialog.java as follows:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CustomJDialog extends JDialog {
static Window getWindowForComponent(Component parentComponent) {
if (parentComponent == null)
return JOptionPane.getRootFrame();
if (parentComponent instanceof Frame || parentComponent instanceof
Dialog)
return (Window)parentComponent;
return getWindowForComponent(parentComponent.getParent());
}
public CustomJDialog (Frame parent, String title, boolean modal) {
super(parent, title, modal);
init();
System.out.println("parent frame = " + parent);
}
public void init() {
getContentPane().setLayout(new BorderLayout());
JButton b = new JButton("OK");
b.setAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
CustomJDialog.this.dispose();
}
});
getContentPane().add(b, BorderLayout.CENTER);
setSize(320,200);
setLocation(200,200);
}
}
-------------------------------------------------------------------------------
4. Compile the two source files.
5. Create a jar 'DialogFreezer.jar' with the class files from step 4.
6. Put the HTML and jar where your browser can hit them.
7. Hit them.
8. Click either button on the form.
Another Testcase:
- backported by
-
JDK-2047458 Plug-in and IE both lock/freeze after a modal dialog is launched from JavaScript
- Closed
- duplicates
-
JDK-4506715 Plug-in and IE both lock/freeze after a modal dialog is launched from JavaScript
- Closed
- relates to
-
JDK-4192193 Modal Dialog : Visual basic hangs when a bean creates a modal dialog
- Resolved