Closed Bug 166883 Opened 22 years ago Closed 22 years ago

Netcsape 6.2.3 hangs on applet method call in onLoad function of html page

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

(Not tracked)

VERIFIED INVALID

People

(Reporter: i_simnani, Assigned: asa)

References

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Build Identifier: 

My web application is coming up nicely in netscape 4.7(and IE). But it is 
hanging Netscape 6.2.3  when I launch it in Netscape 6.2 and when I close my 
netscape 6.2 it gives an illegal memory instruction voilation error.  I think I 
have figured out the root cause. I have three frames in my window, one of the 
frames has an applet. The HTML file of the frame with the applet has an onLoad 
attribute which is equated to a javscript function.The javascript function 
finds the current frame hieght and width and passes these as parameters to an 
applet method -"document.myname.TheApplet.appletmethod(int , int)". This 
appletmethod method in addition to calling a couple of application specific 
methods also calls the repaint() method.It is this -
"document.myname.TheApplet.appletmethod()" which is causing the problem. If 
comment this out this line, my application web page comes up fine.
  Here is what I feel is happening. In our application we use both java to 
javascript communication and vice versa. Intially when we have the appletmethod 
call in the OnLoad of my html, the applet does not init properly and my 
netscape 6 hangs. In fact In the javascript console I consistently see that 
whenever netscape hangs, it gets stuck at the following line of code in my 
applet getJSWindow.eval("parent.RightFrameload('"+ sRightFrameURL +"');").My 
guess is that either the applet or javascript gets an invalid object handle 
leading to the hanging of netscape(or something similar). However if I comment 
this applet method call in the onLoad function of browser and implement it as a 
link which calls the same applet method, it is called properly and even my 
application comes up fine. So the issue is with the intial loading sequencing 
of the applet and the way Nestcape browser parses javascript, html and 
sequences applet execution. I confirmed my suspicion by writing a timer delay 
function in javascript giving enough time for the applet to load and calling my 
applet method only after the timeout. This time my applet method call works 
fine even if it is in the onLoad function of the browser.

 I am enclosing a sample html file and applet code which closely mimics my 
problem.If you comment out the second statment of the javascript function f(s), 
it works fine. If you uncomment it, netscape 6.2 hangs. In the javascript 
console you can see that at the time of hanging the applet gets stuck jsut 
before a win.eval or win.call method(trying to reach the browser window). Again 
if I put the same applet method call in an onClick of a href, it works fine 
then as the applet has compltely loaded by then.So the issue is again with the 
intial sequencing events.
After netscape hangs(cpu usage >98%) , If I close netscape it tells me an 
illegal memory access voilation.
 Here is the sample html file and applet.You should definetly be able to 
recreate the problem on netscape 6.2.3.
********
<html>
<head><title>Test</title>
<script language="JavaScript">
function f(s)
{
	alert(s);
//BUG -?? UNCOMMENTING THE FOLLOWING LINE HANGS NETSCAPE 6.2.3

	// document.someapplet.disp('hello from browser to applet');
 }
</script>


</head>

<body>
<a href="#" onClick="f('gecko bugs on the web');"> My aplication on web </a>
<br> <br>

<!-- BUT THE FOLLWING LINE INVOKES APPLET METHOD CALL WITHOUT ANY ISSUES -->

<a href="#" onClick="document.someapplet.disp('hello from browser to 
applet');">talk to applet</a>

<BR>

Test Page
<BR>


<APPLET CODE="MyApplet.class"  NAME="someapplet" WIDTH=170 HEIGHT=150 MAYSCRIPT 
>
</APPLET>


Test Page End


</body>
</html>
  **************
/* Applet java code below  */
import netscape.javascript.*;
import java.applet.*;
import java.awt.*;
public class MyApplet extends Applet {
	     public void init() {
System.out.println("Inside applet -place1");
         JSObject win = JSObject.getWindow(this);
	String args[] = {"data passed from applet - alert in javascript"};
         win.call("f", args);		  	     
	 // Call f() in HTML page
	// win.eval("f('Hello Syed');");
	 System.out.println("Inside applet -place2");
	   //win.eval("alert('javascript alert from applet');");
	  System.out.println("Inside applet -place3");
		     }
		public void disp(String msg) {
	JSObject wina = JSObject.getWindow(this);
	try {
	String myarr[] = new String[1];
	myarr[0] = msg;
	wina.call("alert",myarr);
	} catch(Exception e)
		{
			System.out.println("MyMessage: caught exception in 
eval");
		}
         System.out.println("Inside applet in disp method");
         System.out.println("The argumnet passed to applet from browser is: " 
+msg);
	}	
}

*****************************************

Thank you.
Syed Iqbal Simnani


Reproducible: Always

Steps to Reproduce:
1.Compile applet.Keep second  statement line of javascript function f(s) in the 
html page commented.
2.open html  with Netscape 6.2.3. It works fine.
3.Uncomment the above mentioned line in step 1.It hangs Netscape and on closing 
gives illegal memory reference problem. 

Actual Results:  
Please see above.

Expected Results:  
Mozialla enabled nestcape 6.2 browser should work fine in both the cases.
*** Bug 166882 has been marked as a duplicate of this bug. ***
This is not the place to report Netscape bugs. Please read the bug reporting
guidelines and use: http://home.netscape.com/browsers/6/feedback/problem.html

pi
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
verified

reopen if you see this with Mozilla 1.1 and JRE1.4.X
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.