|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 |
|
8 /** |
|
9 * File Name: regress-9141.js |
|
10 * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; |
|
11 * Description: |
|
12 * From waldemar@netscape.com: |
|
13 * |
|
14 * The following page crashes the system: |
|
15 * |
|
16 * <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" |
|
17 * "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|
18 * <HTML> |
|
19 * <HEAD> |
|
20 * </HEAD> |
|
21 * <BODY> |
|
22 * <SCRIPT type="text/javascript"> |
|
23 * var s = "x"; |
|
24 * for (var i = 0; i != 13; i++) s += s; |
|
25 * var a = /(?:xx|x)*[slash](s); |
|
26 * var b = /(xx|x)*[slash](s); |
|
27 * document.write("Results = " + a.length + "," + b.length); |
|
28 * </SCRIPT> |
|
29 * </BODY> |
|
30 */ |
|
31 |
|
32 var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) |
|
33 var VERSION = "ECMA_2"; // Version of JavaScript or ECMA |
|
34 var TITLE = "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description |
|
35 var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report |
|
36 |
|
37 startTest(); // leave this alone |
|
38 |
|
39 /* |
|
40 * Calls to AddTestCase here. AddTestCase is a function that is defined |
|
41 * in shell.js and takes three arguments: |
|
42 * - a string representation of what is being tested |
|
43 * - the expected result |
|
44 * - the actual result |
|
45 * |
|
46 * For example, a test might look like this: |
|
47 * |
|
48 * var zip = /[\d]{5}$/; |
|
49 * |
|
50 * AddTestCase( |
|
51 * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test |
|
52 * "02134", // expected result |
|
53 * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result |
|
54 * |
|
55 */ |
|
56 |
|
57 var s = "x"; |
|
58 for (var i = 0; i != 13; i++) s += s; |
|
59 var a = /(?:xx|x)*/.exec(s); |
|
60 var b = /(xx|x)*/.exec(s); |
|
61 |
|
62 AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " + |
|
63 "a = /(?:xx|x)*/.exec(s); a.length", |
|
64 1, |
|
65 a.length ); |
|
66 |
|
67 AddTestCase( "var b = /(xx|x)*/.exec(s); b.length", |
|
68 2, |
|
69 b.length ); |
|
70 |
|
71 test(); // leave this alone. this executes the test cases and |
|
72 // displays results. |