Debian Codegraph @

js/src/tests/non262/extensions/regress-355497.js

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