Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-234389.js

raw symbols SCIP
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 var gTestfile = 'regress-234389.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 234389;
9 var summary = 'Do not Crash when overloaded toString causes infinite recursion';
10 var actual = ''
11 var expect = 'Internal Error: too much recursion';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var foo = {
17 toString: function() {
18 if (this.re.test(this)) {
19 return "";
20 }
21 return this.value;
22 },
23
24 value: "foo",
25
26 re: /bar/
27 };
28
29 try
30 {
31 var f = foo.toString();
32 expect = 'No Crash';
33 actual = 'No Crash';
34 }
35 catch(ex)
36 {
37 expect = 'InternalError: too much recursion';
38 actual = ex.name + ': ' + ex.message;
39 }
40 reportCompare(expect, actual, summary);