-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
05
-
x86
-
windows_nt, windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2050064 | 1.4.1 | Devananda Jayaraman | P2 | Resolved | Fixed | hopper |
Name: gm110360 Date: 12/12/2001
java version "1.4.0 Beta 3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0 Beta 3)
Java HotSpot(TM) Client VM (build 1.4.0 Beta 3, mixed mode)
STEPS TO REPRODUCE THE PROBLEM
==============================
1.On loading of Applet, a java Object is passed to JavaScript
2.If the JavaScript invokes a method in this Java Object to get a non-string
object.
3.The browser crashes.(In plug-in 1.4.0 Beta 3).
SOURCE CODE
===========
*****************Person.java****************
public class Person{
public String getStatus(){
return "Success";
}
}
******************TestApplet.java*************
import netscape.javascript.JSObject;
import java.lang.*;
import java.applet.*;
import java.awt.Graphics;
public class TestApplet extends Applet{
JSObject win;
public void start(){
win = JSObject.getWindow(this);
Object t[] = new Object[1];
t[0] = new UserObject("test1");
win.call("callJava", t);
}
}
************UserObject.java****************
public class UserObject {
private String name;
public UserObject(String name) {
this.name=name;
}
public String getName(){
return name;
}
public Object getObj(){
Object obj= new Person();
return obj;
}
}
*************person.htm********************
<html>
<head>
<script>
function callJava(javaObj)
{
var var2 = javaObj.getName();
var var1 = javaObj.getObj();
var var3 = var1.getStatus();
document.forms[0].name1.value = var3;
}
</script>
</head>
<body>
<center>
<!-- Uncomment the following tag for loading the Applet in IE without Plugin
<Applet code="Person.class" MAYSCRIPT name="array"></Applet>-->
<!-- Uncomment the following tag for loading the Applet in IE with Plugin-->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
id="array" WIDTH=190 HEIGHT=190 codebase="." name="array">
<PARAM NAME=CODE VALUE="TestApplet.class">
<PARAM NAME=SCRIPTABLE VALUE=TRUE>
<PARAM NAME=MAYSCRIPT VALUE=TRUE>
</OBJECT>
<form>
<input type=text value="" name = "name1" size = 30 >
</form>
</body>
</center>
</html>
(Review ID: 137243)
======================================================================
- backported by
-
JDK-2050064 Passing Java Objects to JavaScript crashes the Browser in plug-in 1.4.0 Beta 3.
- Resolved
- duplicates
-
JDK-4660319 Internet Explorer crashes when using liveconnect
- Closed
-
JDK-4674777 Internet Explorer crashes when using liveconnect with Plugin 1.4
- Closed
-
JDK-4675805 Liveconnect: can not access objects that were passed to the JS
- Closed
- relates to
-
JDK-4822171 REGRESSION:Passing Java Objects to JavaScript crashes the Browser in plug-in 1.4
- Resolved