summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/ArrayBuffer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/ArrayBuffer
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/ArrayBuffer')
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/length.js34
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/return-value.js16
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species-name.js27
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/allocation-limit.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/data-allocation-after-object-creation.js40
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/init-zero.js36
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/is-a-constructor.js26
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-has-no-viewedarraybuffer.js19
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-arraybuffer.js20
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-buffer.js21
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-constructor.js19
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview.js21
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-not-object.js20
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js22
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js26
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js31
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/length.js31
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/name.js28
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/no-arg.js17
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/prop-desc.js19
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/isView/shell.js124
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/length-is-absent.js20
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/length-is-too-large-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/length.js35
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/name.js30
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/negative-length-throws.js36
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/newtarget-prototype-is-not-object.js50
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prop-desc.js25
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/proto-from-ctor-realm.js29
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype-from-newtarget.js36
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js21
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-accessor.js20
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-func.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/length.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/name.js29
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/prop-desc.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/return-bytelength.js20
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/shell.js18
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-has-no-typedarrayname-internal.js41
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-not-object.js48
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer.js27
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js25
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-object.js41
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/descriptor.js22
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-absent.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-undefined.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-exceeds-length.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/extensible.js18
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/length.js31
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/name.js28
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-end.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-start.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/nonconstructor.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/number-conversion.js39
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-not-object.js47
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-undefined.js30
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-constructor.js41
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-object.js47
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-null.js34
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-undefined.js34
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js35
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js34
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species.js34
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-absent.js22
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-undefined.js24
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-end.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-length.js33
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer.js17
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-end.js29
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-start.js29
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length.js26
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/shell.js19
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/toindex-length.js89
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/undefined-newtarget-throws.js25
-rw-r--r--js/src/tests/test262/built-ins/ArrayBuffer/zero-length.js25
95 files changed, 2597 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/length.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/length.js
new file mode 100644
index 0000000000..3d44fa0cae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-arraybuffer-@@species
+description: >
+ get ArrayBuffer [ @@species ].length is 0.
+info: |
+ get ArrayBuffer [ @@species ]
+
+ 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, including optional
+ parameters. However, rest parameters 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]
+features: [Symbol.species]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
+
+assert.sameValue(desc.get.length, 0);
+
+verifyNotEnumerable(desc.get, "length");
+verifyNotWritable(desc.get, "length");
+verifyConfigurable(desc.get, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/return-value.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/return-value.js
new file mode 100644
index 0000000000..607473f7b2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/return-value.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer-@@species
+description: Return value of @@species accessor method
+info: |
+ 1. Return the this value.
+features: [Symbol.species]
+---*/
+
+var thisVal = {};
+var accessor = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species).get;
+
+assert.sameValue(accessor.call(thisVal), thisVal);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/shell.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species-name.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species-name.js
new file mode 100644
index 0000000000..2d9d0eb3e8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species-name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer-@@species
+description: >
+ ArrayBuffer[Symbol.species] accessor property get name
+info: |
+ 24.1.3.3 get ArrayBuffer [ @@species ]
+
+ ...
+ The value of the name property of this function is "get [Symbol.species]".
+features: [Symbol.species]
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
+
+assert.sameValue(
+ descriptor.get.name,
+ 'get [Symbol.species]'
+);
+
+verifyNotEnumerable(descriptor.get, 'name');
+verifyNotWritable(descriptor.get, 'name');
+verifyConfigurable(descriptor.get, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species.js b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species.js
new file mode 100644
index 0000000000..8c01389acb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/Symbol.species/symbol-species.js
@@ -0,0 +1,23 @@
+// Copyright 2015 Cubane Canada, Inc. All rights reserved.
+// See LICENSE for details.
+
+/*---
+info: |
+ ArrayBuffer has a property at `Symbol.species`
+esid: sec-get-arraybuffer-@@species
+author: Sam Mikes
+description: ArrayBuffer[Symbol.species] exists per spec
+features: [ArrayBuffer, Symbol.species]
+includes: [propertyHelper.js]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, 'function');
+
+verifyNotWritable(ArrayBuffer, Symbol.species, Symbol.species);
+verifyNotEnumerable(ArrayBuffer, Symbol.species);
+verifyConfigurable(ArrayBuffer, Symbol.species);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/allocation-limit.js b/js/src/tests/test262/built-ins/ArrayBuffer/allocation-limit.js
new file mode 100644
index 0000000000..3f312139c8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/allocation-limit.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Throws a RangeError if requested Data Block is too large.
+info: |
+ ArrayBuffer( length )
+
+ ...
+ 6. Return AllocateArrayBuffer(NewTarget, byteLength).
+
+ 6.2.6.1 CreateByteDataBlock(size)
+ ...
+ 2. Let db be a new Data Block value consisting of size bytes. If it is
+ impossible to create such a Data Block, throw a RangeError exception.
+ ...
+---*/
+
+assert.throws(RangeError, function() {
+ // Allocating 7 PiB should fail with a RangeError.
+ // Math.pow(1024, 5) = 1125899906842624
+ new ArrayBuffer(7 * 1125899906842624);
+}, "`length` parameter is 7 PiB");
+
+assert.throws(RangeError, function() {
+ // Allocating almost 8 PiB should fail with a RangeError.
+ // Math.pow(2, 53) = 9007199254740992
+ new ArrayBuffer(9007199254740992 - 1);
+}, "`length` parameter is Math.pow(2, 53) - 1");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/data-allocation-after-object-creation.js b/js/src/tests/test262/built-ins/ArrayBuffer/data-allocation-after-object-creation.js
new file mode 100644
index 0000000000..503f46d016
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/data-allocation-after-object-creation.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ The new ArrayBuffer instance is created prior to allocating the Data Block.
+info: |
+ ArrayBuffer( length )
+
+ ...
+ 6. Return AllocateArrayBuffer(NewTarget, byteLength).
+
+ AllocateArrayBuffer( constructor, byteLength )
+ 1. Let obj be OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%",
+ «[[ArrayBufferData]], [[ArrayBufferByteLength]]» ).
+ 2. ReturnIfAbrupt(obj).
+ ...
+ 4. Let block be CreateByteDataBlock(byteLength).
+ 5. ReturnIfAbrupt(block).
+ ...
+features: [Reflect.construct]
+---*/
+
+function DummyError() {}
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get: function() {
+ throw new DummyError();
+ }
+});
+
+assert.throws(DummyError, function() {
+ // Allocating 7 PiB should fail with a RangeError.
+ // Math.pow(1024, 5) = 1125899906842624
+ Reflect.construct(ArrayBuffer, [7 * 1125899906842624], newTarget);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/init-zero.js b/js/src/tests/test262/built-ins/ArrayBuffer/init-zero.js
new file mode 100644
index 0000000000..9acfb446cb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/init-zero.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-arraybuffer-length
+description: All bytes are initialized to zero
+info: |
+ [...]
+ 5. Return ? AllocateArrayBuffer(NewTarget, byteLength).
+
+ 24.1.1.1 AllocateArrayBuffer
+
+ 3. Let block be ? CreateByteDataBlock(byteLength).
+
+ 6.2.6.1 CreateByteDataBlock
+
+ 1. Assert: size≥0.
+ 2. Let db be a new Data Block value consisting of size bytes. If it is
+ impossible to create such a Data Block, throw a RangeError exception.
+ 3. Set all of the bytes of db to 0.
+ 4. Return db.
+features: [DataView]
+---*/
+
+var view = new DataView(new ArrayBuffer(9));
+
+assert.sameValue(view.getUint8(0), 0, 'index 0');
+assert.sameValue(view.getUint8(1), 0, 'index 1');
+assert.sameValue(view.getUint8(2), 0, 'index 2');
+assert.sameValue(view.getUint8(3), 0, 'index 3');
+assert.sameValue(view.getUint8(4), 0, 'index 4');
+assert.sameValue(view.getUint8(5), 0, 'index 5');
+assert.sameValue(view.getUint8(6), 0, 'index 6');
+assert.sameValue(view.getUint8(7), 0, 'index 7');
+assert.sameValue(view.getUint8(8), 0, 'index 8');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/is-a-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/is-a-constructor.js
new file mode 100644
index 0000000000..565da68608
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/is-a-constructor.js
@@ -0,0 +1,26 @@
+// 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: >
+ The ArrayBuffer constructor implements [[Construct]]
+info: |
+ IsConstructor ( argument )
+
+ The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
+ It determines if argument is a function object with a [[Construct]] internal method.
+ It performs the following steps when called:
+
+ If Type(argument) is not Object, return false.
+ If argument has a [[Construct]] internal method, return true.
+ Return false.
+includes: [isConstructor.js]
+features: [Reflect.construct, ArrayBuffer]
+---*/
+
+assert.sameValue(isConstructor(ArrayBuffer), true, 'isConstructor(ArrayBuffer) must return true');
+new ArrayBuffer();
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-has-no-viewedarraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-has-no-viewedarraybuffer.js
new file mode 100644
index 0000000000..28138d45e3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-has-no-viewedarraybuffer.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false if arg has no [[ViewedArrayBuffer]] internal slot.
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+---*/
+
+assert.sameValue(ArrayBuffer.isView({}), false, "ordinary object");
+assert.sameValue(ArrayBuffer.isView([]), false, "Array");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-arraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-arraybuffer.js
new file mode 100644
index 0000000000..2ca8a2d1ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-arraybuffer.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false from an instance of ArrayBuffer
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+---*/
+
+var sample = new ArrayBuffer(1);
+
+assert.sameValue(ArrayBuffer.isView(sample), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-buffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-buffer.js
new file mode 100644
index 0000000000..2b59775a4b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false from DataView's instance `.buffer`
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [DataView]
+---*/
+
+var sample = new DataView(new ArrayBuffer(1), 0, 0).buffer;
+
+assert.sameValue(ArrayBuffer.isView(sample), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-constructor.js
new file mode 100644
index 0000000000..1095947f70
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-constructor.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false if arg is the DataView constructor
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [DataView]
+---*/
+
+assert.sameValue(ArrayBuffer.isView(DataView), false, "DataView");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js
new file mode 100644
index 0000000000..727e318f0d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return true if arg is an instance from a subclass of DataView
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [class, DataView]
+---*/
+
+class DV extends DataView {}
+
+var sample = new DV(new ArrayBuffer(1), 0, 0);
+
+assert(ArrayBuffer.isView(sample));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview.js
new file mode 100644
index 0000000000..ab145cf6cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-dataview.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return true if is an instance of DataView
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [DataView]
+---*/
+
+var sample = new DataView(new ArrayBuffer(1), 0, 0);
+
+assert.sameValue(ArrayBuffer.isView(sample), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-not-object.js
new file mode 100644
index 0000000000..3fc13f5b05
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-not-object.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false if arg is not Object
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ ...
+---*/
+
+assert.sameValue(ArrayBuffer.isView(null), false, "null");
+assert.sameValue(ArrayBuffer.isView(undefined), false, "undefined");
+assert.sameValue(ArrayBuffer.isView(1), false, "number");
+assert.sameValue(ArrayBuffer.isView(""), false, "string");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js
new file mode 100644
index 0000000000..9e8918b388
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false from TypedArray's instance `.buffer`
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [TypedArray]
+includes: [testTypedArray.js]
+---*/
+
+testWithTypedArrayConstructors(function(ctor) {
+ var sample = new ctor().buffer;
+
+ assert.sameValue(ArrayBuffer.isView(sample), false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js
new file mode 100644
index 0000000000..efd5d16984
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false if arg is a TypedArray constructor
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [TypedArray]
+includes: [testTypedArray.js]
+---*/
+
+testWithTypedArrayConstructors(function(ctor) {
+ assert.sameValue(ArrayBuffer.isView(ctor), false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js
new file mode 100644
index 0000000000..3d17140d0f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return true if arg is an instance from a subclass of TypedArray
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [class, TypedArray]
+includes: [testTypedArray.js]
+---*/
+
+testWithTypedArrayConstructors(function(ctor) {
+ class TA extends ctor {}
+
+ var sample = new TA();
+
+ assert(ArrayBuffer.isView(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray.js
new file mode 100644
index 0000000000..78cbfbbf61
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/arg-is-typedarray.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return true if arg is an instance of TypedArray
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [TypedArray]
+includes: [testTypedArray.js]
+---*/
+
+testWithTypedArrayConstructors(function(ctor) {
+ var sample = new ctor();
+
+ assert.sameValue(ArrayBuffer.isView(sample), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js
new file mode 100644
index 0000000000..e58a330cdb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ `isView` can be invoked as a function
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
+ 3. Return false.
+features: [TypedArray, DataView]
+includes: [testTypedArray.js]
+---*/
+
+var isView = ArrayBuffer.isView;
+
+testWithTypedArrayConstructors(function(ctor) {
+ var sample = new ctor();
+ assert.sameValue(isView(sample), true, "instance of TypedArray");
+});
+
+var dv = new DataView(new ArrayBuffer(1), 0, 0);
+assert.sameValue(isView(dv), true, "instance of DataView");
+
+assert.sameValue(isView(), false, "undefined arg");
+assert.sameValue(isView({}), false, "ordinary object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/length.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/length.js
new file mode 100644
index 0000000000..d74f5ab42d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/length.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ ArrayBuffer.isView.length is 1.
+info: |
+ ArrayBuffer.isView ( arg )
+
+ 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, including optional
+ parameters. However, rest parameters 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(ArrayBuffer.isView.length, 1);
+
+verifyNotEnumerable(ArrayBuffer.isView, "length");
+verifyNotWritable(ArrayBuffer.isView, "length");
+verifyConfigurable(ArrayBuffer.isView, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/name.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/name.js
new file mode 100644
index 0000000000..e8ef8b04e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/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-arraybuffer.isview
+description: >
+ ArrayBuffer.isView.name is "isView".
+info: |
+ ArrayBuffer.isView ( arg )
+
+ 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(ArrayBuffer.isView.name, "isView");
+
+verifyNotEnumerable(ArrayBuffer.isView, "name");
+verifyNotWritable(ArrayBuffer.isView, "name");
+verifyConfigurable(ArrayBuffer.isView, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/no-arg.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/no-arg.js
new file mode 100644
index 0000000000..c3b747b7bf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/no-arg.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2016 The V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ Return false if isView is called with no arg
+info: |
+ 24.1.3.1 ArrayBuffer.isView ( arg )
+
+ 1. If Type(arg) is not Object, return false.
+ ...
+---*/
+
+assert.sameValue(ArrayBuffer.isView(), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/not-a-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/not-a-constructor.js
new file mode 100644
index 0000000000..09f8d71685
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/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: >
+ ArrayBuffer.isView 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, ArrayBuffer, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(ArrayBuffer.isView), false, 'isConstructor(ArrayBuffer.isView) must return false');
+
+assert.throws(TypeError, () => {
+ new ArrayBuffer.isView();
+}, '`new ArrayBuffer.isView()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/prop-desc.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/prop-desc.js
new file mode 100644
index 0000000000..3eebf6ed54
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.isview
+description: >
+ "isView" property of ArrayBuffer
+info: |
+ ES6 section 17: 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]
+---*/
+
+verifyNotEnumerable(ArrayBuffer, "isView");
+verifyWritable(ArrayBuffer, "isView");
+verifyConfigurable(ArrayBuffer, "isView");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/isView/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/isView/shell.js
new file mode 100644
index 0000000000..e9580b3113
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/isView/shell.js
@@ -0,0 +1,124 @@
+// GENERATED, DO NOT EDIT
+// file: testTypedArray.js
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Collection of functions used to assert the correctness of TypedArray objects.
+defines:
+ - typedArrayConstructors
+ - floatArrayConstructors
+ - intArrayConstructors
+ - TypedArray
+ - testWithTypedArrayConstructors
+ - testWithAtomicsFriendlyTypedArrayConstructors
+ - testWithNonAtomicsFriendlyTypedArrayConstructors
+ - testTypedArrayConversions
+---*/
+
+/**
+ * Array containing every typed array constructor.
+ */
+var typedArrayConstructors = [
+ Float64Array,
+ Float32Array,
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ Uint8ClampedArray
+];
+
+var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
+var intArrayConstructors = typedArrayConstructors.slice(2, 7);
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * Callback for testing a typed array constructor.
+ *
+ * @callback typedArrayConstructorCallback
+ * @param {Function} Constructor the constructor object to test with.
+ */
+
+/**
+ * Calls the provided function for every typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithTypedArrayConstructors(f, selected) {
+ var constructors = selected || typedArrayConstructors;
+ for (var i = 0; i < constructors.length; ++i) {
+ var constructor = constructors[i];
+ try {
+ f(constructor);
+ } catch (e) {
+ e.message += " (Testing with " + constructor.name + ".)";
+ throw e;
+ }
+ }
+}
+
+/**
+ * Calls the provided function for every non-"Atomics Friendly" typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithNonAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Float64Array,
+ Float32Array,
+ Uint8ClampedArray
+ ]);
+}
+
+/**
+ * Calls the provided function for every "Atomics Friendly" typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ ]);
+}
+
+/**
+ * Helper for conversion operations on TypedArrays, the expected values
+ * properties are indexed in order to match the respective value for each
+ * TypedArray constructor
+ * @param {Function} fn - the function to call for each constructor and value.
+ * will be called with the constructor, value, expected
+ * value, and a initial value that can be used to avoid
+ * a false positive with an equivalent expected value.
+ */
+function testTypedArrayConversions(byteConversionValues, fn) {
+ var values = byteConversionValues.values;
+ var expected = byteConversionValues.expected;
+
+ testWithTypedArrayConstructors(function(TA) {
+ var name = TA.name.slice(0, -5);
+
+ return values.forEach(function(value, index) {
+ var exp = expected[name][index];
+ var initial = 0;
+ if (exp === 0) {
+ initial = 1;
+ }
+ fn(TA, value, exp, initial);
+ });
+ });
+}
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/length-is-absent.js b/js/src/tests/test262/built-ins/ArrayBuffer/length-is-absent.js
new file mode 100644
index 0000000000..e7774f79ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/length-is-absent.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Returns an empty instance if length is absent
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+ 3. Return ? AllocateArrayBuffer(NewTarget, byteLength).
+---*/
+
+var buffer = new ArrayBuffer();
+
+assert.sameValue(buffer.byteLength, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/length-is-too-large-throws.js b/js/src/tests/test262/built-ins/ArrayBuffer/length-is-too-large-throws.js
new file mode 100644
index 0000000000..8a18f0c134
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/length-is-too-large-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Throws a RangeError if length >= 2 ** 53
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+
+ ToIndex( value )
+
+ 1. If value is undefined, then
+ a. Let index be 0.
+ 2. Else,
+ a. Let integerIndex be ? ToInteger(value).
+ b. If integerIndex < 0, throw a RangeError exception.
+ ...
+---*/
+
+assert.throws(RangeError, function() {
+ // Math.pow(2, 53) = 9007199254740992
+ new ArrayBuffer(9007199254740992);
+}, "`length` parameter is too large");
+
+assert.throws(RangeError, function() {
+ new ArrayBuffer(Infinity);
+}, "`length` parameter is positive Infinity");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/length.js b/js/src/tests/test262/built-ins/ArrayBuffer/length.js
new file mode 100644
index 0000000000..b1c3e096bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/length.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-constructor
+description: >
+ ArrayBuffer.length is 1.
+info: |
+ ArrayBuffer ( length )
+
+ 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]
+features: [ArrayBuffer]
+---*/
+
+verifyProperty(ArrayBuffer, "length", {
+ value: 1,
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/name.js b/js/src/tests/test262/built-ins/ArrayBuffer/name.js
new file mode 100644
index 0000000000..5fbc3c526b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/name.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-constructor
+description: >
+ ArrayBuffer.name is "ArrayBuffer".
+info: |
+ 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(ArrayBuffer.name, "ArrayBuffer");
+
+verifyProperty(ArrayBuffer, "name", {
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/negative-length-throws.js b/js/src/tests/test262/built-ins/ArrayBuffer/negative-length-throws.js
new file mode 100644
index 0000000000..4d999aabd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/negative-length-throws.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Throws a Range Error if length represents an integer < 0
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+
+ ToIndex( value )
+
+ 1. If value is undefined, then
+ a. Let index be 0.
+ 2. Else,
+ a. Let integerIndex be ? ToInteger(value).
+ b. If integerIndex < 0, throw a RangeError exception.
+ ...
+---*/
+
+assert.throws(RangeError, function() {
+ new ArrayBuffer(-1);
+});
+
+assert.throws(RangeError, function() {
+ new ArrayBuffer(-1.1);
+});
+
+assert.throws(RangeError, function() {
+ new ArrayBuffer(-Infinity);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/newtarget-prototype-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/newtarget-prototype-is-not-object.js
new file mode 100644
index 0000000000..e637912801
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/newtarget-prototype-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ [[Prototype]] defaults to %ArrayBufferPrototype% if NewTarget.prototype is not an object.
+info: |
+ ArrayBuffer( length )
+
+ ArrayBuffer called with argument length performs the following steps:
+
+ ...
+ 6. Return AllocateArrayBuffer(NewTarget, byteLength).
+
+ AllocateArrayBuffer( constructor, byteLength )
+ 1. Let obj be OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%",
+ «[[ArrayBufferData]], [[ArrayBufferByteLength]]» ).
+ 2. ReturnIfAbrupt(obj).
+ ...
+features: [Reflect.construct, Symbol]
+---*/
+
+function newTarget() {}
+
+newTarget.prototype = undefined;
+var arrayBuffer = Reflect.construct(ArrayBuffer, [1], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is undefined");
+
+newTarget.prototype = null;
+var arrayBuffer = Reflect.construct(ArrayBuffer, [2], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is null");
+
+newTarget.prototype = true;
+var arrayBuffer = Reflect.construct(ArrayBuffer, [3], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is a Boolean");
+
+newTarget.prototype = "";
+var arrayBuffer = Reflect.construct(ArrayBuffer, [4], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is a String");
+
+newTarget.prototype = Symbol();
+var arrayBuffer = Reflect.construct(ArrayBuffer, [5], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is a Symbol");
+
+newTarget.prototype = 1;
+var arrayBuffer = Reflect.construct(ArrayBuffer, [6], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), ArrayBuffer.prototype, "newTarget.prototype is a Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prop-desc.js b/js/src/tests/test262/built-ins/ArrayBuffer/prop-desc.js
new file mode 100644
index 0000000000..ece781f43c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prop-desc.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2017 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-constructor
+description: >
+ Property descriptor of ArrayBuffer
+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 ArrayBuffer, "function", "`typeof ArrayBuffer` is `'function'`");
+
+verifyProperty(this, "ArrayBuffer", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/ArrayBuffer/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..b92106f16e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/proto-from-ctor-realm.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-arraybuffer-length
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 5. Return ? AllocateArrayBuffer(NewTarget, byteLength).
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ [...]
+features: [cross-realm, Reflect]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+var o = Reflect.construct(ArrayBuffer, [], C);
+
+assert.sameValue(Object.getPrototypeOf(o), other.ArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype-from-newtarget.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype-from-newtarget.js
new file mode 100644
index 0000000000..aa355473e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype-from-newtarget.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ The [[Prototype]] internal slot is computed from NewTarget.
+info: |
+ ArrayBuffer( length )
+
+ ArrayBuffer called with argument length performs the following steps:
+
+ ...
+ 6. Return AllocateArrayBuffer(NewTarget, byteLength).
+
+ AllocateArrayBuffer( constructor, byteLength )
+ 1. Let obj be OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%",
+ «[[ArrayBufferData]], [[ArrayBufferByteLength]]» ).
+ 2. ReturnIfAbrupt(obj).
+ ...
+features: [Reflect.construct]
+---*/
+
+var arrayBuffer = Reflect.construct(ArrayBuffer, [8], Object);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), Object.prototype, "NewTarget is built-in Object constructor");
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get: function() {
+ return Array.prototype;
+ }
+});
+var arrayBuffer = Reflect.construct(ArrayBuffer, [16], newTarget);
+assert.sameValue(Object.getPrototypeOf(arrayBuffer), Array.prototype, "NewTarget is BoundFunction with accessor");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..ccd1dffcd4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-arraybuffer.prototype-@@tostringtag
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "ArrayBuffer".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Symbol.toStringTag]
+---*/
+
+assert.sameValue(ArrayBuffer.prototype[Symbol.toStringTag], 'ArrayBuffer');
+
+verifyNotEnumerable(ArrayBuffer.prototype, Symbol.toStringTag);
+verifyNotWritable(ArrayBuffer.prototype, Symbol.toStringTag);
+verifyConfigurable(ArrayBuffer.prototype, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js
new file mode 100644
index 0000000000..76d827aa5e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Returns 0 if the buffer is detached
+info: |
+ get ArrayBuffer.prototype.byteLength
+ ...
+ If IsDetachedBuffer(buffer) is true, return 0.
+ ...
+includes: [detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality]
+---*/
+
+var ab = new ArrayBuffer(1);
+
+$DETACHBUFFER(ab);
+
+assert.sameValue(ab.byteLength, 0, 'The value of ab.byteLength is 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-accessor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-accessor.js
new file mode 100644
index 0000000000..cb3a3093c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-accessor.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Requires this value to have a [[ArrayBufferData]] internal slot
+info: |
+ 24.1.4.1 get ArrayBuffer.prototype.byteLength
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have an [[ArrayBufferData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.byteLength;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-func.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-func.js
new file mode 100644
index 0000000000..e648dafa8a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/invoked-as-func.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 24.1.4.1 get ArrayBuffer.prototype.byteLength
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have an [[ArrayBufferData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ ArrayBuffer.prototype, "byteLength"
+).get;
+
+assert.throws(TypeError, function() {
+ getter();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/length.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/length.js
new file mode 100644
index 0000000000..1fb8a5b7b1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: >
+ get ArrayBuffer.prototype.byteLength.length is 0.
+info: |
+ get ArrayBuffer.prototype.byteLength
+
+ 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, including optional
+ parameters. However, rest parameters 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]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength");
+
+assert.sameValue(desc.get.length, 0);
+
+verifyNotEnumerable(desc.get, "length");
+verifyNotWritable(desc.get, "length");
+verifyConfigurable(desc.get, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/name.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/name.js
new file mode 100644
index 0000000000..adac94a271
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: >
+ get ArrayBuffer.prototype.byteLength
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+includes: [propertyHelper.js]
+---*/
+
+var descriptor = Object.getOwnPropertyDescriptor(
+ ArrayBuffer.prototype, 'byteLength'
+);
+
+assert.sameValue(
+ descriptor.get.name, 'get byteLength',
+ 'The value of `descriptor.get.name` is `"get byteLength"`'
+);
+
+verifyNotEnumerable(descriptor.get, 'name');
+verifyNotWritable(descriptor.get, 'name');
+verifyConfigurable(descriptor.get, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/prop-desc.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/prop-desc.js
new file mode 100644
index 0000000000..488f9b3744
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/prop-desc.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: >
+ "byteLength" property of ArrayBuffer.prototype
+info: |
+ ArrayBuffer.prototype.byteLength is an accessor property whose set accessor
+ function is undefined.
+
+ Section 17: Every accessor property described in clauses 18 through 26 and in
+ Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
+includes: [propertyHelper.js]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength");
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, "function");
+
+verifyNotEnumerable(ArrayBuffer.prototype, "byteLength");
+verifyConfigurable(ArrayBuffer.prototype, "byteLength");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/return-bytelength.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/return-bytelength.js
new file mode 100644
index 0000000000..96d5a9f3a0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/return-bytelength.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Return value from [[ByteLength]] internal slot
+info: |
+ 24.1.4.1 get ArrayBuffer.prototype.byteLength
+
+ ...
+ 5. Let length be the value of O's [[ArrayBufferByteLength]] internal slot.
+ 6. Return length.
+---*/
+
+var ab1 = new ArrayBuffer(0);
+assert.sameValue(ab1.byteLength, 0);
+
+var ab2 = new ArrayBuffer(42);
+assert.sameValue(ab2.byteLength, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/shell.js
new file mode 100644
index 0000000000..06f65290b8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/shell.js
@@ -0,0 +1,18 @@
+// GENERATED, DO NOT EDIT
+// file: detachArrayBuffer.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A function used in the process of asserting correctness of TypedArray objects.
+
+ $262.detachArrayBuffer is defined by a host.
+defines: [$DETACHBUFFER]
+---*/
+
+function $DETACHBUFFER(buffer) {
+ if (!$262 || typeof $262.detachArrayBuffer !== "function") {
+ throw new Test262Error("No method available to detach an ArrayBuffer");
+ }
+ $262.detachArrayBuffer(buffer);
+}
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-has-no-typedarrayname-internal.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-has-no-typedarrayname-internal.js
new file mode 100644
index 0000000000..ed4a587af4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-has-no-typedarrayname-internal.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: >
+ Throws a TypeError exception when `this` does not have a [[ArrayBufferData]]
+ internal slot
+info: |
+ 24.1.4.1 get ArrayBuffer.prototype.byteLength
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have an [[ArrayBufferData]] internal slot, throw a TypeError
+ exception.
+ ...
+features: [DataView, Int8Array]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ ArrayBuffer.prototype, "byteLength"
+).get;
+
+assert.throws(TypeError, function() {
+ getter.call({});
+});
+
+assert.throws(TypeError, function() {
+ getter.call([]);
+});
+
+var ta = new Int8Array(8);
+assert.throws(TypeError, function() {
+ getter.call(ta);
+});
+
+var dv = new DataView(new ArrayBuffer(8), 0);
+assert.throws(TypeError, function() {
+ getter.call(dv);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-not-object.js
new file mode 100644
index 0000000000..32bd46d07a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-not-object.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 24.1.4.1 get ArrayBuffer.prototype.byteLength
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ ArrayBuffer.prototype, "byteLength"
+).get;
+
+assert.throws(TypeError, function() {
+ getter.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ getter.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ getter.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ getter.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ getter.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ getter.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ getter.call(s);
+}, "this is a Symbol");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer.js
new file mode 100644
index 0000000000..3b91df8526
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-arraybuffer.prototype.bytelength
+description: Throws a TypeError exception when `this` is a SharedArrayBuffer
+features: [align-detached-buffer-semantics-with-web-reality, SharedArrayBuffer]
+---*/
+
+var byteLength = Object.getOwnPropertyDescriptor(
+ ArrayBuffer.prototype, "byteLength"
+);
+
+var getter = byteLength.get;
+var sab = new SharedArrayBuffer(4);
+
+assert.throws(TypeError, function() {
+ getter.call(sab);
+}, "`this` cannot be a SharedArrayBuffer");
+
+assert.throws(TypeError, function() {
+ Object.defineProperties(sab, { byteLength });
+ sab.byteLength;
+}, "`this` cannot be a SharedArrayBuffer");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/constructor.js
new file mode 100644
index 0000000000..30d684e3c3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/constructor.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.constructor
+description: >
+ The `ArrayBuffer.prototype.constructor` property descriptor.
+info: |
+ The initial value of ArrayBuffer.prototype.constructor is the intrinsic
+ object %ArrayBuffer%.
+
+ 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(ArrayBuffer.prototype.constructor, ArrayBuffer);
+
+verifyNotEnumerable(ArrayBuffer.prototype, "constructor");
+verifyWritable(ArrayBuffer.prototype, "constructor");
+verifyConfigurable(ArrayBuffer.prototype, "constructor");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/browser.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/browser.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js
new file mode 100644
index 0000000000..f8e6c77bbe
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if `this` does not have an [[ArrayBufferData]] internal slot.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have an [[ArrayBufferData]] internal slot, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call({});
+}, "`this` value is Object");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call([]);
+}, "`this` value is Array");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-object.js
new file mode 100644
index 0000000000..efa7513101
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/context-is-not-object.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call(undefined);
+}, "`this` value is undefined");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call(null);
+}, "`this` value is null");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call(true);
+}, "`this` value is Boolean");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call("");
+}, "`this` value is String");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call(Symbol());
+}, "`this` value is Symbol");
+
+assert.throws(TypeError, function() {
+ ArrayBuffer.prototype.slice.call(1);
+}, "`this` value is Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/descriptor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/descriptor.js
new file mode 100644
index 0000000000..37458402c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/descriptor.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ ArrayBuffer.prototype.slice has default data property attributes.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 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]
+---*/
+
+verifyNotEnumerable(ArrayBuffer.prototype, "slice");
+verifyWritable(ArrayBuffer.prototype, "slice");
+verifyConfigurable(ArrayBuffer.prototype, "slice");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-absent.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-absent.js
new file mode 100644
index 0000000000..ef3396207d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-absent.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `end` index defaults to [[ArrayBufferByteLength]] if absent.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be len; else let relativeEnd be ToInteger(end).
+ 10. ReturnIfAbrupt(relativeEnd).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 6;
+var result = arrayBuffer.slice(start);
+assert.sameValue(result.byteLength, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-undefined.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-undefined.js
new file mode 100644
index 0000000000..0eb7b9abde
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-default-if-undefined.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `end` index defaults to [[ArrayBufferByteLength]] if undefined.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be len; else let relativeEnd be ToInteger(end).
+ 10. ReturnIfAbrupt(relativeEnd).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 6,
+ end = undefined;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-exceeds-length.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-exceeds-length.js
new file mode 100644
index 0000000000..11694c3aff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/end-exceeds-length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Large `end` index is clamped to [[ArrayBufferByteLength]].
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd),0); else let final be min(relativeEnd, len).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 1,
+ end = 12;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 7, "slice(1, 12)");
+
+var start = 2,
+ end = 0x100000000;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 6, "slice(2, 0x100000000)");
+
+var start = 3,
+ end = +Infinity;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 5, "slice(3, Infinity)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/extensible.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/extensible.js
new file mode 100644
index 0000000000..1b0f423cf5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/extensible.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ ArrayBuffer.prototype.slice is extensible.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Unless specified otherwise, the [[Extensible]] internal slot
+ of a built-in object initially has the value true.
+---*/
+
+assert(Object.isExtensible(ArrayBuffer.prototype.slice));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/length.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/length.js
new file mode 100644
index 0000000000..e2a15cec4a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/length.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ ArrayBuffer.prototype.slice.length is 2.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 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, including optional
+ parameters. However, rest parameters 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(ArrayBuffer.prototype.slice.length, 2);
+
+verifyNotEnumerable(ArrayBuffer.prototype.slice, "length");
+verifyNotWritable(ArrayBuffer.prototype.slice, "length");
+verifyConfigurable(ArrayBuffer.prototype.slice, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/name.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/name.js
new file mode 100644
index 0000000000..f80ab724da
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/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-arraybuffer.prototype.slice
+description: >
+ ArrayBuffer.prototype.slice.name is "slice".
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 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(ArrayBuffer.prototype.slice.name, "slice");
+
+verifyNotEnumerable(ArrayBuffer.prototype.slice, "name");
+verifyNotWritable(ArrayBuffer.prototype.slice, "name");
+verifyConfigurable(ArrayBuffer.prototype.slice, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-end.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-end.js
new file mode 100644
index 0000000000..0fa6385871
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-end.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Negative `end` index is relative to [[ArrayBufferByteLength]].
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd),0); else let final be min(relativeEnd, len).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 2,
+ end = -4;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 2, "slice(2, -4)");
+
+var start = 2,
+ end = -10;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(2, -10)");
+
+var start = 2,
+ end = -Infinity;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(2, -Infinity)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-start.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-start.js
new file mode 100644
index 0000000000..6beac51f68
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/negative-start.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Negative `start` index is relative to [[ArrayBufferByteLength]].
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 8. If relativeStart < 0, let first be max((len + relativeStart),0); else let first be min(relativeStart, len).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = -5,
+ end = 6;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 3, "slice(-5, 6)");
+
+var start = -12,
+ end = 6;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 6, "slice(-12, 6)");
+
+var start = -Infinity,
+ end = 6;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 6, "slice(-Infinity, 6)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/nonconstructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/nonconstructor.js
new file mode 100644
index 0000000000..d6e284a4a2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/nonconstructor.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ ArrayBuffer.prototype.slice is not a constructor function.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 17 ECMAScript Standard Built-in 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.
+---*/
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(ArrayBuffer.prototype.slice, "prototype"), false);
+
+var arrayBuffer = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ new arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/not-a-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/not-a-constructor.js
new file mode 100644
index 0000000000..06ff78c2aa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/not-a-constructor.js
@@ -0,0 +1,35 @@
+// 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: >
+ ArrayBuffer.prototype.slice 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, ArrayBuffer, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(ArrayBuffer.prototype.slice),
+ false,
+ 'isConstructor(ArrayBuffer.prototype.slice) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let ab = new ArrayBuffer(); new ab.slice();
+}, '`let ab = new ArrayBuffer(); new ab.slice()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/number-conversion.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/number-conversion.js
new file mode 100644
index 0000000000..4c32f6f171
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/number-conversion.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ ToInteger(start) is called before ToInteger(end).
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 6. Let relativeStart be ToInteger(start).
+ 7. ReturnIfAbrupt(relativeStart).
+ ...
+ 9. If end is undefined, let relativeEnd be len; else let relativeEnd be ToInteger(end).
+ 10. ReturnIfAbrupt(relativeEnd).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var log = "";
+var start = {
+ valueOf: function() {
+ log += "start-";
+ return 0;
+ }
+};
+var end = {
+ valueOf: function() {
+ log += "end";
+ return 8;
+ }
+};
+
+arrayBuffer.slice(start, end);
+assert.sameValue(log, "start-end");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/shell.js
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-not-object.js
new file mode 100644
index 0000000000..c2e1c571c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-not-object.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws TypeError if `constructor` property is not an object.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 2. Let C be Get(O, "constructor").
+ 3. ReturnIfAbrupt(C).
+ 4. If C is undefined, return defaultConstructor.
+ 5. If Type(C) is not Object, throw a TypeError exception.
+ ...
+features: [Symbol]
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+function callSlice() {
+ arrayBuffer.slice();
+}
+
+arrayBuffer.constructor = null;
+assert.throws(TypeError, callSlice, "`constructor` value is null");
+
+arrayBuffer.constructor = true;
+assert.throws(TypeError, callSlice, "`constructor` value is Boolean");
+
+arrayBuffer.constructor = "";
+assert.throws(TypeError, callSlice, "`constructor` value is String");
+
+arrayBuffer.constructor = Symbol();
+assert.throws(TypeError, callSlice, "`constructor` value is Symbol");
+
+arrayBuffer.constructor = 1;
+assert.throws(TypeError, callSlice, "`constructor` value is Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-undefined.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-undefined.js
new file mode 100644
index 0000000000..78cd3703aa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-constructor-is-undefined.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Uses default constructor is `constructor` property is undefined.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 2. Let C be Get(O, "constructor").
+ 3. ReturnIfAbrupt(C).
+ 4. If C is undefined, return defaultConstructor.
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = undefined;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), ArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-constructor.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-constructor.js
new file mode 100644
index 0000000000..d8ff5ae6ab
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-constructor.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if species constructor is not a constructor function.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 6. Let S be Get(C, @@species).
+ 7. ReturnIfAbrupt(S).
+ ...
+ 9. If IsConstructor(S) is true, return S.
+ 10. Throw a TypeError exception.
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+function callSlice() {
+ arrayBuffer.slice();
+}
+
+speciesConstructor[Symbol.species] = {};
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is Object");
+
+speciesConstructor[Symbol.species] = Function.prototype;
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is Function.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-object.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-object.js
new file mode 100644
index 0000000000..c92ac96a62
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-not-object.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if species constructor is not an object.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 6. Let S be Get(C, @@species).
+ 7. ReturnIfAbrupt(S).
+ 8. If S is either undefined or null, return defaultConstructor.
+ 9. If IsConstructor(S) is true, return S.
+ 10. Throw a TypeError exception.
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+function callSlice() {
+ arrayBuffer.slice();
+}
+
+speciesConstructor[Symbol.species] = true;
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is Boolean");
+
+speciesConstructor[Symbol.species] = "";
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is String");
+
+speciesConstructor[Symbol.species] = Symbol();
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is Symbol");
+
+speciesConstructor[Symbol.species] = 1;
+assert.throws(TypeError, callSlice, "`constructor[Symbol.species]` value is Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-null.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-null.js
new file mode 100644
index 0000000000..6a78b21fb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-null.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Uses default constructor is species constructor is null.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 6. Let S be Get(C, @@species).
+ 7. ReturnIfAbrupt(S).
+ 8. If S is either undefined or null, return defaultConstructor.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = null;
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), ArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-undefined.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-undefined.js
new file mode 100644
index 0000000000..402ae770e0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-is-undefined.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Uses default constructor is species constructor is undefined.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+ ...
+ 6. Let S be Get(C, @@species).
+ 7. ReturnIfAbrupt(S).
+ 8. If S is either undefined or null, return defaultConstructor.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = undefined;
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), ArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js
new file mode 100644
index 0000000000..b2bdfc1fd1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Does not throw TypeError if new ArrayBuffer is too large.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ 15. Let new be Construct(ctor, «newLen»).
+ 16. ReturnIfAbrupt(new).
+ ...
+ 20. If the value of new’s [[ArrayBufferByteLength]] internal slot < newLen, throw a TypeError exception.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return new ArrayBuffer(10);
+};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(result.byteLength, 10);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js
new file mode 100644
index 0000000000..6c5db7aa73
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if new object is not an ArrayBuffer instance.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ 15. Let new be Construct(ctor, «newLen»).
+ 16. ReturnIfAbrupt(new).
+ 17. If new does not have an [[ArrayBufferData]] internal slot, throw a TypeError exception.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return {};
+};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js
new file mode 100644
index 0000000000..19c42b3b34
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if species constructor returns `this` value.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ 15. Let new be Construct(ctor, «newLen»).
+ 16. ReturnIfAbrupt(new).
+ ...
+ 19. If SameValue(new, O) is true, throw a TypeError exception.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return arrayBuffer;
+};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js
new file mode 100644
index 0000000000..16bf932716
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if new ArrayBuffer is too small.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ 15. Let new be Construct(ctor, «newLen»).
+ 16. ReturnIfAbrupt(new).
+ ...
+ 20. If the value of new’s [[ArrayBufferByteLength]] internal slot < newLen, throw a TypeError exception.
+ ...
+features: [Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return new ArrayBuffer(4);
+};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species.js
new file mode 100644
index 0000000000..13e8f1ce65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/species.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ New ArrayBuffer instance is created from SpeciesConstructor.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 13. Let ctor be SpeciesConstructor(O, %ArrayBuffer%).
+ 14. ReturnIfAbrupt(ctor).
+ 15. Let new be Construct(ctor, «newLen»).
+ 16. ReturnIfAbrupt(new).
+ ...
+ 26. Return new.
+features: [Symbol.species]
+---*/
+
+var resultBuffer;
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return resultBuffer = new ArrayBuffer(length);
+};
+
+var arrayBuffer = new ArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(result, resultBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-absent.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-absent.js
new file mode 100644
index 0000000000..b90f347020
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-absent.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `start` index defaults to 0 if absent.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 6. Let relativeStart be ToInteger(start).
+ 7. ReturnIfAbrupt(relativeStart).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var result = arrayBuffer.slice();
+assert.sameValue(result.byteLength, 8);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-undefined.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-undefined.js
new file mode 100644
index 0000000000..a45e5bd325
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-default-if-undefined.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `start` index defaults to 0 if undefined.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 6. Let relativeStart be ToInteger(start).
+ 7. ReturnIfAbrupt(relativeStart).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = undefined,
+ end = 6;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-end.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-end.js
new file mode 100644
index 0000000000..30ad862191
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-end.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Returns zero-length buffer if `start` index exceeds `end` index.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 12. Let newLen be max(final-first,0).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 5,
+ end = 4;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-length.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-length.js
new file mode 100644
index 0000000000..7d09edc0e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/start-exceeds-length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Large `start` index is clamped to [[ArrayBufferByteLength]].
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 8. If relativeStart < 0, let first be max((len + relativeStart),0); else let first be min(relativeStart, len).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 10,
+ end = 8;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(10, 8)");
+
+var start = 0x100000000,
+ end = 7;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(0x100000000, 7)");
+
+var start = +Infinity,
+ end = 6;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(+Infinity, 6)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer.js
new file mode 100644
index 0000000000..4fb55facb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ Throws a TypeError if `this` is a SharedArrayBuffer
+features: [SharedArrayBuffer]
+---*/
+
+assert.throws(TypeError, function() {
+ var sab = new SharedArrayBuffer(0);
+ ArrayBuffer.prototype.slice.call(sab);
+}, "`this` value cannot be a SharedArrayBuffer");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-end.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-end.js
new file mode 100644
index 0000000000..2694658e8a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-end.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `end` index parameter is converted to an integral numeric value.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be len; else let relativeEnd be ToInteger(end).
+ 10. ReturnIfAbrupt(relativeEnd).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 0,
+ end = 4.5;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 4, "slice(0, 4.5)");
+
+var start = 0,
+ end = NaN;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 0, "slice(0, NaN)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-start.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-start.js
new file mode 100644
index 0000000000..0b13d6efa7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/slice/tointeger-conversion-start.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer.prototype.slice
+description: >
+ The `start` index parameter is converted to an integral numeric value.
+info: |
+ ArrayBuffer.prototype.slice ( start, end )
+
+ ...
+ 6. Let relativeStart be ToInteger(start).
+ 7. ReturnIfAbrupt(relativeStart).
+ ...
+---*/
+
+var arrayBuffer = new ArrayBuffer(8);
+
+var start = 4.5,
+ end = 8;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 4, "slice(4.5, 8)");
+
+var start = NaN,
+ end = 8;
+var result = arrayBuffer.slice(start, end);
+assert.sameValue(result.byteLength, 8, "slice(NaN, 8)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length-symbol.js b/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length-symbol.js
new file mode 100644
index 0000000000..6de5372429
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length-symbol.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Throws a TypeError if length is a symbol
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+ ...
+features: [Symbol]
+---*/
+
+var s = Symbol();
+
+assert.throws(TypeError, function() {
+ new ArrayBuffer(s);
+}, "`length` parameter is a Symbol");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length.js b/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length.js
new file mode 100644
index 0000000000..30fc6db18d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/return-abrupt-from-length.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Return abrupt from ToIndex(length)
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+ ...
+---*/
+
+var len = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ new ArrayBuffer(len);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/shell.js b/js/src/tests/test262/built-ins/ArrayBuffer/shell.js
new file mode 100644
index 0000000000..54371b7789
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/shell.js
@@ -0,0 +1,19 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+---*/
+
+function isConstructor(f) {
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/toindex-length.js b/js/src/tests/test262/built-ins/ArrayBuffer/toindex-length.js
new file mode 100644
index 0000000000..5e165c3df9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/toindex-length.js
@@ -0,0 +1,89 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ The `length` parameter is converted to a value numeric index value.
+info: |
+ ArrayBuffer( length )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ 2. Let byteLength be ? ToIndex(length).
+ 3. Return ? AllocateArrayBuffer(NewTarget, byteLength).
+
+ ToIndex( value )
+
+ 1. If value is undefined, then
+ a. Let index be 0.
+ 2. Else,
+ a. Let integerIndex be ? ToInteger(value).
+ b. If integerIndex < 0, throw a RangeError exception.
+ c. Let index be ! ToLength(integerIndex).
+ d. If SameValueZero(integerIndex, index) is false, throw a RangeError exception.
+ 3. Return index.
+---*/
+
+var obj1 = {
+ valueOf: function() {
+ return 42;
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ return 42;
+ }
+};
+
+var buffer;
+
+buffer = new ArrayBuffer(obj1);
+assert.sameValue(buffer.byteLength, 42, "object's valueOf");
+
+buffer = new ArrayBuffer(obj2);
+assert.sameValue(buffer.byteLength, 42, "object's toString");
+
+buffer = new ArrayBuffer("");
+assert.sameValue(buffer.byteLength, 0, "the Empty string");
+
+buffer = new ArrayBuffer("0");
+assert.sameValue(buffer.byteLength, 0, "string '0'");
+
+buffer = new ArrayBuffer("1");
+assert.sameValue(buffer.byteLength, 1, "string '1'");
+
+buffer = new ArrayBuffer(true);
+assert.sameValue(buffer.byteLength, 1, "true");
+
+buffer = new ArrayBuffer(false);
+assert.sameValue(buffer.byteLength, 0, "false");
+
+buffer = new ArrayBuffer(NaN);
+assert.sameValue(buffer.byteLength, 0, "NaN");
+
+buffer = new ArrayBuffer(null);
+assert.sameValue(buffer.byteLength, 0, "null");
+
+buffer = new ArrayBuffer(undefined);
+assert.sameValue(buffer.byteLength, 0, "undefined");
+
+buffer = new ArrayBuffer(0.1);
+assert.sameValue(buffer.byteLength, 0, "0.1");
+
+buffer = new ArrayBuffer(0.9);
+assert.sameValue(buffer.byteLength, 0, "0.9");
+
+buffer = new ArrayBuffer(1.1);
+assert.sameValue(buffer.byteLength, 1, "1.1");
+
+buffer = new ArrayBuffer(1.9);
+assert.sameValue(buffer.byteLength, 1, "1.9");
+
+buffer = new ArrayBuffer(-0.1);
+assert.sameValue(buffer.byteLength, 0, "-0.1");
+
+buffer = new ArrayBuffer(-0.99999);
+assert.sameValue(buffer.byteLength, 0, "-0.99999");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/undefined-newtarget-throws.js b/js/src/tests/test262/built-ins/ArrayBuffer/undefined-newtarget-throws.js
new file mode 100644
index 0000000000..0d9ee14f28
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/undefined-newtarget-throws.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ Throws a TypeError if ArrayBuffer is called as a function.
+info: |
+ ArrayBuffer( length )
+
+ ArrayBuffer called with argument length performs the following steps:
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ ...
+---*/
+
+assert.throws(TypeError, function() {
+ ArrayBuffer();
+});
+
+assert.throws(TypeError, function() {
+ ArrayBuffer(10);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/zero-length.js b/js/src/tests/test262/built-ins/ArrayBuffer/zero-length.js
new file mode 100644
index 0000000000..12e5183af2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/ArrayBuffer/zero-length.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-arraybuffer-length
+description: >
+ The `length` parameter can be zero.
+info: |
+ ArrayBuffer( length )
+
+ ...
+ 2. Let numberLength be ToNumber(length).
+ 3. Let byteLength be ToLength(numberLength).
+ 4. ReturnIfAbrupt(byteLength).
+ 5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception.
+ ...
+---*/
+
+var positiveZero = new ArrayBuffer(+0);
+assert.sameValue(positiveZero.byteLength, 0);
+
+var negativeZero = new ArrayBuffer(-0);
+assert.sameValue(negativeZero.byteLength, 0);
+
+reportCompare(0, 0);