tags:

views:

20

answers:

0

Specifically with ie 7 & 8 I have a case that I don't fully understand in which I have a setTimeout function call that is getting added to the the call stack before the current call stack is unrolled.

For me this appears to only take place when I incorperate 2+ calls to communicate through javascript to a java applet just after my setTimeout call. If I don't use any javascript->java applet com then the function triggered by the setTimeout will not be seen on the callstack until the current callstack is unrolled.

here are the 2 main scenerios I tried:

case 1: testbed with: 1.) setTimeout Call 2.) javascript -> applet call x2 ( applet is a simple applet with a one function that can be called via javascript. this function contains a sleep for 500ms for a total of 1000ms eg 500ms x2)

case 2: testbed with: 1.) setTimeout call 2.) call to long running loop to simulate the delay aspect of my simple applet ( loop is a while loop with a time check so that I can can accuratly extend the time it takes to return from the function and allow the call stack to unroll. I se this delay to mimick the delay apsect of case 1: eg 1000ms.

I would expect that the callstack would always be unrolled before the setTimeout referenced function is on the stack however this doesn't seem to be the case when com to a java applet is involved after the setTimeout call is made. I'd like to note that I have tried a java applet with no delay and the testbed appeared to wait until the current stack was unrolled before adding the setTimeout call to the stack.. however since I simulated a time delay without the javaapplet with case 2 I suspect there is more then just timming invovled that is causing this behavior when a java applet is used.

any insight would be much appreciated.

Thanks, -Mike