Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-313763.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-313763.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 313763;
9 var summary = 'Root jsarray.c creatures';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15 printStatus ('This bug requires TOO_MUCH_GC');
16
17 var N = 0x80000002;
18 var array = Array(N);
19 array[N - 1] = 1;
20 array[N - 2] = 2;
21
22 // Set getter not to wait untill engine loops through 2^31 holes in the array.
23 var LOOP_TERMINATOR = "stop_long_loop";
24 array.__defineGetter__(N - 2, function() {
25 throw "stop_long_loop";
26 });
27
28 var prepared_string = String(1);
29 array.__defineGetter__(N - 1, function() {
30 var tmp = prepared_string;
31 prepared_string = null;
32 return tmp;
33 })
34
35
36 try {
37 array.unshift(1);
38 } catch (e) {
39 if (e !== LOOP_TERMINATOR)
40 throw e;
41 }
42
43 var expect = "1";
44 var actual = array[N];
45 printStatus(expect === actual);
46
47 reportCompare(expect, actual, summary);