Dom.max script run time

From MozillaZine Knowledge Base
Jump to navigationJump to search

Background

[JavaScript] that executes for whole seconds is probably doing something wrong...” says Brendan Eich, creator of JavaScript. When a script is executing, Mozilla's UI will be unresponsive until the script’s thread ends. Correspondingly, Mozilla will alert you when a script is taking a long time to run and let you stop the script. This preference lets you define what “a long time” is.

Possible values and their effects

The value is a positive integer, determining the number of seconds of execution before warning. 0 and negative values are considered "forever." (Default value is 10; 5 in versions prior to nightly builds dated 2006-07-27) (bug 335058)

Previous effects

In builds prior to 2005-10-11, values less than 0 were assumed to be the default (then, 5). In builds prior to 2006-07-27 (e.g., Firefox 1.5), this preference affected scripts running in content and chrome; the limit on scripts running in chrome is now determined by dom.max_chrome_script_run_time.

Caveats

  • This preference was not dynamic (i.e., only read at startup) until 2005-10-11. The new dynamic behavior is available in Firefox and Thunderbird versions 1.5 and later, and in all versions of SeaMonkey.
  • This preference was subject to some bugs (see below) that made the true time limit somewhat unpredictable for certain scripts.

Recommended settings

If you’re encountering the “A script on this page is causing Mozilla to run slowly” dialog often and you’d like to disable it, setting this preference to 0 will allow the script to run for as long as it needs. A large number may be more appropriate, though, to avoid locking the entire UI forever as the script executes.

First checked in

2004-02-11 by Johnny Stenback

Has an effect in

  • Mozilla Suite (all versions since 1.7a)
  • Mozilla Thunderbird (all versions since 0.6)
  • Camino (all versions since 0.8b)
  • Mozilla Firefox (all versions since 0.9)
  • SeaMonkey (all versions)

Related bugs

Related preferences