1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/extensions/regress-313763.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 313763; 1.11 +var summary = 'Root jsarray.c creatures'; 1.12 +var actual = ''; 1.13 +var expect = ''; 1.14 + 1.15 +printBugNumber(BUGNUMBER); 1.16 +printStatus (summary); 1.17 +printStatus ('This bug requires TOO_MUCH_GC'); 1.18 + 1.19 +var N = 0x80000002; 1.20 +var array = Array(N); 1.21 +array[N - 1] = 1; 1.22 +array[N - 2] = 2; 1.23 + 1.24 +// Set getter not to wait until engine loops through 2^31 holes in the array. 1.25 +var LOOP_TERMINATOR = "stop_long_loop"; 1.26 +array.__defineGetter__(N - 2, function() { 1.27 + throw "stop_long_loop"; 1.28 + }); 1.29 + 1.30 +var prepared_string = String(1); 1.31 +array.__defineGetter__(N - 1, function() { 1.32 + var tmp = prepared_string; 1.33 + prepared_string = null; 1.34 + return tmp; 1.35 + }) 1.36 + 1.37 + 1.38 + try { 1.39 + array.unshift(1); 1.40 + } catch (e) { 1.41 + if (e !== LOOP_TERMINATOR) 1.42 + throw e; 1.43 + } 1.44 + 1.45 +var expect = "1"; 1.46 +var actual = array[N]; 1.47 +printStatus(expect === actual); 1.48 + 1.49 +reportCompare(expect, actual, summary);