Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-355497.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-355497.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 355497;
9 var summary = 'Do not overflow stack with Array.slice, getter';
10 var actual = '';
11 var expect = '';
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
22
23 expect = 'InternalError: too much recursion';
24
25 try
26 {
27 var a = { length: 1 };
28 a.__defineGetter__(0, [].slice);
29 a[0];
30 }
31 catch(ex)
32 {
33 actual = ex + '';
34 }
35 reportCompare(expect, actual, summary + ': 1');
36
37 try
38 {
39 var b = { length: 1 };
40 b.__defineGetter__(0, function () { return Array.slice(b);});
41 b[0];
42 }
43 catch(ex)
44 {
45 actual = ex + '';
46 }
47 reportCompare(expect, actual, summary + ': 2');
48
49 try
50 {
51 var c = [];
52 c.__defineSetter__(0, c.unshift);
53 c[0] = 1;
54 }
55 catch(ex)
56 {
57 actual = ex + '';
58 }
59 reportCompare(expect, actual, summary + ': 3');
60 exitFunc ('test');
61 }