- Internet Explorer determines that a script is long-running by the total amount of statements the JScript engine has executed . By default, the value is 5 million statements and can be altered via a registry setting .
- Firefox determines that a script is long-running by timing how long the script engine has been executing code continuously . The default time is set to 10 seconds and can be altered via about:config .
- Safari also uses script engine execution time to determine when a script has become long-running. After some digging around in the WebKit source code , it looks like the default timeout is 5 seconds.
- Chrome is a bit trickier to track down. The long-running script control seems tied to the crash control of any given tab. I’ve dug through the source code and haven’t been able to figure out the exact limit placed on scripts, but it does appear to be time-based and may be 10 seconds (it’s likely either 5 or 10, to match Safari or Firefox ).
- Opera is an interesting case: it doesn’t appear to have a long-running script limit . I ran several tests that completed even after minutes of code execution. During the time, the browser remain mostly responsive, which is impressive.
原文出处:http://www.nczonline.net/blog/2009/01/05/what-determines-that-a-script-is-long-running/