firefox 'Warning: Unresponsive Script' and Silverlight 1.0 ..

A few customers developing in 1.0 have seldomly seen the 'unresponsive script' warning   in firefox...

They see it less often in IE,  but if you create a run-away thread it can be reproduced in IE and it shows it as "Stop running this Script" .. .. "your computer may become unresponsive" ... blah..

The error is not new, a simple search online for 'unresponsive script firefox' or for dom.max_script_run_time  yields plenty of posts and a few tips...  but since Silverlight is new, first thing that customers are wondering is whether this is caused by silverlight -people ask about the animation engine in particular-..  Every time a customer asked I wrote one or more very different tests to make sure it is not thrown with long running animations or a lot of drawing time in silverlight. My experiece so far has been that the warning was not triggered due to silverlight's time (animation or drawing);  the warning also does not repro with long-running .net code in Silverlight 1.1  so if you are running into it check into your script ... i think the warning is really referring to the script time..  

To get around the error,
1) The posts on the web suggest you change  the value for dom.max_script_run_time  ..  [which works for devs but is a little harder/impractical to get customers to agree to] or you can
2) Get down with your Javascript do some profiling and optimize it .. .

So far, I have been choosing the latter... basic profiling using firebug has yielded the needed places to tweak code and get over the warning; hopefully that will work for any one else running into it.. 

The other follow-up question I have been hearing is 'can this be enabled/disabled programmatically from my website or my script' ? I believe (with confidence, but not fact since it is firefox) the answer to that is No -- that would lead to an exploit-.   If there is so much work that the warning is stil firing after you have optimized your script then partition your code into several execution script blocks ( use window.setTimeout to schedule the blocks)..

 Hope this saves some one some research time...  🙂 

Comments (2)

  1. larholm says:

    It is always a good idea to schedule rendering execution by dividing up any render routines in separate functions. This problem typically arises when those render routines depend on looped values, since most developer will then keep all the render calls inside the same function block.

    Closures are a great way to divide up those calls with looped values and then chain them in sequence through setTimeout or setInterval, see

  2. I posted before on the " firefox unresponsive script warning " but enough people have asked

Skip to main content