]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/js1_2/regexp/regress-9141.js
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 * File Name: regress-9141.js
24 * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141";
26 * From waldemar@netscape.com:
28 * The following page crashes the system:
30 * <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
31 * "http://www.w3.org/TR/REC-html40/loose.dtd">
36 * <SCRIPT type="text/javascript">
38 * for (var i = 0; i != 13; i++) s += s;
39 * var a = /(?:xx|x)*[slash](s);
40 * var b = /(xx|x)*[slash](s);
41 * document.write("Results = " + a.length + "," + b.length);
46 var SECTION
= "js1_2"; // provide a document reference (ie, ECMA section)
47 var VERSION
= "ECMA_2"; // Version of JavaScript or ECMA
48 var TITLE
= "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description
49 var BUGNUMBER
= "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report
51 startTest(); // leave this alone
54 * Calls to AddTestCase here. AddTestCase is a function that is defined
55 * in shell.js and takes three arguments:
56 * - a string representation of what is being tested
57 * - the expected result
60 * For example, a test might look like this:
62 * var zip = /[\d]{5}$/;
65 * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
66 * "02134", // expected result
67 * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
72 for (var i
= 0; i
!= 13; i
++) s
+= s
;
73 var a
= /(?:xx|x)*/(s
);
76 AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " +
77 "a = /(?:xx|x)*/(s); a.length",
81 AddTestCase( "var b = /(xx|x)*/(s); b.length",
85 test(); // leave this alone. this executes the test cases and