From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- js/src/tests/js1_5/Array/11.1.4.js | 68 ++++++++++ js/src/tests/js1_5/Array/array-001.js | 88 +++++++++++++ js/src/tests/js1_5/Array/browser.js | 0 js/src/tests/js1_5/Array/regress-101964.js | 86 +++++++++++++ js/src/tests/js1_5/Array/regress-107138.js | 177 ++++++++++++++++++++++++++ js/src/tests/js1_5/Array/regress-108440.js | 77 +++++++++++ js/src/tests/js1_5/Array/regress-154338.js | 90 +++++++++++++ js/src/tests/js1_5/Array/regress-157652.js | 122 ++++++++++++++++++ js/src/tests/js1_5/Array/regress-178722.js | 130 +++++++++++++++++++ js/src/tests/js1_5/Array/regress-255555.js | 32 +++++ js/src/tests/js1_5/Array/regress-299644.js | 27 ++++ js/src/tests/js1_5/Array/regress-300858.js | 21 +++ js/src/tests/js1_5/Array/regress-310351.js | 54 ++++++++ js/src/tests/js1_5/Array/regress-311515.js | 20 +++ js/src/tests/js1_5/Array/regress-313153.js | 18 +++ js/src/tests/js1_5/Array/regress-315509-01.js | 28 ++++ js/src/tests/js1_5/Array/regress-330812.js | 33 +++++ js/src/tests/js1_5/Array/regress-345961.js | 36 ++++++ js/src/tests/js1_5/Array/regress-348810.js | 28 ++++ js/src/tests/js1_5/Array/regress-350256-01.js | 45 +++++++ js/src/tests/js1_5/Array/regress-350256-02.js | 47 +++++++ js/src/tests/js1_5/Array/regress-360681-01.js | 33 +++++ js/src/tests/js1_5/Array/regress-360681-02.js | 58 +++++++++ js/src/tests/js1_5/Array/regress-364104.js | 74 +++++++++++ js/src/tests/js1_5/Array/regress-422286.js | 34 +++++ js/src/tests/js1_5/Array/regress-424954.js | 30 +++++ js/src/tests/js1_5/Array/regress-451483.js | 31 +++++ js/src/tests/js1_5/Array/regress-451906.js | 30 +++++ js/src/tests/js1_5/Array/regress-456845.js | 51 ++++++++ js/src/tests/js1_5/Array/regress-465980-01.js | 35 +++++ js/src/tests/js1_5/Array/regress-465980-02.js | 170 +++++++++++++++++++++++++ js/src/tests/js1_5/Array/regress-474529.js | 55 ++++++++ js/src/tests/js1_5/Array/regress-94257.js | 86 +++++++++++++ js/src/tests/js1_5/Array/shell.js | 0 34 files changed, 1914 insertions(+) create mode 100644 js/src/tests/js1_5/Array/11.1.4.js create mode 100644 js/src/tests/js1_5/Array/array-001.js create mode 100644 js/src/tests/js1_5/Array/browser.js create mode 100644 js/src/tests/js1_5/Array/regress-101964.js create mode 100644 js/src/tests/js1_5/Array/regress-107138.js create mode 100644 js/src/tests/js1_5/Array/regress-108440.js create mode 100644 js/src/tests/js1_5/Array/regress-154338.js create mode 100644 js/src/tests/js1_5/Array/regress-157652.js create mode 100644 js/src/tests/js1_5/Array/regress-178722.js create mode 100644 js/src/tests/js1_5/Array/regress-255555.js create mode 100644 js/src/tests/js1_5/Array/regress-299644.js create mode 100644 js/src/tests/js1_5/Array/regress-300858.js create mode 100644 js/src/tests/js1_5/Array/regress-310351.js create mode 100644 js/src/tests/js1_5/Array/regress-311515.js create mode 100644 js/src/tests/js1_5/Array/regress-313153.js create mode 100644 js/src/tests/js1_5/Array/regress-315509-01.js create mode 100644 js/src/tests/js1_5/Array/regress-330812.js create mode 100644 js/src/tests/js1_5/Array/regress-345961.js create mode 100644 js/src/tests/js1_5/Array/regress-348810.js create mode 100644 js/src/tests/js1_5/Array/regress-350256-01.js create mode 100644 js/src/tests/js1_5/Array/regress-350256-02.js create mode 100644 js/src/tests/js1_5/Array/regress-360681-01.js create mode 100644 js/src/tests/js1_5/Array/regress-360681-02.js create mode 100644 js/src/tests/js1_5/Array/regress-364104.js create mode 100644 js/src/tests/js1_5/Array/regress-422286.js create mode 100644 js/src/tests/js1_5/Array/regress-424954.js create mode 100644 js/src/tests/js1_5/Array/regress-451483.js create mode 100644 js/src/tests/js1_5/Array/regress-451906.js create mode 100644 js/src/tests/js1_5/Array/regress-456845.js create mode 100644 js/src/tests/js1_5/Array/regress-465980-01.js create mode 100755 js/src/tests/js1_5/Array/regress-465980-02.js create mode 100644 js/src/tests/js1_5/Array/regress-474529.js create mode 100644 js/src/tests/js1_5/Array/regress-94257.js create mode 100644 js/src/tests/js1_5/Array/shell.js (limited to 'js/src/tests/js1_5/Array') diff --git a/js/src/tests/js1_5/Array/11.1.4.js b/js/src/tests/js1_5/Array/11.1.4.js new file mode 100644 index 000000000..7f39c9305 --- /dev/null +++ b/js/src/tests/js1_5/Array/11.1.4.js @@ -0,0 +1,68 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 260106; +var summary = 'Elisons in Array literals should not be enumed'; +var actual = ''; +var expect = ''; +var status; +var prop; +var array; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +status = summary + ' ' + inSection(1) + ' [,1] '; +array = [,1]; +actual = ''; +expect = '1'; +for (prop in array) +{ + if (prop != 'length') + { + actual += prop; + } +} +reportCompare(expect, actual, status); + +status = summary + ' ' + inSection(2) + ' [,,1] '; +array = [,,1]; +actual = ''; +expect = '2'; +for (prop in array) +{ + if (prop != 'length') + { + actual += prop; + } +} +reportCompare(expect, actual, status); + +status = summary + ' ' + inSection(3) + ' [1,] '; +array = [1,]; +actual = ''; +expect = '0'; +for (prop in array) +{ + if (prop != 'length') + { + actual += prop; + } +} +reportCompare(expect, actual, status); + +status = summary + ' ' + inSection(4) + ' [1,,] '; +array = [1,,]; +actual = ''; +expect = '0'; +for (prop in array) +{ + if (prop != 'length') + { + actual += prop; + } +} +reportCompare(expect, actual, status); diff --git a/js/src/tests/js1_5/Array/array-001.js b/js/src/tests/js1_5/Array/array-001.js new file mode 100644 index 000000000..26e1ae256 --- /dev/null +++ b/js/src/tests/js1_5/Array/array-001.js @@ -0,0 +1,88 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Date: 24 September 2001 + * + * SUMMARY: Truncating arrays that have decimal property names. + * From correspondence with Igor Bukanov : + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = '(none)'; +var summary = 'Truncating arrays that have decimal property names'; +var BIG_INDEX = 4294967290; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var arr = Array(BIG_INDEX); +arr[BIG_INDEX - 1] = 'a'; +arr[BIG_INDEX - 10000] = 'b'; +arr[BIG_INDEX - 0.5] = 'c'; // not an array index - but a valid property name +// Truncate the array - +arr.length = BIG_INDEX - 5000; + + +// Enumerate its properties with for..in +var s = ''; +for (var i in arr) +{ + s += arr[i]; +} + + +/* + * We expect s == 'cb' or 'bc' (EcmaScript does not fix the order). + * Note 'c' is included: for..in includes ALL enumerable properties, + * not just array-index properties. The bug was: Rhino gave s == ''. + */ +status = inSection(1); +actual = sortThis(s); +expect = 'bc'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function sortThis(str) +{ + var chars = str.split(''); + chars = chars.sort(); + return chars.join(''); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (var i=0; i var arr = new Array(0xFFFFFFFF) + * js> arr.length + * 4294967295 + * + * js> var arr = new Array(0x100000000) + * RangeError: invalid array length + * + * + * We'll try the largest possible array first, then a couple others. + * We're just testing that we don't crash on Array.sort(). + * + * Try to be good about memory by nulling each array variable after it is + * used. This will tell the garbage collector the memory is no longer needed. + * + * As of 2002-08-13, the JS shell runs out of memory no matter what we do, + * when trying to sort such large arrays. + * + * We only want to test that we don't CRASH on the sort. So it will be OK + * if we get the JS "out of memory" error. Note this terminates the test + * with exit code 3. Therefore we put + * + * |expectExitCode(3);| + * + * The only problem will arise if the JS shell ever DOES have enough memory + * to do the sort. Then this test will terminate with the normal exit code 0 + * and fail. + * + * Right now, I can't see any other way to do this, because "out of memory" + * is not a catchable error: it cannot be trapped with try...catch. + * + * + * FURTHER HEADACHE: Rhino can't seem to handle the largest array: it hangs. + * So we skip this case in Rhino. Here is correspondence with Igor Bukanov. + * He explains that Rhino isn't actually hanging; it's doing the huge sort: + * + * Philip Schwartau wrote: + * + * > Hi, + * > + * > I'm getting a graceful OOM message on trying to sort certain large + * > arrays. But if the array is too big, Rhino simply hangs. Note that ECMA + * > allows array lengths to be anything less than Math.pow(2,32), so the + * > arrays I'm sorting are legal. + * > + * > Note below, I'm getting an instantaneous OOM error on arr.sort() for LEN + * > = Math.pow(2, 30). So shouldn't I also get one for every LEN between + * > that and Math.pow(2, 32)? For some reason, I start to hang with 100% CPU + * > as LEN hits, say, Math.pow(2, 31) and higher. SpiderMonkey gives OOM + * > messages for all of these. Should I file a bug on this? + * + * Igor Bukanov wrote: + * + * This is due to different sorting algorithm Rhino uses when sorting + * arrays with length > Integer.MAX_VALUE. If length can fit Java int, + * Rhino first copies internal spare array to a temporary buffer, and then + * sorts it, otherwise it sorts array directly. In case of very spare + * arrays, that Array(big_number) generates, it is rather inefficient and + * generates OutOfMemory if length fits int. It may be worth in your case + * to optimize sorting to take into account array spareness, but then it + * would be a good idea to file a bug about ineficient sorting of spare + * arrays both in case of Rhino and SpiderMonkey as SM always uses a + * temporary buffer. + * + */ +//----------------------------------------------------------------------------- +var BUGNUMBER = 157652; +var summary = "Testing that Array.sort() doesn't crash on very large arrays"; +var expect = 'No Crash'; +var actual = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus(summary); + +expectExitCode(0); +expectExitCode(5); + +var IN_RHINO = inRhino(); + +try +{ + if (!IN_RHINO) + { + var a1=Array(0xFFFFFFFF); + a1.sort(); + a1 = null; + } + + var a2 = Array(0x40000000); + a2.sort(); + a2=null; + + var a3=Array(0x10000000/4); + a3.sort(); + a3=null; +} +catch(ex) +{ + // handle changed 1.9 branch behavior. see bug 422348 + expect = 'InternalError: allocation size overflow'; + actual = ex + ''; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Array/regress-178722.js b/js/src/tests/js1_5/Array/regress-178722.js new file mode 100644 index 000000000..950b1e759 --- /dev/null +++ b/js/src/tests/js1_5/Array/regress-178722.js @@ -0,0 +1,130 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 06 November 2002 + * SUMMARY: arr.sort() should not output |undefined| when |arr| is empty + * See http://bugzilla.mozilla.org/show_bug.cgi?id=178722 + * + * ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn) + * + * 1. Call the [[Get]] method of this object with argument "length". + * 2. Call ToUint32(Result(1)). + * 3. Perform an implementation-dependent sequence of calls to the [[Get]], + * [[Put]], and [[Delete]] methods of this object, etc. etc. + * 4. Return this object. + * + * + * Note that sort() is done in-place on |arr|. In other words, sort() is a + * "destructive" method rather than a "functional" method. The return value + * of |arr.sort()| and |arr| are the same object. + * + * If |arr| is an empty array, the return value of |arr.sort()| should be + * an empty array, not the value |undefined| as was occurring in bug 178722. + * + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 178722; +var summary = 'arr.sort() should not output |undefined| when |arr| is empty'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr; + + +// create empty array or pseudo-array objects in various ways +var arr1 = Array(); +var arr2 = new Array(); +var arr3 = []; +var arr4 = [1]; +arr4.pop(); + + +status = inSection(1); +arr = arr1.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr1; +expect = true; +addThis(); + +status = inSection(2); +arr = arr2.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr2; +expect = true; +addThis(); + +status = inSection(3); +arr = arr3.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr3; +expect = true; +addThis(); + +status = inSection(4); +arr = arr4.sort(); +actual = arr instanceof Array && arr.length === 0 && arr === arr4; +expect = true; +addThis(); + +// now do the same thing, with non-default sorting: +function g() {return 1;} + +status = inSection('1a'); +arr = arr1.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr1; +expect = true; +addThis(); + +status = inSection('2a'); +arr = arr2.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr2; +expect = true; +addThis(); + +status = inSection('3a'); +arr = arr3.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr3; +expect = true; +addThis(); + +status = inSection('4a'); +arr = arr4.sort(g); +actual = arr instanceof Array && arr.length === 0 && arr === arr4; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i