summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_6/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/js1_6/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/js1_6/Array')
-rw-r--r--js/src/tests/js1_6/Array/browser.js0
-rw-r--r--js/src/tests/js1_6/Array/filter.js53
-rw-r--r--js/src/tests/js1_6/Array/generics.js331
-rw-r--r--js/src/tests/js1_6/Array/regress-290592.js661
-rw-r--r--js/src/tests/js1_6/Array/regress-304828.js256
-rw-r--r--js/src/tests/js1_6/Array/regress-305002.js25
-rw-r--r--js/src/tests/js1_6/Array/regress-310425-01.js27
-rw-r--r--js/src/tests/js1_6/Array/regress-310425-02.js17
-rw-r--r--js/src/tests/js1_6/Array/regress-320887.js27
-rw-r--r--js/src/tests/js1_6/Array/regress-352742-01.js39
-rw-r--r--js/src/tests/js1_6/Array/regress-352742-02.js32
-rw-r--r--js/src/tests/js1_6/Array/regress-386030.js67
-rw-r--r--js/src/tests/js1_6/Array/regress-415451.js24
-rw-r--r--js/src/tests/js1_6/Array/regress-415540.js21
-rw-r--r--js/src/tests/js1_6/Array/regress-566651.js20
-rw-r--r--js/src/tests/js1_6/Array/shell.js0
16 files changed, 1600 insertions, 0 deletions
diff --git a/js/src/tests/js1_6/Array/browser.js b/js/src/tests/js1_6/Array/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_6/Array/browser.js
diff --git a/js/src/tests/js1_6/Array/filter.js b/js/src/tests/js1_6/Array/filter.js
new file mode 100644
index 000000000..6cb929014
--- /dev/null
+++ b/js/src/tests/js1_6/Array/filter.js
@@ -0,0 +1,53 @@
+/* -*- 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 = "364603";
+var summary = "The value placed in a filtered array for an element is the " +
+ " element's value before the callback is run, not after";
+var actual, expect;
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var failed = false;
+
+function mutate(val, index, arr)
+{
+ arr[index] = "mutated";
+ return true;
+}
+
+function assertEqual(v1, v2, msg)
+{
+ if (v1 !== v2)
+ throw msg;
+}
+
+try
+{
+ var a = [1, 2];
+ var m = a.filter(mutate);
+
+ assertEqual(a[0], "mutated", "Array a not mutated!");
+ assertEqual(a[1], "mutated", "Array a not mutated!");
+
+ assertEqual(m[0], 1, "Filtered value is value before callback is run");
+ assertEqual(m[1], 2, "Filtered value is value before callback is run");
+}
+catch (e)
+{
+ failed = e;
+}
+
+
+expect = false;
+actual = failed;
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/generics.js b/js/src/tests/js1_6/Array/generics.js
new file mode 100644
index 000000000..c72149114
--- /dev/null
+++ b/js/src/tests/js1_6/Array/generics.js
@@ -0,0 +1,331 @@
+var BUGNUMBER = 1263558;
+var summary = "Self-host all Array generics.";
+
+print(BUGNUMBER + ": " + summary);
+
+var arr, arrLike, tmp, f;
+
+function reset() {
+ arr = [5, 7, 13];
+ arrLike = {
+ length: 3,
+ 0: 5,
+ 1: 7,
+ 2: 13,
+ toString() {
+ return "arrLike";
+ }
+ };
+ tmp = [];
+}
+function toString() {
+ return "G";
+}
+
+// Array.join (test this first to use it in remaining tests).
+reset();
+assertThrowsInstanceOf(() => Array.join(), TypeError);
+assertEq(Array.join(arr), "5,7,13");
+assertEq(Array.join(arr, "-"), "5-7-13");
+assertEq(Array.join(arrLike), "5,7,13");
+assertEq(Array.join(arrLike, "-"), "5-7-13");
+
+// Array.concat.
+reset();
+assertThrowsInstanceOf(() => Array.concat(), TypeError);
+assertEq(Array.join(Array.concat(arr), ","), "5,7,13");
+assertEq(Array.join(Array.concat(arr, 11), ","), "5,7,13,11");
+assertEq(Array.join(Array.concat(arr, 11, 17), ","), "5,7,13,11,17");
+assertEq(Array.join(Array.concat(arrLike), ","), "arrLike");
+assertEq(Array.join(Array.concat(arrLike, 11), ","), "arrLike,11");
+assertEq(Array.join(Array.concat(arrLike, 11, 17), ","), "arrLike,11,17");
+
+// Array.lastIndexOf.
+reset();
+assertThrowsInstanceOf(() => Array.lastIndexOf(), TypeError);
+assertEq(Array.lastIndexOf(arr), -1);
+assertEq(Array.lastIndexOf(arr, 1), -1);
+assertEq(Array.lastIndexOf(arr, 5), 0);
+assertEq(Array.lastIndexOf(arr, 7), 1);
+assertEq(Array.lastIndexOf(arr, 13, 1), -1);
+assertEq(Array.lastIndexOf(arrLike), -1);
+assertEq(Array.lastIndexOf(arrLike, 1), -1);
+assertEq(Array.lastIndexOf(arrLike, 5), 0);
+assertEq(Array.lastIndexOf(arrLike, 7), 1);
+assertEq(Array.lastIndexOf(arrLike, 13, 1), -1);
+
+// Array.indexOf.
+reset();
+assertThrowsInstanceOf(() => Array.indexOf(), TypeError);
+assertEq(Array.indexOf(arr), -1);
+assertEq(Array.indexOf(arr, 1), -1);
+assertEq(Array.indexOf(arr, 5), 0);
+assertEq(Array.indexOf(arr, 7), 1);
+assertEq(Array.indexOf(arr, 1, 5), -1);
+assertEq(Array.indexOf(arrLike), -1);
+assertEq(Array.indexOf(arrLike, 1), -1);
+assertEq(Array.indexOf(arrLike, 5), 0);
+assertEq(Array.indexOf(arrLike, 7), 1);
+assertEq(Array.indexOf(arrLike, 1, 5), -1);
+
+// Array.forEach.
+reset();
+assertThrowsInstanceOf(() => Array.forEach(), TypeError);
+assertThrowsInstanceOf(() => Array.forEach(arr), TypeError);
+assertThrowsInstanceOf(() => Array.forEach(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(this, ...args);
+};
+tmp = [];
+Array.forEach(arr, f);
+assertEq(tmp.join(","), "G,5,0,5,7,13," + "G,7,1,5,7,13," + "G,13,2,5,7,13");
+tmp = [];
+Array.forEach(arr, f, "T");
+assertEq(tmp.join(","), "T,5,0,5,7,13," + "T,7,1,5,7,13," + "T,13,2,5,7,13");
+tmp = [];
+Array.forEach(arrLike, f);
+assertEq(tmp.join(","), "G,5,0,arrLike," + "G,7,1,arrLike," + "G,13,2,arrLike");
+tmp = [];
+Array.forEach(arrLike, f, "T");
+assertEq(tmp.join(","), "T,5,0,arrLike," + "T,7,1,arrLike," + "T,13,2,arrLike");
+
+// Array.map.
+reset();
+assertThrowsInstanceOf(() => Array.map(), TypeError);
+assertThrowsInstanceOf(() => Array.map(arr), TypeError);
+assertThrowsInstanceOf(() => Array.map(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(this, ...args);
+ return args[0] * 2;
+}
+tmp = [];
+assertEq(Array.join(Array.map(arr, f), ","), "10,14,26");
+assertEq(tmp.join(","), "G,5,0,5,7,13," + "G,7,1,5,7,13," + "G,13,2,5,7,13");
+tmp = [];
+assertEq(Array.join(Array.map(arr, f, "T"), ","), "10,14,26");
+assertEq(tmp.join(","), "T,5,0,5,7,13," + "T,7,1,5,7,13," + "T,13,2,5,7,13");
+tmp = [];
+assertEq(Array.join(Array.map(arrLike, f), ","), "10,14,26");
+assertEq(tmp.join(","), "G,5,0,arrLike," + "G,7,1,arrLike," + "G,13,2,arrLike");
+tmp = [];
+assertEq(Array.join(Array.map(arrLike, f, "T"), ","), "10,14,26");
+assertEq(tmp.join(","), "T,5,0,arrLike," + "T,7,1,arrLike," + "T,13,2,arrLike");
+
+// Array.filter.
+reset();
+assertThrowsInstanceOf(() => Array.filter(), TypeError);
+assertThrowsInstanceOf(() => Array.filter(arr), TypeError);
+assertThrowsInstanceOf(() => Array.filter(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(this, ...args);
+ return args[0] < 10;
+}
+tmp = [];
+assertEq(Array.join(Array.filter(arr, f), ","), "5,7");
+assertEq(tmp.join(","), "G,5,0,5,7,13," + "G,7,1,5,7,13," + "G,13,2,5,7,13");
+tmp = [];
+assertEq(Array.join(Array.filter(arr, f, "T"), ","), "5,7");
+assertEq(tmp.join(","), "T,5,0,5,7,13," + "T,7,1,5,7,13," + "T,13,2,5,7,13");
+tmp = [];
+assertEq(Array.join(Array.filter(arrLike, f), ","), "5,7");
+assertEq(tmp.join(","), "G,5,0,arrLike," + "G,7,1,arrLike," + "G,13,2,arrLike");
+tmp = [];
+assertEq(Array.join(Array.filter(arrLike, f, "T"), ","), "5,7");
+assertEq(tmp.join(","), "T,5,0,arrLike," + "T,7,1,arrLike," + "T,13,2,arrLike");
+
+// Array.every.
+reset();
+assertThrowsInstanceOf(() => Array.every(), TypeError);
+assertThrowsInstanceOf(() => Array.every(arr), TypeError);
+assertThrowsInstanceOf(() => Array.every(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(this, ...args);
+ return args[0] < 6;
+}
+tmp = [];
+assertEq(Array.every(arr, f), false);
+assertEq(tmp.join(","), "G,5,0,5,7,13," + "G,7,1,5,7,13");
+tmp = [];
+assertEq(Array.every(arr, f, "T"), false);
+assertEq(tmp.join(","), "T,5,0,5,7,13," + "T,7,1,5,7,13");
+tmp = [];
+assertEq(Array.every(arrLike, f), false);
+assertEq(tmp.join(","), "G,5,0,arrLike," + "G,7,1,arrLike");
+tmp = [];
+assertEq(Array.every(arrLike, f, "T"), false);
+assertEq(tmp.join(","), "T,5,0,arrLike," + "T,7,1,arrLike");
+
+// Array.some.
+reset();
+assertThrowsInstanceOf(() => Array.some(), TypeError);
+assertThrowsInstanceOf(() => Array.some(arr), TypeError);
+assertThrowsInstanceOf(() => Array.some(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(this, ...args);
+ return args[0] == 7;
+}
+tmp = [];
+assertEq(Array.some(arr, f), true);
+assertEq(tmp.join(","), "G,5,0,5,7,13," + "G,7,1,5,7,13");
+tmp = [];
+assertEq(Array.some(arr, f, "T"), true);
+assertEq(tmp.join(","), "T,5,0,5,7,13," + "T,7,1,5,7,13");
+tmp = [];
+assertEq(Array.some(arrLike, f), true);
+assertEq(tmp.join(","), "G,5,0,arrLike," + "G,7,1,arrLike");
+tmp = [];
+assertEq(Array.some(arrLike, f, "T"), true);
+assertEq(tmp.join(","), "T,5,0,arrLike," + "T,7,1,arrLike");
+
+// Array.reduce.
+reset();
+assertThrowsInstanceOf(() => Array.reduce(), TypeError);
+assertThrowsInstanceOf(() => Array.reduce(arr), TypeError);
+assertThrowsInstanceOf(() => Array.reduce(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(...args);
+ return args[0] + args[1];
+}
+tmp = [];
+assertEq(Array.reduce(arr, f), 25);
+assertEq(tmp.join(","), "5,7,1,5,7,13," + "12,13,2,5,7,13");
+tmp = [];
+assertEq(Array.reduce(arr, f, 17), 42);
+assertEq(tmp.join(","), "17,5,0,5,7,13," + "22,7,1,5,7,13," + "29,13,2,5,7,13");
+tmp = [];
+assertEq(Array.reduce(arrLike, f), 25);
+assertEq(tmp.join(","), "5,7,1,arrLike," + "12,13,2,arrLike");
+tmp = [];
+assertEq(Array.reduce(arrLike, f, 17), 42);
+assertEq(tmp.join(","), "17,5,0,arrLike," + "22,7,1,arrLike," + "29,13,2,arrLike");
+
+// Array.reduceRight.
+reset();
+assertThrowsInstanceOf(() => Array.reduceRight(), TypeError);
+assertThrowsInstanceOf(() => Array.reduceRight(arr), TypeError);
+assertThrowsInstanceOf(() => Array.reduceRight(arrLike), TypeError);
+f = function(...args) {
+ tmp.push(...args);
+ return args[0] + args[1];
+}
+tmp = [];
+assertEq(Array.reduceRight(arr, f), 25);
+assertEq(tmp.join(","), "13,7,1,5,7,13," + "20,5,0,5,7,13");
+tmp = [];
+assertEq(Array.reduceRight(arr, f, 17), 42);
+assertEq(tmp.join(","), "17,13,2,5,7,13," + "30,7,1,5,7,13," + "37,5,0,5,7,13");
+tmp = [];
+assertEq(Array.reduceRight(arrLike, f), 25);
+assertEq(tmp.join(","), "13,7,1,arrLike," + "20,5,0,arrLike");
+tmp = [];
+assertEq(Array.reduceRight(arrLike, f, 17), 42);
+assertEq(tmp.join(","), "17,13,2,arrLike," + "30,7,1,arrLike," + "37,5,0,arrLike");
+
+// Array.reverse.
+reset();
+assertThrowsInstanceOf(() => Array.reverse(), TypeError);
+assertEq(Array.join(Array.reverse(arr), ","), "13,7,5");
+assertEq(Array.join(arr, ","), "13,7,5");
+assertEq(Array.join(Array.reverse(arrLike), ","), "13,7,5");
+assertEq(Array.join(arrLike, ","), "13,7,5");
+
+// Array.sort.
+reset();
+assertThrowsInstanceOf(() => Array.sort(), TypeError);
+f = function(x, y) {
+ return y - x;
+}
+assertEq(Array.join(Array.sort(arr), ","), "13,5,7");
+assertEq(Array.join(Array.sort(arr, f), ","), "13,7,5");
+assertEq(Array.join(Array.sort(arrLike), ","), "13,5,7");
+assertEq(Array.join(Array.sort(arrLike, f), ","), "13,7,5");
+
+// Array.push.
+reset();
+assertThrowsInstanceOf(() => Array.push(), TypeError);
+assertEq(Array.push(arr), 3);
+assertEq(Array.join(arr), "5,7,13");
+assertEq(Array.push(arr, 17), 4);
+assertEq(Array.join(arr), "5,7,13,17");
+assertEq(Array.push(arr, 19, 21), 6);
+assertEq(Array.join(arr), "5,7,13,17,19,21");
+assertEq(Array.push(arrLike), 3);
+assertEq(Array.join(arrLike), "5,7,13");
+assertEq(Array.push(arrLike, 17), 4);
+assertEq(Array.join(arrLike), "5,7,13,17");
+assertEq(Array.push(arrLike, 19, 21), 6);
+assertEq(Array.join(arrLike), "5,7,13,17,19,21");
+
+// Array.pop.
+reset();
+assertThrowsInstanceOf(() => Array.pop(), TypeError);
+assertEq(Array.pop(arr), 13);
+assertEq(Array.join(arr), "5,7");
+assertEq(Array.pop(arr), 7);
+assertEq(Array.join(arr), "5");
+assertEq(Array.pop(arrLike), 13);
+assertEq(Array.join(arrLike), "5,7");
+assertEq(Array.pop(arrLike), 7);
+assertEq(Array.join(arrLike), "5");
+
+// Array.shift.
+reset();
+assertThrowsInstanceOf(() => Array.shift(), TypeError);
+assertEq(Array.shift(arr), 5);
+assertEq(Array.join(arr), "7,13");
+assertEq(Array.shift(arr), 7);
+assertEq(Array.join(arr), "13");
+assertEq(Array.shift(arrLike), 5);
+assertEq(Array.join(arrLike), "7,13");
+assertEq(Array.shift(arrLike), 7);
+assertEq(Array.join(arrLike), "13");
+
+// Array.unshift.
+reset();
+assertThrowsInstanceOf(() => Array.unshift(), TypeError);
+assertEq(Array.unshift(arr), 3);
+assertEq(Array.join(arr), "5,7,13");
+assertEq(Array.unshift(arr, 17), 4);
+assertEq(Array.join(arr), "17,5,7,13");
+assertEq(Array.unshift(arr, 19, 21), 6);
+assertEq(Array.join(arr), "19,21,17,5,7,13");
+assertEq(Array.unshift(arrLike), 3);
+assertEq(Array.join(arrLike), "5,7,13");
+assertEq(Array.unshift(arrLike, 17), 4);
+assertEq(Array.join(arrLike), "17,5,7,13");
+assertEq(Array.unshift(arrLike, 19, 21), 6);
+assertEq(Array.join(arrLike), "19,21,17,5,7,13");
+
+// Array.splice.
+reset();
+assertThrowsInstanceOf(() => Array.splice(), TypeError);
+assertEq(Array.join(Array.splice(arr)), "");
+assertEq(Array.join(arr), "5,7,13");
+assertEq(Array.join(Array.splice(arr, 1)), "7,13");
+assertEq(Array.join(arr), "5");
+reset();
+assertEq(Array.join(Array.splice(arr, 1, 1)), "7");
+assertEq(Array.join(arr), "5,13");
+reset();
+assertEq(Array.join(Array.splice(arrLike)), "");
+assertEq(Array.join(arrLike), "5,7,13");
+assertEq(Array.join(Array.splice(arrLike, 1)), "7,13");
+assertEq(Array.join(arrLike), "5");
+reset();
+assertEq(Array.join(Array.splice(arrLike, 1, 1)), "7");
+assertEq(Array.join(arrLike), "5,13");
+
+// Array.slice.
+reset();
+assertThrowsInstanceOf(() => Array.slice(), TypeError);
+assertEq(Array.join(Array.slice(arr)), "5,7,13");
+assertEq(Array.join(Array.slice(arr, 1)), "7,13");
+assertEq(Array.join(Array.slice(arr, 1, 1)), "");
+assertEq(Array.join(Array.slice(arr, 1, 2)), "7");
+assertEq(Array.join(Array.slice(arrLike)), "5,7,13");
+assertEq(Array.join(Array.slice(arrLike, 1)), "7,13");
+assertEq(Array.join(Array.slice(arrLike, 1, 1)), "");
+assertEq(Array.join(Array.slice(arrLike, 1, 2)), "7");
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/js1_6/Array/regress-290592.js b/js/src/tests/js1_6/Array/regress-290592.js
new file mode 100644
index 000000000..788459a4e
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-290592.js
@@ -0,0 +1,661 @@
+/* -*- 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 = 290592;
+var summary = 'Array extras: forEach, indexOf, filter, map';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+// Utility functions
+
+function identity(v, index, array)
+{
+ reportCompare(v, array[index], 'identity: check callback argument consistency');
+ return v;
+}
+
+function mutate(v, index, array)
+{
+ reportCompare(v, array[index], 'mutate: check callback argument consistency');
+ if (index == 0)
+ {
+ array[1] = 'mutated';
+ delete array[2];
+ array.push('not visited');
+ }
+ return v;
+}
+
+function mutateForEach(v, index, array)
+{
+ reportCompare(v, array[index], 'mutateForEach: check callback argument consistency');
+ if (index == 0)
+ {
+ array[1] = 'mutated';
+ delete array[2];
+ array.push('not visited');
+ }
+ actual += v + ',';
+}
+
+function makeUpperCase(v, index, array)
+{
+ reportCompare(v, array[index], 'makeUpperCase: check callback argument consistency');
+ try
+ {
+ return v.toUpperCase();
+ }
+ catch(e)
+ {
+ }
+ return v;
+}
+
+
+function concat(v, index, array)
+{
+ reportCompare(v, array[index], 'concat: check callback argument consistency');
+ actual += v + ',';
+}
+
+
+function isUpperCase(v, index, array)
+{
+ reportCompare(v, array[index], 'isUpperCase: check callback argument consistency');
+ try
+ {
+ return v == v.toUpperCase();
+ }
+ catch(e)
+ {
+ }
+ return false;
+}
+
+function isString(v, index, array)
+{
+ reportCompare(v, array[index], 'isString: check callback argument consistency');
+ return typeof v == 'string';
+}
+
+
+// callback object.
+function ArrayCallback(state)
+{
+ this.state = state;
+}
+
+ArrayCallback.prototype.makeUpperCase = function (v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.makeUpperCase: check callback argument consistency');
+ try
+ {
+ return this.state ? v.toUpperCase() : v.toLowerCase();
+ }
+ catch(e)
+ {
+ }
+ return v;
+};
+
+ArrayCallback.prototype.concat = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.concat: check callback argument consistency');
+ actual += v + ',';
+};
+
+ArrayCallback.prototype.isUpperCase = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.isUpperCase: check callback argument consistency');
+ try
+ {
+ return this.state ? true : (v == v.toUpperCase());
+ }
+ catch(e)
+ {
+ }
+ return false;
+};
+
+ArrayCallback.prototype.isString = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.isString: check callback argument consistency');
+ return this.state ? true : (typeof v == 'string');
+};
+
+function dumpError(e)
+{
+ var s = e.name + ': ' + e.message +
+ ' File: ' + e.fileName +
+ ', Line: ' + e.lineNumber +
+ ', Stack: ' + e.stack;
+ return s;
+}
+
+var obj;
+var strings = ['hello', 'Array', 'WORLD'];
+var mixed = [0, '0', 0];
+var sparsestrings = new Array();
+sparsestrings[2] = 'sparse';
+
+if ('map' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:map
+
+ // test Array.map
+
+ // map has 1 required argument
+ expect = 1;
+ actual = Array.prototype.map.length;
+ reportCompare(expect, actual, 'Array.prototype.map.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.map();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.map(undefined) throws TypeError');
+
+ try
+ {
+ // identity map
+ expect = 'hello,Array,WORLD';
+ actual = strings.map(identity).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: identity');
+
+
+ try
+ {
+ expect = 'hello,mutated,';
+ actual = strings.map(mutate).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: mutate');
+
+ strings = ['hello', 'Array', 'WORLD'];
+
+ try
+ {
+ // general map
+ expect = 'HELLO,ARRAY,WORLD';
+ actual = strings.map(makeUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase');
+
+ try
+ {
+ // pass object method as map callback
+ expect = 'HELLO,ARRAY,WORLD';
+ var obj = new ArrayCallback(true);
+ actual = strings.map(obj.makeUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase with object callback');
+
+ try
+ {
+ expect = 'hello,array,world';
+ obj = new ArrayCallback(false);
+ actual = strings.map(obj.makeUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: lowercase with object callback');
+
+ try
+ {
+ // map on sparse arrays
+ expect = ',,SPARSE';
+ actual = sparsestrings.map(makeUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase on sparse array');
+}
+
+if ('forEach' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
+
+ // test Array.forEach
+
+ // forEach has 1 required argument
+ expect = 1;
+ actual = Array.prototype.forEach.length;
+ reportCompare(expect, actual, 'Array.prototype.forEach.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.forEach();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.forEach(undefined) throws TypeError');
+
+ try
+ {
+ // general forEach
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ strings.forEach(concat);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach');
+
+ try
+ {
+ expect = 'hello,mutated,';
+ actual = '';
+ strings.forEach(mutateForEach);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach: mutate');
+
+ strings = ['hello', 'Array', 'WORLD'];
+
+
+
+ try
+ {
+ // pass object method as forEach callback
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ obj = new ArrayCallback(true);
+ strings.forEach(obj.concat, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach with object callback 1');
+
+ try
+ {
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ obj = new ArrayCallback(false);
+ strings.forEach(obj.concat, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach with object callback 2');
+
+ try
+ {
+ // test forEach on sparse arrays
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = 'sparse,';
+ actual = '';
+ sparsestrings.forEach(concat);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach on sparse array');
+}
+
+if ('filter' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:filter
+
+ // test Array.filter
+
+ // filter has 1 required argument
+ expect = 1;
+ actual = Array.prototype.filter.length;
+ reportCompare(expect, actual, 'Array.prototype.filter.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.filter();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.filter(undefined) throws TypeError');
+
+ try
+ {
+ // test general filter
+ expect = 'WORLD';
+ actual = strings.filter(isUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter');
+
+ try
+ {
+ expect = 'WORLD';
+ obj = new ArrayCallback(false);
+ actual = strings.filter(obj.isUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter object callback 1');
+
+ try
+ {
+ expect = 'hello,Array,WORLD';
+ obj = new ArrayCallback(true);
+ actual = strings.filter(obj.isUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter object callback 2');
+}
+
+if ('every' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:every
+
+ // test Array.every
+
+ // every has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.every.length;
+ reportCompare(expect, actual, 'Array.prototype.every.length == 1');
+
+ // throw TypeError if no every callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.every();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.every(undefined) throws TypeError');
+
+ // test general every
+
+ try
+ {
+ expect = true;
+ actual = strings.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: every element is a string');
+
+ try
+ {
+ expect = false;
+ actual = mixed.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: every element is a string');
+
+ try
+ {
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = true;
+ actual = sparsestrings.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: every element is a string');
+
+ // pass object method as map callback
+
+ obj = new ArrayCallback(false);
+
+ try
+ {
+ expect = true;
+ actual = strings.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: every element is a string, via object callback');
+
+ try
+ {
+ expect = false;
+ actual = mixed.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e) ;
+ }
+ reportCompare(expect, actual, 'mixed: every element is a string, via object callback');
+
+ try
+ {
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = true;
+ actual = sparsestrings.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: every element is a string, via object callback');
+
+}
+
+if ('some' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
+
+ // test Array.some
+
+ // some has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.some.length;
+ reportCompare(expect, actual, 'Array.prototype.some.length == 1');
+
+ // throw TypeError if no some callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.some();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.some(undefined) throws TypeError');
+
+ // test general some
+
+ try
+ {
+ expect = true;
+ actual = strings.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: some element is a string');
+
+ try
+ {
+ expect = true;
+ actual = mixed.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: some element is a string');
+
+ try
+ {
+ expect = true;
+ actual = sparsestrings.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: some element is a string');
+
+ // pass object method as map callback
+
+ obj = new ArrayCallback(false);
+
+ try
+ {
+ expect = true;
+ actual = strings.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: some element is a string, via object callback');
+
+ try
+ {
+ expect = true;
+ actual = mixed.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: some element is a string, via object callback');
+
+ try
+ {
+ expect = true;
+ actual = sparsestrings.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: some element is a string, via object callback');
+
+}
+
+if ('indexOf' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:indexOf
+
+ // test Array.indexOf
+
+ // indexOf has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.indexOf.length;
+ reportCompare(expect, actual, 'Array.prototype.indexOf.length == 1');
+
+ // test general indexOf
+
+ try
+ {
+ expect = -1;
+ actual = mixed.indexOf('not found');
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf returns -1 if value not found');
+
+ try
+ {
+ expect = 0;
+ actual = mixed.indexOf(0);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf matches using strict equality');
+
+ try
+ {
+ expect = 1;
+ actual = mixed.indexOf('0');
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf matches using strict equality');
+
+ try
+ {
+ expect = 2;
+ actual = mixed.indexOf(0, 1);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf begins searching at fromIndex');
+}
+
diff --git a/js/src/tests/js1_6/Array/regress-304828.js b/js/src/tests/js1_6/Array/regress-304828.js
new file mode 100644
index 000000000..0b15e21d2
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-304828.js
@@ -0,0 +1,256 @@
+/* -*- 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 = 304828;
+var summary = 'Array Generic Methods';
+var actual = '';
+var expect = '';
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var value;
+
+// use Array methods on a String
+// join
+value = '123';
+expect = '1,2,3';
+try
+{
+ actual = Array.prototype.join.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': join');
+
+// reverse
+value = '123';
+expect = 'TypeError: 0 is read-only';
+try
+{
+ actual = Array.prototype.reverse.call(value) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': reverse');
+
+// sort
+value = 'cba';
+expect = 'TypeError: 0 is read-only';
+try
+{
+ actual = Array.prototype.sort.call(value) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': sort');
+
+// push
+value = 'abc';
+expect = 6;
+try
+{
+ Array.prototype.push.call(value, 'd', 'e', 'f');
+ throw new Error("didn't throw");
+}
+catch(e)
+{
+ reportCompare(true, e instanceof TypeError,
+ "push on a string primitive should throw TypeError");
+}
+reportCompare('abc', value, summary + ': push string primitive');
+
+value = new String("abc");
+expect = 6;
+try
+{
+ Array.prototype.push.call(value, 'd', 'e', 'f');
+ throw new Error("didn't throw");
+}
+catch(e)
+{
+ reportCompare(true, e instanceof TypeError,
+ "push on a String object should throw TypeError");
+}
+reportCompare("d", value[3], summary + ': push String object index 3');
+reportCompare("e", value[4], summary + ': push String object index 4');
+reportCompare("f", value[5], summary + ': push String object index 5');
+
+// pop
+value = 'abc';
+expect = "TypeError: property 2 is non-configurable and can't be deleted";
+try
+{
+ actual = Array.prototype.pop.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': pop');
+reportCompare('abc', value, summary + ': pop');
+
+// unshift
+value = 'def';
+expect = 'TypeError: 0 is read-only';
+try
+{
+ actual = Array.prototype.unshift.call(value, 'a', 'b', 'c');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': unshift');
+reportCompare('def', value, summary + ': unshift');
+
+// shift
+value = 'abc';
+expect = 'TypeError: 0 is read-only';
+try
+{
+ actual = Array.prototype.shift.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': shift');
+reportCompare('abc', value, summary + ': shift');
+
+// splice
+value = 'abc';
+expect = 'TypeError: 1 is read-only';
+try
+{
+ actual = Array.prototype.splice.call(value, 1, 1) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': splice');
+
+// concat
+value = 'abc';
+expect = 'abc,d,e,f';
+try
+{
+ actual = Array.prototype.concat.call(value, 'd', 'e', 'f') + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': concat');
+
+// slice
+value = 'abc';
+expect = 'b';
+try
+{
+ actual = Array.prototype.slice.call(value, 1, 2) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': slice');
+
+// indexOf
+value = 'abc';
+expect = 1;
+try
+{
+ actual = Array.prototype.indexOf.call(value, 'b');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': indexOf');
+
+// lastIndexOf
+value = 'abcabc';
+expect = 4;
+try
+{
+ actual = Array.prototype.lastIndexOf.call(value, 'b');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': lastIndexOf');
+
+// forEach
+value = 'abc';
+expect = 'ABC';
+actual = '';
+try
+{
+ Array.prototype.forEach.call(value,
+ function (v, index, array)
+ {actual += array[index].toUpperCase();});
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': forEach');
+
+// map
+value = 'abc';
+expect = 'A,B,C';
+try
+{
+ actual = Array.prototype.map.call(value,
+ function (v, index, array)
+ {return v.toUpperCase();}) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': map');
+
+// filter
+value = '1234567890';
+expect = '2,4,6,8,0';
+try
+{
+ actual = Array.prototype.filter.call(value,
+ function (v, index, array)
+ {return array[index] % 2 == 0;}) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': filter');
+
+// every
+value = '1234567890';
+expect = false;
+try
+{
+ actual = Array.prototype.every.call(value,
+ function (v, index, array)
+ {return array[index] % 2 == 0;});
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': every');
+
+
+
diff --git a/js/src/tests/js1_6/Array/regress-305002.js b/js/src/tests/js1_6/Array/regress-305002.js
new file mode 100644
index 000000000..e59668e7f
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-305002.js
@@ -0,0 +1,25 @@
+/* -*- 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 = 305002;
+var summary = '[].every(f) == true';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var notcalled = true;
+
+function callback()
+{
+ notcalled = false;
+}
+
+expect = true;
+actual = [].every(callback) && notcalled;
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/regress-310425-01.js b/js/src/tests/js1_6/Array/regress-310425-01.js
new file mode 100644
index 000000000..a60d6660a
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-310425-01.js
@@ -0,0 +1,27 @@
+/* -*- 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 = 310425;
+var summary = 'Array.indexOf/lastIndexOf edge cases';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = -1;
+actual = [].lastIndexOf(undefined, -1);
+reportCompare(expect, actual, summary);
+
+expect = -1;
+actual = [].indexOf(undefined, -1);
+reportCompare(expect, actual, summary);
+
+var x = [];
+x[1 << 30] = 1;
+expect = (1 << 30);
+actual = x.lastIndexOf(1);
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/regress-310425-02.js b/js/src/tests/js1_6/Array/regress-310425-02.js
new file mode 100644
index 000000000..ff9e88ae4
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-310425-02.js
@@ -0,0 +1,17 @@
+/* -*- 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 = 310425;
+var summary = 'Array.indexOf/lastIndexOf edge cases';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = -1;
+actual = Array(1).indexOf(1);
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/regress-320887.js b/js/src/tests/js1_6/Array/regress-320887.js
new file mode 100644
index 000000000..baf6c3079
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-320887.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- obsolete test
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Blake Kaplan
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 320887;
+var summary = 'var x should not throw a ReferenceError';
+var actual = 'No error';
+var expect = 'No error';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+try
+{
+ (function xxx() { ["var x"].map(eval); })()
+ }
+catch(ex)
+{
+ actual = ex + '';
+}
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/regress-352742-01.js b/js/src/tests/js1_6/Array/regress-352742-01.js
new file mode 100644
index 000000000..a3088a5e6
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-352742-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 = 352742;
+var summary = 'Array filter on {valueOf: Function}';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ print('If the test harness fails, this test fails.');
+ expect = 4;
+ z = {valueOf: Function};
+ actual = 2;
+ try {
+ [11].filter(z);
+ }
+ catch(e)
+ {
+ actual = 3;
+ }
+ actual = 4;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_6/Array/regress-352742-02.js b/js/src/tests/js1_6/Array/regress-352742-02.js
new file mode 100644
index 000000000..96270c462
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-352742-02.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 = 352742;
+var summary = 'eval("return") in toString';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 3;
+ var j = ({toString: function() { eval("return"); }});
+ actual = 2;
+ try { "" + j; } catch(e){}
+ actual = 3;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_6/Array/regress-386030.js b/js/src/tests/js1_6/Array/regress-386030.js
new file mode 100644
index 000000000..85ff7fd0e
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-386030.js
@@ -0,0 +1,67 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Blake Kaplan
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 386030;
+var summary = 'Array.reduce should ignore holes';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function add(a, b) { return a + b; }
+ function testreduce(v) { return v == 3 ? "PASS" : "FAIL"; }
+
+ expect = 'PASS';
+
+ try {
+ a = new Array(2);
+ a[1] = 3;
+ actual = testreduce(a.reduce(add));
+ } catch (e) {
+ actual = "FAIL, reduce";
+ }
+ reportCompare(expect, actual, summary + ': 1');
+
+ try {
+ a = new Array(2);
+ a[0] = 3;
+ actual = testreduce(a.reduceRight(add));
+ } catch (e) {
+ actual = "FAIL, reduceRight";
+ }
+ reportCompare(expect, actual, summary + ': 2');
+
+ try {
+ a = new Array(2);
+ a.reduce(add);
+ actual = "FAIL, empty reduce";
+ } catch (e) {
+ actual = "PASS";
+ }
+ reportCompare(expect, actual, summary + ': 3');
+
+ try {
+ a = new Array(2);
+ print(a.reduceRight(add));
+ actual = "FAIL, empty reduceRight";
+ } catch (e) {
+ actual = "PASS";
+ }
+ reportCompare(expect, actual, summary + ': 4');
+
+ exitFunc ('test');
+}
diff --git a/js/src/tests/js1_6/Array/regress-415451.js b/js/src/tests/js1_6/Array/regress-415451.js
new file mode 100644
index 000000000..b4674f5df
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-415451.js
@@ -0,0 +1,24 @@
+/* -*- 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 = 415451;
+var summary = 'indexOf/lastIndexOf behavior';
+
+var expected = "3,0,3,3,3,-1,-1";
+results = [];
+var a = [1,2,3,1];
+for (var i=-1; i < a.length+2; i++)
+ results.push(a.indexOf(1,i));
+var actual = String(results);
+reportCompare(expected, actual, "indexOf");
+
+results = [];
+var expected = "3,0,0,0,3,3,3";
+for (var i=-1; i < a.length+2; i++)
+ results.push(a.lastIndexOf(1,i));
+var actual = String(results);
+reportCompare(expected, actual, "lastIndexOf");
+
diff --git a/js/src/tests/js1_6/Array/regress-415540.js b/js/src/tests/js1_6/Array/regress-415540.js
new file mode 100644
index 000000000..0e2b9726a
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-415540.js
@@ -0,0 +1,21 @@
+/* -*- 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 = 415540;
+var summary = 'Array.push'
+var actual = '';
+var expect = '';
+
+var Constr = function() {};
+Constr.prototype = [];
+var c = new Constr();
+c.push(5);
+c.push(6);
+var actual = Array.push(c,7);
+reportCompare(3, actual, "result of Array.push is length");
+reportCompare(5, c[0], "contents of c[0]");
+reportCompare(6, c[1], "contents of c[1]");
+reportCompare(7, c[2], "contents of c[2]");
diff --git a/js/src/tests/js1_6/Array/regress-566651.js b/js/src/tests/js1_6/Array/regress-566651.js
new file mode 100644
index 000000000..a05d0310a
--- /dev/null
+++ b/js/src/tests/js1_6/Array/regress-566651.js
@@ -0,0 +1,20 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Blake Kaplan
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 566651;
+var summary = 'setting array.length to null should not throw an uncatchable exception';
+var actual = 0;
+var expect = 0;
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var a = [];
+a.length = null;
+
+reportCompare(expect, actual, summary);
diff --git a/js/src/tests/js1_6/Array/shell.js b/js/src/tests/js1_6/Array/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/js1_6/Array/shell.js