Child Windows spawn threads, javascript increasing CPU usage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was hoping for some advice from the community. We have recently discovered
that one of our Javascripts that is used to provide security for child
windows launched from our extranet application consumes a significant amount
of CPU per child window. The javascript is used to track to find out if the
parent window is closed, and close itself (child window) if so, will set
variables that are used for session timeouts, and add it's handle to a stack
that is used to close each of the child windows if the parent window is
closed.

For each child window a monitoring function is executing every 100ms, that
will loop through each of the frames on the child window and replace any
window.open methods with a method that is used to inject this code for each
child window. We have found that this looping through the frames every 100ms
is causing this increased CPU usage. We have found that this problem does
not occur in Firefox, which based on Microsoft investigations has pinpointed
the reason to the way child windows are handled between browsers. In
Internet Explorer, each child window spawns another thread, in Firefox all
child windows are in the same thread.

Has anyone experienced a similar situation with their Javascript causing
this increased CPU usage as a result of multiple threads in IE?

Is there a way to adjust this threading behaviour in Internet Explorer?

There was a significant increase in CPU usage when testing between IE 6.0
and IE 6.0 SP2 & IE 7.0, does anyone have any speculations of why that might
be?

Any advice would be greatly appreciated.

Thanks
 
Hi MSTechie,

I think you are expecting allot to be answered with your process flow
description without a hands on evaluation of your code.

As far as why there are differences between IE6 Sp1, IE6 Sp2 and IE7 that is
easy to answer. Have a look at the version numbers of MSHTML.dll... this is
perhaps a hint as to what is happening as the mshtml library contains the
create window methods (use your object browser to inspect its methods).

My first thought is to suggest that you try a different method to maintain
communication between your parent window and its children. The window.helper
object is the standard method for such. Obviously any timer based solution
is not going to release threads between cycles.

Regards.
 
Back
Top