mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
97 lines
2.2 KiB
HTML
97 lines
2.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=452451
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 452451</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452451">Mozilla Bug 452451</a>
|
|
<p id="display"></p>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 452451 **/
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
const prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
ok(prefs.getBoolPref("javascript.options.relimit"),
|
|
"relimit should be enabled by default");
|
|
|
|
/**
|
|
* Following tests are inspired from:
|
|
* js/src/tests/js1_5/extensions/regress-330569.js
|
|
*/
|
|
|
|
var s;
|
|
const expected = 'InternalError: regular expression too complex';
|
|
|
|
s = '<!DOCTYPE HTML PUBLIC>' +
|
|
'<html>\n' +
|
|
'<head>\n' +
|
|
'<meta http-equiv="content-type" content="text/html">\n' +
|
|
'<title></title>\n'+
|
|
'</head>\n' +
|
|
'<body>\n' +
|
|
'<!-- hello -->\n' +
|
|
'<script language="JavaScript">\n' +
|
|
'var s = document. body. innerHTML;\n' +
|
|
'var d = s. replace (/<!--(.*|\n)*-->/, "");\n' +
|
|
'<\/script>\n' +
|
|
'<\/body>\n' +
|
|
'<\/html>\n';
|
|
|
|
try {
|
|
/<!--(.*|\n)*-->/.exec(s);
|
|
}
|
|
catch(ex) {
|
|
actual = ex;
|
|
}
|
|
|
|
is(actual, expected, "reg exp too complex error should have been thrown");
|
|
|
|
function testre( re, n )
|
|
{
|
|
var txt = '';
|
|
for (var i= 0; i <= n; ++i) {
|
|
txt += ',';
|
|
re.test(txt);
|
|
}
|
|
}
|
|
|
|
try {
|
|
testre( /(?:,*)*x/, 22 );
|
|
}
|
|
catch(ex) {
|
|
actual = ex;
|
|
}
|
|
|
|
is(actual, expected, "reg exp too complex error should have been thrown");
|
|
|
|
try {
|
|
testre( /(?:,|,)*x/, 22 );
|
|
}
|
|
catch(ex) {
|
|
actual = ex;
|
|
}
|
|
|
|
is(actual, expected, "reg exp too complex error should have been thrown");
|
|
|
|
try {
|
|
testre( /(?:,|,|,|,|,)*x/, 10 );
|
|
}
|
|
catch(ex) {
|
|
actual = ex;
|
|
}
|
|
|
|
is(actual, expected, "reg exp too complex error should have been thrown");
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|