Javascript.options.relimit

From MozillaZine Knowledge Base
Jump to navigationJump to search

Background

Some regular expressions can, based on the length of the text processed, take exponential amounts of time to run. As Mozilla’s JavaScript engine implements regular expressions, it is possible to hang a browser or other Mozilla application using one of these “exponentially explosive” regular expressions.

To guard against this possibility, checks are performed internally to catch these regular expressions before they consume too much processing time. This preference determines whether problematic regular expressions should throw an exception, stopping execution.

Possible values and their effects

True

Throw an exception when a regular expression backtracks more than n³ times, where n is the length of the input string.

False

Ignore large amounts of backtracking in regular expressions. (Default)

Caveats

  • Setting this preference to true may cause perfectly valid JavaScript to break if included regular expressions are too complex.
  • Mozilla applications may become unresponsive on certain regular expressions if this preference is set to false.

First checked in

2007-03-23 by Brian Crowder

Has an effect in

  • Mozilla Firefox (trunk builds after 2007-03-23)
  • SeaMonkey (trunk builds after 2007-03-23)

Related bugs

Related preferences