summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/push
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Array/prototype/push
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/push')
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T1.js45
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T2.js52
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T1.js61
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T2.js101
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T3.js120
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A3.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T1.js60
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T2.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T3.js47
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A5_T1.js42
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/call-with-boolean.js12
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/clamps-to-integer-limit.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit-set-failure.js49
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit.js42
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/length.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/prop-desc.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-is-frozen.js47
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-length-is-non-writable.js47
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-is-frozen.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-length-is-non-writable.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/throws-if-integer-limit-exceeded.js41
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/push/throws-with-string-receiver.js38
26 files changed, 1099 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T1.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T1.js
new file mode 100644
index 0000000000..e8b82b1e15
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T1.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The arguments are appended to the end of the array, in
+ the order in which they appear. The new length of the array is returned
+ as the result of the call
+esid: sec-array.prototype.push
+description: Checking case when push is given no arguments or one argument
+---*/
+
+var x = new Array();
+var push = x.push(1);
+if (push !== 1) {
+ throw new Test262Error('#1: x = new Array(); x.push(1) === 1. Actual: ' + (push));
+}
+
+if (x[0] !== 1) {
+ throw new Test262Error('#2: x = new Array(); x.push(1); x[0] === 1. Actual: ' + (x[0]));
+}
+
+var push = x.push();
+if (push !== 1) {
+ throw new Test262Error('#3: x = new Array(); x.push(1); x.push() === 1. Actual: ' + (push));
+}
+
+if (x[1] !== undefined) {
+ throw new Test262Error('#4: x = new Array(); x.push(1); x.push(); x[1] === unedfined. Actual: ' + (x[1]));
+}
+
+var push = x.push(-1);
+if (push !== 2) {
+ throw new Test262Error('#5: x = new Array(); x.push(1); x.push(); x.push(-1) === 2. Actual: ' + (push));
+}
+
+if (x[1] !== -1) {
+ throw new Test262Error('#6: x = new Array(); x.push(1); x.push(-1); x[1] === -1. Actual: ' + (x[1]));
+}
+
+if (x.length !== 2) {
+ throw new Test262Error('#7: x = new Array(); x.push(1); x.push(); x.push(-1); x.length === 2. Actual: ' + (x.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T2.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T2.js
new file mode 100644
index 0000000000..602b34e1b8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A1_T2.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The arguments are appended to the end of the array, in
+ the order in which they appear. The new length of the array is returned
+ as the result of the call
+esid: sec-array.prototype.push
+description: Checking case when push is given many arguments
+---*/
+
+var x = [];
+if (x.length !== 0) {
+ throw new Test262Error('#1: x = []; x.length === 0. Actual: ' + (x.length));
+}
+
+x[0] = 0;
+var push = x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1);
+if (push !== 6) {
+ throw new Test262Error('#2: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1) === 6. Actual: ' + (push));
+}
+
+if (x[0] !== 0) {
+ throw new Test262Error('#3: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[0] === 0. Actual: ' + (x[0]));
+}
+
+if (x[1] !== true) {
+ throw new Test262Error('#4: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[1] === true. Actual: ' + (x[1]));
+}
+
+if (x[2] !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#5: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[2] === Number.POSITIVE_INFINITY. Actual: ' + (x[2]));
+}
+
+if (x[3] !== "NaN") {
+ throw new Test262Error('#6: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[3] === "NaN". Actual: ' + (x[3]));
+}
+
+if (x[4] !== "1") {
+ throw new Test262Error('#7: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[4] === "1". Actual: ' + (x[4]));
+}
+
+if (x[5] !== -1) {
+ throw new Test262Error('#8: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[5] === -1. Actual: ' + (x[5]));
+}
+
+if (x.length !== 6) {
+ throw new Test262Error('#9: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x.length === 6. Actual: ' + (x.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T1.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T1.js
new file mode 100644
index 0000000000..2e5e878a92
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T1.js
@@ -0,0 +1,61 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The push function is intentionally generic.
+ It does not require that its this value be an Array object
+esid: sec-array.prototype.push
+description: >
+ The arguments are appended to the end of the array, in the order
+ in which they appear. The new length of the array is returned as
+ the result of the call
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+
+if (obj.length !== undefined) {
+ throw new Test262Error('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
+} else {
+ var push = obj.push(-1);
+ if (push !== 1) {
+ throw new Test262Error('#1: var obj = {}; obj.push = Array.prototype.push; obj.push(-1) === 1. Actual: ' + (push));
+ }
+ if (obj.length !== 1) {
+ throw new Test262Error('#2: var obj = {}; obj.push = Array.prototype.push; obj.push(-1); obj.length === 1. Actual: ' + (obj.length));
+ }
+ if (obj["0"] !== -1) {
+ throw new Test262Error('#3: var obj = {}; obj.push = Array.prototype.push; obj.push(-1); obj["0"] === -1. Actual: ' + (obj["0"]));
+ }
+}
+
+obj.length = undefined;
+var push = obj.push(-4);
+if (push !== 1) {
+ throw new Test262Error('#4: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#5: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -4) {
+ throw new Test262Error('#6: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4); obj["0"] === -4. Actual: ' + (obj["0"]));
+}
+
+obj.length = null
+var push = obj.push(-7);
+if (push !== 1) {
+ throw new Test262Error('#7: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#8: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -7) {
+ throw new Test262Error('#9: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7); obj["0"] === -7. Actual: ' + (obj["0"]));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T2.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T2.js
new file mode 100644
index 0000000000..2e35207c02
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T2.js
@@ -0,0 +1,101 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The push function is intentionally generic.
+ It does not require that its this value be an Array object
+esid: sec-array.prototype.push
+description: >
+ The arguments are appended to the end of the array, in the order
+ in which they appear. The new length of the array is returned as
+ the result of the call
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+
+obj.length = NaN;
+var push = obj.push(-1);
+if (push !== 1) {
+ throw new Test262Error('#1: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#2: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -1) {
+ throw new Test262Error('#3: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1); obj["0"] === -1. Actual: ' + (obj["0"]));
+}
+
+obj.length = Number.POSITIVE_INFINITY;
+assert.throws(TypeError, function() {
+ obj.push(-4);
+});
+
+if (obj.length !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#6: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-4); obj.length === Number.POSITIVE_INFINITY. Actual: ' + (obj.length));
+}
+
+if (obj[9007199254740991] !== undefined) {
+ throw new Test262Error('#6: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-4); obj[9007199254740991] === undefined. Actual: ' + (obj["9007199254740991"]));
+}
+
+obj.length = Number.NEGATIVE_INFINITY;
+var push = obj.push(-7);
+if (push !== 1) {
+ throw new Test262Error('#7: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#8: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -7) {
+ throw new Test262Error('#9: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7); obj["0"] === -7. Actual: ' + (obj["0"]));
+}
+
+obj.length = 0.5;
+var push = obj.push(-10);
+if (push !== 1) {
+ throw new Test262Error('#10: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#11: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -10) {
+ throw new Test262Error('#12: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10); obj["0"] === -10. Actual: ' + (obj["0"]));
+}
+
+obj.length = 1.5;
+var push = obj.push(-13);
+if (push !== 2) {
+ throw new Test262Error('#13: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13) === 2. Actual: ' + (push));
+}
+
+if (obj.length !== 2) {
+ throw new Test262Error('#14: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13); obj.length === 2. Actual: ' + (obj.length));
+}
+
+if (obj["1"] !== -13) {
+ throw new Test262Error('#15: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13); obj["1"] === -13. Actual: ' + (obj["1"]));
+}
+
+obj.length = new Number(0);
+var push = obj.push(-16);
+if (push !== 1) {
+ throw new Test262Error('#16: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16) === 1. Actual: ' + (push));
+}
+
+if (obj.length !== 1) {
+ throw new Test262Error('#17: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16); obj.length === 1. Actual: ' + (obj.length));
+}
+
+if (obj["0"] !== -16) {
+ throw new Test262Error('#18: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16); obj["0"] === -16. Actual: ' + (obj["0"]));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T3.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T3.js
new file mode 100644
index 0000000000..cec90447f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A2_T3.js
@@ -0,0 +1,120 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The push function is intentionally generic.
+ It does not require that its this value be an Array object
+esid: sec-array.prototype.push
+description: >
+ Operator use ToNumber from length. If Type(value) is Object,
+ evaluate ToPrimitive(value, Number)
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+
+obj.length = {
+ valueOf() {
+ return 3
+ }
+};
+var push = obj.push();
+assert.sameValue(push, 3, 'The value of push is expected to be 3');
+
+obj.length = {
+ valueOf() {
+ return 3
+ },
+ toString() {
+ return 1
+ }
+};
+var push = obj.push();
+assert.sameValue(push, 3, 'The value of push is expected to be 3');
+
+obj.length = {
+ valueOf() {
+ return 3
+ },
+ toString() {
+ return {}
+ }
+};
+var push = obj.push();
+assert.sameValue(push, 3, 'The value of push is expected to be 3');
+
+try {
+ obj.length = {
+ valueOf() {
+ return 3
+ },
+ toString() {
+ throw "error"
+ }
+ };
+ var push = obj.push();
+ assert.sameValue(push, 3, 'The value of push is expected to be 3');
+}
+catch (e) {
+ assert.notSameValue(e, "error", 'The value of e is not "error"');
+}
+
+obj.length = {
+ toString() {
+ return 1
+ }
+};
+var push = obj.push();
+assert.sameValue(push, 1, 'The value of push is expected to be 1');
+
+obj.length = {
+ valueOf() {
+ return {}
+ },
+ toString() {
+ return 1
+ }
+}
+var push = obj.push();
+assert.sameValue(push, 1, 'The value of push is expected to be 1');
+
+try {
+
+ obj.length = {
+ valueOf() {
+ throw "error"
+ },
+ toString() {
+ return 1
+ }
+ };
+ var push = obj.push();
+ throw new Test262Error('#7.1: obj.length = {valueOf() {throw "error"}, toString() {return 1}}; obj.push() throw "error". Actual: ' + (push));
+}
+catch (e) {
+ assert.sameValue(e, "error", 'The value of e is expected to be "error"');
+}
+
+try {
+
+ obj.length = {
+ valueOf() {
+ return {}
+ },
+ toString() {
+ return {}
+ }
+ };
+ var push = obj.push();
+ throw new Test262Error('#8.1: obj.length = {valueOf() {return {}}, toString() {return {}}} obj.push() throw TypeError. Actual: ' + (push));
+}
+catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A3.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A3.js
new file mode 100644
index 0000000000..cd918e0180
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A3.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Check ToLength(length) for Array object
+esid: sec-array.prototype.push
+description: If ToUint32(length) !== length, throw RangeError
+---*/
+
+var x = [];
+x.length = 4294967295;
+
+var push = x.push();
+assert.sameValue(push, 4294967295, 'The value of push is expected to be 4294967295');
+
+try {
+ x.push("x");
+ throw new Test262Error('#2.1: x = []; x.length = 4294967295; x.push("x") throw RangeError. Actual: ' + (push));
+} catch (e) {
+ assert.sameValue(
+ e instanceof RangeError,
+ true,
+ 'The result of evaluating (e instanceof RangeError) is expected to be true'
+ );
+}
+
+assert.sameValue(x[4294967295], "x", 'The value of x[4294967295] is expected to be "x"');
+assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T1.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T1.js
new file mode 100644
index 0000000000..4561b952fb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T1.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Check ToLength(length) for non Array objects
+esid: sec-array.prototype.push
+description: length = 4294967296
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+obj.length = 4294967296;
+
+var push = obj.push("x", "y", "z");
+if (push !== 4294967299) {
+ throw new Test262Error('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z") === 4294967299. Actual: ' + (push));
+}
+
+if (obj.length !== 4294967299) {
+ throw new Test262Error('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj.length === 4294967299. Actual: ' + (obj.length));
+}
+
+if (obj[0] !== undefined) {
+ throw new Test262Error('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[0] === undefined. Actual: ' + (obj[0]));
+}
+
+if (obj[1] !== undefined) {
+ throw new Test262Error('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[1] === undefined. Actual: ' + (obj[1]));
+}
+
+if (obj[2] !== undefined) {
+ throw new Test262Error('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[2] === undefined. Actual: ' + (obj[2]));
+}
+
+if (obj[4294967296] !== "x") {
+ throw new Test262Error('#6: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[4294967296] === "x". Actual: ' + (obj[4294967296]));
+}
+
+if (obj[4294967297] !== "y") {
+ throw new Test262Error('#7: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[4294967297] === "y". Actual: ' + (obj[4294967297]));
+}
+
+if (obj[4294967298] !== "z") {
+ throw new Test262Error('#8: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push("x", "y", "z"); obj[4294967298] === "z". Actual: ' + (obj[4294967298]));
+}
+
+var obj = {};
+obj.push = Array.prototype.push;
+obj.length = 4294967296;
+
+var push = obj.push();
+if (push !== 4294967296) {
+ throw new Test262Error('#9: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push() === 4294967296. Actual: ' + (push));
+}
+
+if (obj.length !== 4294967296) {
+ throw new Test262Error('#10: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(); obj.length === 4294967296. Actual: ' + (obj.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T2.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T2.js
new file mode 100644
index 0000000000..4beecec82a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T2.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Check ToLength(length) for non Array objects
+esid: sec-array.prototype.push
+description: length = 4294967295
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+obj.length = 4294967295;
+
+var push = obj.push("x", "y", "z");
+if (push !== 4294967298) {
+ throw new Test262Error('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z") === 4294967298. Actual: ' + (push));
+}
+
+if (obj.length !== 4294967298) {
+ throw new Test262Error('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z"); obj.length === 4294967298. Actual: ' + (obj.length));
+}
+
+if (obj[4294967295] !== "x") {
+ throw new Test262Error('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z"); obj[4294967295] === "x". Actual: ' + (obj[4294967295]));
+}
+
+if (obj[4294967296] !== "y") {
+ throw new Test262Error('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z"); obj[4294967296] === "y". Actual: ' + (obj[4294967296]));
+}
+
+if (obj[4294967297] !== "z") {
+ throw new Test262Error('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z"); obj[4294967297] === "z". Actual: ' + (obj[4294967297]));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T3.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T3.js
new file mode 100644
index 0000000000..54fd4df676
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A4_T3.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Check ToLength(length) for non Array objects
+esid: sec-array.prototype.push
+description: length = -1
+---*/
+
+var obj = {};
+obj.push = Array.prototype.push;
+obj.length = -1;
+
+var push = obj.push("x", "y", "z");
+if (push !== 3) {
+ throw new Test262Error('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z") === 3. Actual: ' + (push));
+}
+
+if (obj.length !== 3) {
+ throw new Test262Error('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj.length === 3. Actual: ' + (obj.length));
+}
+
+if (obj[4294967295] !== undefined) {
+ throw new Test262Error('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[4294967295] === undefined. Actual: ' + (obj[4294967295]));
+}
+
+if (obj[4294967296] !== undefined) {
+ throw new Test262Error('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[4294967296] === undefined. Actual: ' + (obj[4294967296]));
+}
+
+if (obj[4294967297] !== undefined) {
+ throw new Test262Error('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[4294967297] === undefined. Actual: ' + (obj[4294967297]));
+}
+
+if (obj[0] !== "x") {
+ throw new Test262Error('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[0] === "x". Actual: ' + (obj[0]));
+}
+
+if (obj[1] !== "y") {
+ throw new Test262Error('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[1] === "y". Actual: ' + (obj[1]));
+}
+
+if (obj[2] !== "z") {
+ throw new Test262Error('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push("x", "y", "z"); obj[2] === "z". Actual: ' + (obj[2]));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A5_T1.js b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A5_T1.js
new file mode 100644
index 0000000000..d124babebf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/S15.4.4.7_A5_T1.js
@@ -0,0 +1,42 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "[[Get]] from not an inherited property"
+esid: sec-array.prototype.push
+description: >
+ [[Prototype]] of Array instance is Array.prototype, [[Prototype]
+ of Array.prototype is Object.prototype
+---*/
+
+Object.prototype[1] = -1;
+Object.prototype.length = 1;
+Object.prototype.push = Array.prototype.push;
+var x = {
+ 0: 0
+};
+
+var push = x.push(1);
+if (push !== 2) {
+ throw new Test262Error('#1: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1) === 2. Actual: ' + (push));
+}
+
+if (x.length !== 2) {
+ throw new Test262Error('#2: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); x.length === 2. Actual: ' + (x.length));
+}
+
+if (x[1] !== 1) {
+ throw new Test262Error('#3: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); x[1] === 1. Actual: ' + (x[1]));
+}
+
+delete x[1];
+if (x[1] !== -1) {
+ throw new Test262Error('#4: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); delete x[1]; x[1] === -1. Actual: ' + (x[1]));
+}
+
+delete x.length;
+if (x.length !== 1) {
+ throw new Test262Error('#5: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; delete x; x.push(1); x.length === 1. Actual: ' + (x.length));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/browser.js b/js/src/tests/test262/built-ins/Array/prototype/push/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/browser.js
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/call-with-boolean.js b/js/src/tests/test262/built-ins/Array/prototype/push/call-with-boolean.js
new file mode 100644
index 0000000000..d6831e0a89
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/call-with-boolean.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: Array.prototype.push applied to boolean primitive
+---*/
+
+assert.sameValue(Array.prototype.push.call(true), 0, 'Array.prototype.push.call(true) must return 0');
+assert.sameValue(Array.prototype.push.call(false), 0, 'Array.prototype.push.call(false) must return 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/clamps-to-integer-limit.js b/js/src/tests/test262/built-ins/Array/prototype/push/clamps-to-integer-limit.js
new file mode 100644
index 0000000000..6466a0a5e0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/clamps-to-integer-limit.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ Length values exceeding 2^53-1 are clamped to 2^53-1.
+info: |
+ 1. ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. Let items be a List whose elements are, in left to right order, the arguments
+ that were passed to this function invocation.
+ 4. Let argCount be the number of elements in items.
+ ...
+ 7. Perform ? Set(O, "length", len, true).
+ ...
+features: [exponentiation]
+---*/
+
+var arrayLike = {};
+
+arrayLike.length = 2 ** 53 - 1;
+Array.prototype.push.call(arrayLike);
+assert.sameValue(arrayLike.length, 2 ** 53 - 1, "Length is 2**53 - 1");
+
+arrayLike.length = 2 ** 53;
+Array.prototype.push.call(arrayLike);
+assert.sameValue(arrayLike.length, 2 ** 53 - 1, "Length is 2**53");
+
+arrayLike.length = 2 ** 53 + 2;
+Array.prototype.push.call(arrayLike);
+assert.sameValue(arrayLike.length, 2 ** 53 - 1, "Length is 2**53 + 2");
+
+arrayLike.length = Infinity;
+Array.prototype.push.call(arrayLike);
+assert.sameValue(arrayLike.length, 2 ** 53 - 1, "Length is Infinity");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit-set-failure.js b/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit-set-failure.js
new file mode 100644
index 0000000000..8ecd9486cb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit-set-failure.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ A value is inserted in an array-like object whose length property is near the integer limit.
+ Unsuccessful [[Set]] raises a TypeError.
+info: |
+ Array.prototype.push ( ...items )
+
+ [...]
+ 2. Let len be ? LengthOfArrayLike(O).
+ [...]
+ 4. Let argCount be the number of elements in items.
+ [...]
+ 6. Repeat, while items is not empty,
+ a. Remove the first element from items and let E be the value of the element.
+ b. Perform ? Set(O, ! ToString(len), E, true).
+ c. Set len to len + 1.
+ [...]
+
+ OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
+
+ [...]
+ 3. If IsDataDescriptor(ownDesc) is true, then
+ a. If ownDesc.[[Writable]] is false, return false.
+---*/
+
+var arrayLike = {
+ length: Number.MAX_SAFE_INTEGER - 3,
+};
+
+Object.defineProperty(arrayLike, Number.MAX_SAFE_INTEGER - 1, {
+ value: 33,
+ writable: false,
+ enumerable: true,
+ configurable: true,
+});
+
+assert.throws(TypeError, function() {
+ Array.prototype.push.call(arrayLike, 1, 2, 3);
+});
+
+assert.sameValue(arrayLike[Number.MAX_SAFE_INTEGER - 3], 1);
+assert.sameValue(arrayLike[Number.MAX_SAFE_INTEGER - 2], 2);
+assert.sameValue(arrayLike[Number.MAX_SAFE_INTEGER - 1], 33);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit.js b/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit.js
new file mode 100644
index 0000000000..a947b29bad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/length-near-integer-limit.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ A value is inserted in an array-like object whose length property is near the integer limit.
+info: |
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. Let items be a List whose elements are, in left to right order, the
+ arguments that were passed to this function invocation.
+ ...
+ 5. Repeat, while items is not empty
+ ...
+ 7. Perform ? Set(O, "length", len, true).
+ ...
+features: [exponentiation]
+---*/
+
+var arrayLike = {
+ "9007199254740989": "9007199254740989",
+ /* "9007199254740990": empty */
+ "9007199254740991": "9007199254740991",
+ length: 2 ** 53 - 2
+};
+
+Array.prototype.push.call(arrayLike, "new-value");
+
+assert.sameValue(arrayLike.length, 2 ** 53 - 1,
+ "New arrayLike.length is 2**53 - 1");
+
+assert.sameValue(arrayLike["9007199254740989"], "9007199254740989",
+ "arrayLike['9007199254740989'] is unchanged");
+
+assert.sameValue(arrayLike["9007199254740990"], "new-value",
+ "arrayLike['9007199254740990'] has new value");
+
+assert.sameValue(arrayLike["9007199254740991"], "9007199254740991",
+ "arrayLike['9007199254740991'] is unchanged");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/length.js b/js/src/tests/test262/built-ins/Array/prototype/push/length.js
new file mode 100644
index 0000000000..d503ab3cfa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ The "length" property of Array.prototype.push
+info: |
+ 22.1.3.18 Array.prototype.push ( ...items )
+
+ The length property of the push method is 1.
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Every built-in function object, including constructors, has a length property
+ whose value is an integer. Unless otherwise specified, this value is equal to
+ the largest number of named arguments shown in the subclause headings for the
+ function description. Optional parameters (which are indicated with brackets:
+ [ ]) or rest parameters (which are shown using the form «...name») are not
+ included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in function object
+ has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Array.prototype.push.length, 1);
+
+verifyNotEnumerable(Array.prototype.push, 'length');
+verifyNotWritable(Array.prototype.push, 'length');
+verifyConfigurable(Array.prototype.push, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/name.js b/js/src/tests/test262/built-ins/Array/prototype/push/name.js
new file mode 100644
index 0000000000..42e2e96314
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ Array.prototype.push.name is "push".
+info: |
+ Array.prototype.push ( ...items )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Array.prototype.push.name, "push");
+
+verifyNotEnumerable(Array.prototype.push, "name");
+verifyNotWritable(Array.prototype.push, "name");
+verifyConfigurable(Array.prototype.push, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/not-a-constructor.js b/js/src/tests/test262/built-ins/Array/prototype/push/not-a-constructor.js
new file mode 100644
index 0000000000..291b72867d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/not-a-constructor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Array.prototype.push does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Array.prototype.push), false, 'isConstructor(Array.prototype.push) must return false');
+
+assert.throws(TypeError, () => {
+ new Array.prototype.push();
+}, '`new Array.prototype.push()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/prop-desc.js b/js/src/tests/test262/built-ins/Array/prototype/push/prop-desc.js
new file mode 100644
index 0000000000..4f739aa30a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/prop-desc.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ "push" property of Array.prototype
+info: |
+ 17 ECMAScript Standard Built-in Objects
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2
+ has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(typeof Array.prototype.push, 'function', 'typeof');
+
+verifyNotEnumerable(Array.prototype, "push");
+verifyWritable(Array.prototype, "push");
+verifyConfigurable(Array.prototype, "push");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-is-frozen.js b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-is-frozen.js
new file mode 100644
index 0000000000..09aa72f52f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-is-frozen.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2022 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.push
+description: >
+ A TypeError is thrown when "length" is [[Set]] on a frozen array.
+info: |
+ Array.prototype.push ( ...items )
+
+ [...]
+ 5. For each element E of items, do
+ a. Perform ? Set(O, ! ToString(𝔽(len)), E, true).
+ b. Set len to len + 1.
+ 6. Perform ? Set(O, "length", 𝔽(len), true).
+
+ OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
+
+ [...]
+ 2. If IsDataDescriptor(ownDesc) is true, then
+ a. If ownDesc.[[Writable]] is false, return false.
+
+ Set ( O, P, V, Throw )
+
+ [...]
+ 1. Let success be ? O.[[Set]](P, V, O).
+ 2. If success is false and Throw is true, throw a TypeError exception.
+---*/
+
+var array = [];
+var arrayPrototypeSet0Calls = 0;
+
+Object.defineProperty(Array.prototype, "0", {
+ set(_val) {
+ Object.freeze(array);
+ arrayPrototypeSet0Calls++;
+ },
+});
+
+assert.throws(TypeError, function() {
+ array.push(1);
+});
+
+assert(!array.hasOwnProperty(0));
+assert.sameValue(array.length, 0);
+assert.sameValue(arrayPrototypeSet0Calls, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-length-is-non-writable.js b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-length-is-non-writable.js
new file mode 100644
index 0000000000..4e8ba1d821
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-array-length-is-non-writable.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2022 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.push
+description: >
+ A TypeError is thrown when "length" is [[Set]] on an array with non-writable "length".
+info: |
+ Array.prototype.push ( ...items )
+
+ [...]
+ 5. For each element E of items, do
+ a. Perform ? Set(O, ! ToString(𝔽(len)), E, true).
+ b. Set len to len + 1.
+ 6. Perform ? Set(O, "length", 𝔽(len), true).
+
+ OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
+
+ [...]
+ 2. If IsDataDescriptor(ownDesc) is true, then
+ a. If ownDesc.[[Writable]] is false, return false.
+
+ Set ( O, P, V, Throw )
+
+ [...]
+ 1. Let success be ? O.[[Set]](P, V, O).
+ 2. If success is false and Throw is true, throw a TypeError exception.
+---*/
+
+var array = [];
+var arrayPrototypeSet0Calls = 0;
+
+Object.defineProperty(Array.prototype, "0", {
+ set(_val) {
+ Object.defineProperty(array, "length", { writable: false });
+ arrayPrototypeSet0Calls++;
+ },
+});
+
+assert.throws(TypeError, function() {
+ array.push(1);
+});
+
+assert(!array.hasOwnProperty(0));
+assert.sameValue(array.length, 0);
+assert.sameValue(arrayPrototypeSet0Calls, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-is-frozen.js b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-is-frozen.js
new file mode 100644
index 0000000000..a2bb89fa1f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-is-frozen.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2022 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.push
+description: >
+ A TypeError is thrown when "length" is [[Set]] on an empty frozen array.
+info: |
+ Array.prototype.push ( ...items )
+
+ [...]
+ 2. Let len be ? LengthOfArrayLike(O).
+ [...]
+ 6. Perform ? Set(O, "length", 𝔽(len), true).
+
+ OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
+
+ [...]
+ 2. If IsDataDescriptor(ownDesc) is true, then
+ a. If ownDesc.[[Writable]] is false, return false.
+
+ Set ( O, P, V, Throw )
+
+ [...]
+ 1. Let success be ? O.[[Set]](P, V, O).
+ 2. If success is false and Throw is true, throw a TypeError exception.
+---*/
+
+var array = [];
+Object.freeze(array);
+
+assert.throws(TypeError, function() {
+ array.push();
+});
+
+assert(!array.hasOwnProperty(0));
+assert.sameValue(array.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-length-is-non-writable.js b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-length-is-non-writable.js
new file mode 100644
index 0000000000..43527e8569
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/set-length-zero-array-length-is-non-writable.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2022 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.push
+description: >
+ A TypeError is thrown when "length" is [[Set]] on an empty array with non-writable "length".
+info: |
+ Array.prototype.push ( ...items )
+
+ [...]
+ 2. Let len be ? LengthOfArrayLike(O).
+ [...]
+ 6. Perform ? Set(O, "length", 𝔽(len), true).
+
+ OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc )
+
+ [...]
+ 2. If IsDataDescriptor(ownDesc) is true, then
+ a. If ownDesc.[[Writable]] is false, return false.
+
+ Set ( O, P, V, Throw )
+
+ [...]
+ 1. Let success be ? O.[[Set]](P, V, O).
+ 2. If success is false and Throw is true, throw a TypeError exception.
+---*/
+
+var array = [];
+Object.defineProperty(array, "length", { writable: false });
+
+assert.throws(TypeError, function() {
+ array.push();
+});
+
+assert(!array.hasOwnProperty(0));
+assert.sameValue(array.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/shell.js b/js/src/tests/test262/built-ins/Array/prototype/push/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/shell.js
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/throws-if-integer-limit-exceeded.js b/js/src/tests/test262/built-ins/Array/prototype/push/throws-if-integer-limit-exceeded.js
new file mode 100644
index 0000000000..f2dbabc549
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/throws-if-integer-limit-exceeded.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.push
+description: >
+ A TypeError is thrown if the new length exceeds 2^53-1.
+info: |
+ 1. ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. Let items be a List whose elements are, in left to right order, the arguments
+ that were passed to this function invocation.
+ 4. Let argCount be the number of elements in items.
+ 5. If len + argCount > 2^53-1, throw a TypeError exception.
+ ...
+features: [exponentiation]
+---*/
+
+var arrayLike = {};
+
+arrayLike.length = 2 ** 53 - 1;
+assert.throws(TypeError, function() {
+ Array.prototype.push.call(arrayLike, null);
+}, "Length is 2**53 - 1");
+
+arrayLike.length = 2 ** 53;
+assert.throws(TypeError, function() {
+ Array.prototype.push.call(arrayLike, null);
+}, "Length is 2**53");
+
+arrayLike.length = 2 ** 53 + 2;
+assert.throws(TypeError, function() {
+ Array.prototype.push.call(arrayLike, null);
+}, "Length is 2**53 + 2");
+
+arrayLike.length = Infinity;
+assert.throws(TypeError, function() {
+ Array.prototype.push.call(arrayLike, null);
+}, "Length is Infinity");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/push/throws-with-string-receiver.js b/js/src/tests/test262/built-ins/Array/prototype/push/throws-with-string-receiver.js
new file mode 100644
index 0000000000..23805127a6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/push/throws-with-string-receiver.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.push
+description: >
+ Array#push throws TypeError upon attempting to modify a string
+info: |
+ Array.prototype.push ( ...items )
+ ...
+ 6. Repeat, while items is not empty
+ ...
+ b. Perform ? Set(O, ! ToString(len), E, true).
+ ...
+ 7. Perform ? Set(O, "length", len, true).
+
+ Set ( O, P, V, Throw )
+ ...
+ 4. Let success be ? O.[[Set]](P, V, O).
+ 5. If success is false and Throw is true, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, () => {
+ Array.prototype.push.call('');
+}, "Array.prototype.push.call('')");
+
+assert.throws(TypeError, () => {
+ Array.prototype.push.call('', 1);
+}, "Array.prototype.push.call('', 1)");
+
+assert.throws(TypeError, () => {
+ Array.prototype.push.call('abc');
+}, "Array.prototype.push.call('abc')");
+
+assert.throws(TypeError, () => {
+ Array.prototype.push.call('abc', 1);
+}, "Array.prototype.push.call('abc', 1)");
+
+reportCompare(0, 0);