"Script on this page is causing Internet Explorer to run slowly" ( With SUN's JVM )

M

mqsash

Hi,

Since MS is no longer going to support Java from 2004, we are porting
our stuff to Sun's JVM ( JDK 1.4 )

We have a web page which uses JAVA and Jscript ( in a JS file ).
The JS file has around 160 functions and spans almost 4000 lines !!

I'm using IE6 SP1 on windows 2k.
MS JVM is V 5.00.3802
Sun's JRE is 1.4.x

While accessing this web page I get the following error
"A script on this page is causing Internet Explorer to run slowly. If
it continues to run, your computer may become unresponsive. Do you
want to abort the script?"

Note - this happens only when I set the JVM to be Sun's JVM.
It works smoothly when using MS JVM.

I have seen the Microsoft Knowledge Base Article - 175500,
Since my client can be any lay user accessing this page, I do not
prefer the solution suggested there.

Any idea why the error appears only with Suns JVM ?
What I would like to know is how to debug the situation ?
How can I find out which loop, or code block is causing this error ?

thanks
mqsash
 
F

Frank Saunders, MS-MVP

mqsash said:
Hi,

Since MS is no longer going to support Java from 2004, we are porting
our stuff to Sun's JVM ( JDK 1.4 )

We have a web page which uses JAVA and Jscript ( in a JS file ).
The JS file has around 160 functions and spans almost 4000 lines !!

I'm using IE6 SP1 on windows 2k.
MS JVM is V 5.00.3802
Sun's JRE is 1.4.x

While accessing this web page I get the following error
"A script on this page is causing Internet Explorer to run slowly. If
it continues to run, your computer may become unresponsive. Do you
want to abort the script?"

Note - this happens only when I set the JVM to be Sun's JVM.
It works smoothly when using MS JVM.

I have seen the Microsoft Knowledge Base Article - 175500,
Since my client can be any lay user accessing this page, I do not
prefer the solution suggested there.

Any idea why the error appears only with Suns JVM ?
What I would like to know is how to debug the situation ?
How can I find out which loop, or code block is causing this error ?

thanks
mqsash

Java and Java Script are not related. You may need to update your scripting
engine:
http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28001169
or
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
 
M

mqsash

Hi Frank,

The scripting engine on machine is v5.6.8515. ( Which is the latest
one )
I've narrowed down the problem of the Stack Overflow to the way JS
calls a Java Applet function.
There are two different behaviours when using MS JVM and while using
Sun's JVM.

I've written a simple applet and an html.
The html has JS code which calls a method in the applet.
The applet method prints a debug message about entering the method.
This method then does a Sleep(50) to simulates a time delay for code
execution.
The method then prints a debug message about exiting the method.
(The source for the html and the applet method are pasted below)

To test this behaviour.........
-- Invoke the html page and open the Java console.
-- Trigger multiple MouseOver events by moving the mouse rapidly over
the "input" control.
-- The MouseOver handler in the JS invokes the Applets function.
-- The applet method prints the "Entering Delay" to the Java console.
-- The applet goes into the Sleep() for a very short time.

(NOTE- we have triggered multiple MouseOver Events)
NOW---
With MS JVM the output to the console is
Entered Delay >>>>>
<<<<<<< Finished Delay
Entered Delay >>>>>
<<<<<<< Finished Delay
i.e. :
Once the applet method is called, all other MouseOver events are
either discarded or not processed as long as we do not exit the applet
method and return to the JS.
This seems perfectly logical ( and acceptable )

With SUN's JVM the output to the console is
Entered Delay >>>>>
Entered Delay >>>>>
Entered Delay >>>>>
<<<<<<< Finished Delay
<<<<<<< Finished Delay
Entered Delay >>>>>
i.e. :
The applets method is invoked multiple times by the JS, EVEN before we
have completed the first invocation !
This causes (it seems) the Javascript to push a lot of calls to
Applets method onto the stack. And this causes the stack overflow.

Is this a known problem about the way JS works with Suns JVM ?
Is there a workaround to this problem? Otherwise we will keep getting
Stack overflows in the script for most events triggered at such short
intervals !!!

Thanks, ( the code segments are pasted below )
mqsash
**************** code fragments **********************************
<HTML>
<SCRIPT>
var win2 = null;
function MouseOver()
{
var app = document.applets("appl"); //get the applet
appl.Delay(); // call the applets method
}
</SCRIPT>
<BODY>
<INPUT name="Edt" OnMouseOver="MouseOver()">
<APPLET ID="appl" CODE = "SimpleApplet.class" MAYSCRIPT = true>
</BODY>
</HTML>

************* Applet function **********
public void Delay()
{
System.out.println("Entered Delay >>>>>");
try
{
Thread.sleep (50);
}
catch (Exception e) { }

System.out.println("<<<<<<< Finished Delay");
}

--- EOM ----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top