4 https://bugzilla.mozilla.org/show_bug.cgi?id=452451
7 <title>Test for Bug
452451</title>
8 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=452451">Mozilla Bug
452451</a>
15 <script type=
"application/javascript">
17 /** Test for Bug
452451 **/
19 netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect");
20 const prefs = Components.classes[
"@mozilla.org/preferences-service;1"]
21 .getService(Components.interfaces.nsIPrefBranch);
23 ok(prefs.getBoolPref(
"javascript.options.relimit"),
24 "relimit should be enabled by default");
27 * Following tests are inspired from:
28 * js/src/tests/js1_5/extensions/regress-
330569.js
32 const expected = 'InternalError: regular expression too complex';
34 s = '
<!DOCTYPE HTML PUBLIC
>' +
37 '
<meta http-equiv=
"content-type" content=
"text/html">\n' +
42 '
<script language=
"JavaScript">\n' +
43 'var s
= document
. body
. innerHTML
;\n' +
44 'var d
= s
. replace (/<!--(.*|\n)*-->/, "");\n' +
50 /<!--(.*|\n)*-->/.exec(s);
56 is(actual, expected, "reg exp too complex error should have been thrown");
58 function testre( re, n )
61 for (var i= 0; i <= n; ++i) {
68 testre( /(?:,*)*x/, 22 );
74 is(actual, expected, "reg exp too complex error should have been thrown");
77 testre( /(?:,|,)*x/, 22 );
83 is(actual, expected, "reg exp too complex error should have been thrown");
86 testre( /(?:,|,|,|,|,)*x/, 10 );
92 is(actual, expected, "reg exp too complex error should have been thrown");