Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-342960.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-342960.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 342960;
9 var summary = 'Do not crash on large string toSource';
10 var actual = 'No Crash';
11 var expect = 'No Crash';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 expectExitCode(0);
25 expectExitCode(5);
26
27 try
28 {
29 function v()
30 {
31 var meg="";
32 var r="";
33 var i;
34 print("don't interrupt the script. let it go.");
35 for(i=0;i<1024*1024;i++) meg += "v";
36 for(i=0;i<1024/8;i++) r += meg;
37 var o={f1: r, f2: r, f3: r,f4: r,f5: r, f6: r, f7: r, f8: r,f9: r};
38 print('done obj');
39 var rr=r.toSource();
40 print('done toSource()');
41 }
42
43 v();
44 }
45 catch(ex)
46 {
47 expect = 'InternalError: script stack space quota is exhausted';
48 actual = ex + '';
49 print(actual);
50 }
51
52 reportCompare(expect, actual, summary);
53
54 exitFunc ('test');
55 }