summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_3/Array
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_3/Array
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_3/Array')
-rw-r--r--js/src/tests/ecma_3/Array/15.4.4.11-01.js28
-rw-r--r--js/src/tests/ecma_3/Array/15.4.4.3-1.js54
-rw-r--r--js/src/tests/ecma_3/Array/15.4.4.4-001.js119
-rw-r--r--js/src/tests/ecma_3/Array/15.4.5.1-01.js60
-rw-r--r--js/src/tests/ecma_3/Array/15.5.4.8-01.js43
-rw-r--r--js/src/tests/ecma_3/Array/browser.js0
-rw-r--r--js/src/tests/ecma_3/Array/regress-101488.js138
-rw-r--r--js/src/tests/ecma_3/Array/regress-130451.js185
-rw-r--r--js/src/tests/ecma_3/Array/regress-322135-01.js39
-rw-r--r--js/src/tests/ecma_3/Array/regress-322135-02.js32
-rw-r--r--js/src/tests/ecma_3/Array/regress-322135-03.js40
-rw-r--r--js/src/tests/ecma_3/Array/regress-322135-04.js38
-rw-r--r--js/src/tests/ecma_3/Array/regress-387501.js51
-rw-r--r--js/src/tests/ecma_3/Array/regress-390598.js40
-rw-r--r--js/src/tests/ecma_3/Array/regress-421325.js34
-rw-r--r--js/src/tests/ecma_3/Array/regress-430717.js32
-rw-r--r--js/src/tests/ecma_3/Array/regress-488989.js35
-rw-r--r--js/src/tests/ecma_3/Array/regress-619970.js8
-rw-r--r--js/src/tests/ecma_3/Array/shell.js0
19 files changed, 976 insertions, 0 deletions
diff --git a/js/src/tests/ecma_3/Array/15.4.4.11-01.js b/js/src/tests/ecma_3/Array/15.4.4.11-01.js
new file mode 100644
index 000000000..d92ad5fce
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/15.4.4.11-01.js
@@ -0,0 +1,28 @@
+/* -*- tab-width: 2; 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 = 312138;
+var summary = 'Array.sort should not eat exceptions';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = "e=1 N=1";
+
+var N = 0;
+var array = [4,3,2,1];
+
+try {
+ array.sort(function() {
+ throw ++N;
+ });
+} catch (e) {
+ actual = ("e="+e+" N="+N);
+}
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/ecma_3/Array/15.4.4.3-1.js b/js/src/tests/ecma_3/Array/15.4.4.3-1.js
new file mode 100644
index 000000000..f42834310
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/15.4.4.3-1.js
@@ -0,0 +1,54 @@
+/* -*- 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: 12 Mar 2001
+ *
+ *
+ * SUMMARY: Testing Array.prototype.toLocaleString()
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=56883
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=58031
+ *
+ * By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString()
+ * should be applied to each element of the array, and the results should be
+ * concatenated with an implementation-specific delimiter. For example:
+ *
+ * myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc.
+ *
+ * In this testcase toLocaleString is a user-defined property of each
+ * array element; therefore it is the function that should be
+ * invoked. This function increments a global variable. Therefore the
+ * end value of this variable should be myArray.length.
+ */
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 56883;
+var summary = 'Testing Array.prototype.toLocaleString() -';
+var actual = '';
+var expect = '';
+var n = 0;
+var obj = {toLocaleString: function() {n++}};
+var myArray = [obj, obj, obj];
+
+
+myArray.toLocaleString();
+actual = n;
+expect = 3; // (see explanation above)
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/15.4.4.4-001.js b/js/src/tests/ecma_3/Array/15.4.4.4-001.js
new file mode 100644
index 000000000..602624951
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/15.4.4.4-001.js
@@ -0,0 +1,119 @@
+/* -*- 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: 19 September 2002
+ * SUMMARY: Testing Array.prototype.concat()
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=169795
+ *
+ */
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var BUGNUMBER = 169795;
+var summary = 'Testing Array.prototype.concat()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var x;
+
+
+status = inSection(1);
+x = "Hello";
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(2);
+x = 999;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(3);
+x = /Hello/g;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(4);
+x = new Error("Hello");
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(5);
+x = function() {return "Hello";};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(6);
+x = [function() {return "Hello";}];
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(7);
+x = [1,2,3].concat([4,5,6]);
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(8);
+x = eval('this');
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+/*
+ * The next two sections are by igor@icesoft.no; see
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3
+ */
+status = inSection(9);
+x={length:0};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(10);
+x={length:2, 0:0, 1:1};
+actual = [].concat(x).toString();
+expect = x.toString();
+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<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/15.4.5.1-01.js b/js/src/tests/ecma_3/Array/15.4.5.1-01.js
new file mode 100644
index 000000000..96acdef63
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/15.4.5.1-01.js
@@ -0,0 +1,60 @@
+/* -*- 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 = "(none)";
+var summary = '15.4.5.1 - array.length coverage';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var a = [];
+
+ expect = 'RangeError: invalid array length';
+ actual = '';
+ try
+ {
+ a.length = -1;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ actual = '';
+ try
+ {
+ a.length = 12345678901234567890;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ actual = '';
+ try
+ {
+ a.length = 'a';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/15.5.4.8-01.js b/js/src/tests/ecma_3/Array/15.5.4.8-01.js
new file mode 100644
index 000000000..9901a556e
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/15.5.4.8-01.js
@@ -0,0 +1,43 @@
+/* -*- 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 = 480096;
+var summary = 'Array.lastIndexOf';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '-12';
+ actual = 0;
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6]);
+ actual += [2, 3,, 4, 5, 6].lastIndexOf();
+ actual += Array.prototype.lastIndexOf.call([2, 3,, 4, 5, 6]);
+ actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [, -4]);
+ actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [undefined, -4]);
+ actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [undefined, -5]);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 1);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 2);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 1);
+ actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 2);
+
+ actual = String(actual);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/browser.js b/js/src/tests/ecma_3/Array/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/browser.js
diff --git a/js/src/tests/ecma_3/Array/regress-101488.js b/js/src/tests/ecma_3/Array/regress-101488.js
new file mode 100644
index 000000000..b5563745f
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-101488.js
@@ -0,0 +1,138 @@
+/* -*- 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: Try assigning arr.length = new Number(n)
+ * From correspondence with Igor Bukanov <igor@icesoft.no>
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=101488
+ *
+ * Without the "new" keyword, assigning arr.length = Number(n) worked.
+ * But with it, Rhino was giving an error "Inappropriate array length"
+ * and SpiderMonkey was exiting without giving any error or return value -
+ *
+ * Comments on the Rhino code by igor@icesoft.no:
+ *
+ * jsSet_length requires that the new length value should be an instance
+ * of Number. But according to Ecma 15.4.5.1, item 12-13, an error should
+ * be thrown only if ToUint32(length_value) != ToNumber(length_value)
+ */
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var BUGNUMBER = 101488;
+var summary = 'Try assigning arr.length = new Number(n)';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+
+
+status = inSection(1);
+arr = Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(2);
+arr = Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(3);
+arr = Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(4);
+arr = Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+/*
+ * Also try the above with the "new" keyword before Array().
+ * Array() and new Array() should be equivalent, by ECMA 15.4.1.1
+ */
+status = inSection(5);
+arr = new Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(6);
+arr = new Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+arr = new Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(7);
+arr = new Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function tryThis(s)
+{
+ try
+ {
+ eval(s);
+ }
+ catch(e)
+ {
+ // keep going
+ }
+}
+
+
+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<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-130451.js b/js/src/tests/ecma_3/Array/regress-130451.js
new file mode 100644
index 000000000..9dc5dc41e
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-130451.js
@@ -0,0 +1,185 @@
+/* -*- 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: 25 Mar 2002
+ * SUMMARY: Array.prototype.sort() should not (re-)define .length
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=130451
+ *
+ * From the ECMA-262 Edition 3 Final spec:
+ *
+ * NOTE: The sort function is intentionally generic; it does not require that
+ * its |this| value be an Array object. Therefore, it can be transferred to
+ * other kinds of objects for use as a method. Whether the sort function can
+ * be applied successfully to a host object is implementation-dependent.
+ *
+ * The interesting parts of this testcase are the contrasting expectations for
+ * Brendan's test below, when applied to Array objects vs. non-Array objects.
+ *
+ */
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var BUGNUMBER = 130451;
+var summary = 'Array.prototype.sort() should not (re-)define .length';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+var cmp = new Function();
+
+
+/*
+ * First: test Array.prototype.sort() on Array objects
+ */
+status = inSection(1);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(2);
+arr = [0,1,2,3];
+cmp = function(x,y) {return y-x;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(3);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.length = 1;
+actual = arr.sort(cmp).length;
+expect = 1;
+addThis();
+
+/*
+ * This test is by Brendan. Setting arr.length to
+ * 2 and then 4 should cause elements to be deleted.
+ */
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.sort(cmp);
+
+status = inSection(4);
+actual = arr.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(5);
+actual = arr.length;
+expect = 4;
+addThis();
+
+status = inSection(6);
+arr.length = 2;
+actual = arr.join();
+expect = '0,1';
+addThis();
+
+status = inSection(7);
+arr.length = 4;
+actual = arr.join();
+expect = '0,1,,'; //<---- see how 2,3 have been lost
+addThis();
+
+
+
+/*
+ * Now test Array.prototype.sort() on non-Array objects
+ */
+status = inSection(8);
+var obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 0;
+obj[1] = 1;
+obj[2] = 2;
+obj[3] = 3;
+cmp = function(x,y) {return x-y;};
+actual = obj.sort(cmp).length;
+expect = 4;
+addThis();
+
+
+/*
+ * Here again is Brendan's test. Unlike the array case
+ * above, the setting of obj.length to 2 and then 4
+ * should NOT cause elements to be deleted
+ */
+obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 3;
+obj[1] = 2;
+obj[2] = 1;
+obj[3] = 0;
+cmp = function(x,y) {return x-y;};
+obj.sort(cmp); //<---- this is what triggered the buggy behavior below
+obj.join = Array.prototype.join;
+
+status = inSection(9);
+actual = obj.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(10);
+actual = obj.length;
+expect = 4;
+addThis();
+
+status = inSection(11);
+obj.length = 2;
+actual = obj.join();
+expect = '0,1';
+addThis();
+
+/*
+ * Before this bug was fixed, |actual| held the value '0,1,,'
+ * as in the Array-object case at top. This bug only occurred
+ * if Array.prototype.sort() had been applied to |obj|,
+ * as we have done higher up.
+ */
+status = inSection(12);
+obj.length = 4;
+actual = obj.join();
+expect = '0,1,2,3';
+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<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-322135-01.js b/js/src/tests/ecma_3/Array/regress-322135-01.js
new file mode 100644
index 000000000..2f65724eb
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-322135-01.js
@@ -0,0 +1,39 @@
+/* -*- 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 = 322135;
+var summary = 'Array.prototype.push on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+
+printStatus('before array.length = ' + array.length);
+
+try
+{
+ array.push('Kibo');
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
+
+//expect = 'Kibo';
+//actual = array[length];
+//reportCompare(expect, actual, summary + ': element appended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/js/src/tests/ecma_3/Array/regress-322135-02.js b/js/src/tests/ecma_3/Array/regress-322135-02.js
new file mode 100644
index 000000000..3fbfb59f3
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-322135-02.js
@@ -0,0 +1,32 @@
+// |reftest| skip -- slow (bug 1234947)
+/* -*- 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 = 322135;
+var summary = 'Array.prototype.concat on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array1 = new Array(length);
+var array2 = ['Kibo'];
+var array;
+
+try
+{
+ array = array1.concat(array2);
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/ecma_3/Array/regress-322135-03.js b/js/src/tests/ecma_3/Array/regress-322135-03.js
new file mode 100644
index 000000000..1ff42eb66
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-322135-03.js
@@ -0,0 +1,40 @@
+// |reftest| skip -- slow
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 322135;
+var summary = 'Array.prototype.splice on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+var array1 = ['Kibo'];
+var array;
+
+try
+{
+ array.splice(0, 0, array1);
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary + ': RangeError');
+
+//expect = 'Kibo';
+//actual = array[0];
+//reportCompare(expect, actual, summary + ': element prepended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/js/src/tests/ecma_3/Array/regress-322135-04.js b/js/src/tests/ecma_3/Array/regress-322135-04.js
new file mode 100644
index 000000000..c1858ea20
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-322135-04.js
@@ -0,0 +1,38 @@
+// |reftest| skip -- slow
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 = 322135;
+var summary = 'Array.prototype.unshift on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+
+try
+{
+ array.unshift('Kibo');
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
+
+//expect = 'Kibo';
+//actual = array[0];
+//reportCompare(expect, actual, summary + ': first prepended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/js/src/tests/ecma_3/Array/regress-387501.js b/js/src/tests/ecma_3/Array/regress-387501.js
new file mode 100644
index 000000000..9646fe5e9
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-387501.js
@@ -0,0 +1,51 @@
+/* -*- 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 = 387501;
+var summary =
+ 'Array.prototype.toString|toLocaleString|toSource are generic';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = '[object String]';
+ actual = Array.prototype.toString.call((new String('foo')));
+ assertEq(actual, expect, summary);
+
+ expect = 'f,o,o';
+ actual = Array.prototype.toLocaleString.call((new String('foo')));
+ assertEq(actual, expect, summary);
+
+ assertEq('["f", "o", "o"]', Array.prototype.toSource.call(new String('foo')));
+
+ if (typeof Array.prototype.toSource != 'undefined')
+ {
+ try
+ {
+ Array.prototype.toSource.call('foo');
+ throw new Error("didn't throw");
+ }
+ catch(ex)
+ {
+ assertEq(ex instanceof TypeError, true,
+ "wrong error thrown: expected TypeError, got " + ex);
+ }
+ }
+
+ reportCompare(true, true, "Tests complete");
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-390598.js b/js/src/tests/ecma_3/Array/regress-390598.js
new file mode 100644
index 000000000..f100050ec
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-390598.js
@@ -0,0 +1,40 @@
+/* -*- 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 = 390598;
+var summary = 'Override inherited length of Array-like object';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+
+ function F() {}
+ F.prototype = [];
+
+ // override inherited length from the prototype.
+ expect = 10;
+ var x = new F();
+
+ print('x = new F(); x instanceof Array: ' + (x instanceof Array));
+
+ x.length = expect;
+ actual = x.length;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-421325.js b/js/src/tests/ecma_3/Array/regress-421325.js
new file mode 100644
index 000000000..84f884ba0
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-421325.js
@@ -0,0 +1,34 @@
+/* -*- 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 = 421325;
+var summary = 'Dense Arrays and holes';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ Array.prototype[1] = 'bar';
+
+ var a = [];
+ a[0]='foo';
+ a[2] = 'baz';
+ expect = 'foo,bar,baz';
+ actual = a + '';
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-430717.js b/js/src/tests/ecma_3/Array/regress-430717.js
new file mode 100644
index 000000000..31b3b8325
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-430717.js
@@ -0,0 +1,32 @@
+/* -*- 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 = 430717;
+var summary = 'Dense Arrays should inherit deleted elements from Array.prototype';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ Array.prototype[2] = "two";
+ var a = [0,1,2,3];
+ delete a[2];
+
+ expect = 'two';
+ actual = a[2];
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-488989.js b/js/src/tests/ecma_3/Array/regress-488989.js
new file mode 100644
index 000000000..a610f413b
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-488989.js
@@ -0,0 +1,35 @@
+/* -*- 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 = 488989;
+var summary = 'Array.prototype.push for non-arrays near max-array-index limit';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var stack = { push: [].push }; stack.length = Math.pow(2, 37);
+ stack.push(-2, -1, 0);
+
+ var stack = { push: [].push }; stack.length = Math.pow(2, 5);
+ stack.push(-2, -1, 0);
+
+ var stack = { push: [].push }; stack.length = Math.pow(2, 32) -2;
+ stack.push(-2, -1, 0);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/ecma_3/Array/regress-619970.js b/js/src/tests/ecma_3/Array/regress-619970.js
new file mode 100644
index 000000000..6ec94fc3b
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/regress-619970.js
@@ -0,0 +1,8 @@
+function test() {
+ delete arguments[1];
+ return Array.prototype.join.call(arguments);
+}
+assertEq(test(1,2,3), "1,,3");
+Object.prototype[1] = "ponies!!!1";
+assertEq(test(1,2,3), "1,ponies!!!1,3");
+reportCompare(true,true);
diff --git a/js/src/tests/ecma_3/Array/shell.js b/js/src/tests/ecma_3/Array/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_3/Array/shell.js