summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice')
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js20
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js38
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/descriptor.js24
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-absent.js21
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-undefined.js22
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-exceeds-length.js32
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/extensible.js20
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/length.js33
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/name.js30
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-end.js32
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-start.js32
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/nonconstructor.js26
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/not-a-constructor.js36
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/number-conversion.js34
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-not-object.js36
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-undefined.js20
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-constructor.js30
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-object.js36
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-null.js24
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-undefined.js24
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js26
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js27
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js27
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js27
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species.js28
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-absent.js20
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-undefined.js21
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-end.js22
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-length.js26
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/this-is-arraybuffer.js17
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-end.js23
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-start.js23
34 files changed, 857 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/browser.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/browser.js
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js
new file mode 100644
index 0000000000..036d367651
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if `this` does not have an [[ArrayBufferData]] internal slot.
+features: [SharedArrayBuffer]
+---*/
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call({});
+}, "`this` value is Object");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call([]);
+}, "`this` value is Array");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js
new file mode 100644
index 0000000000..e2a9c2bf2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js
@@ -0,0 +1,38 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if `this` is not an Object.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer, Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call(undefined);
+}, "`this` value is undefined");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call(null);
+}, "`this` value is null");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call(true);
+}, "`this` value is Boolean");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call("");
+}, "`this` value is String");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call(Symbol());
+}, "`this` value is Symbol");
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.slice.call(1);
+}, "`this` value is Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/descriptor.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/descriptor.js
new file mode 100644
index 0000000000..112e905d30
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/descriptor.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ SharedArrayBuffer.prototype.slice has default data property attributes.
+info: |
+ SharedArrayBuffer.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]
+features: [SharedArrayBuffer]
+---*/
+
+verifyNotEnumerable(SharedArrayBuffer.prototype, "slice");
+verifyWritable(SharedArrayBuffer.prototype, "slice");
+verifyConfigurable(SharedArrayBuffer.prototype, "slice");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-absent.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-absent.js
new file mode 100644
index 0000000000..cfacf942a7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-absent.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `end` index defaults to [[ArrayBufferByteLength]] if absent.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/end-default-if-undefined.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-undefined.js
new file mode 100644
index 0000000000..0ad7b81343
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-undefined.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `end` index defaults to [[ArrayBufferByteLength]] if undefined.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/end-exceeds-length.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-exceeds-length.js
new file mode 100644
index 0000000000..d4c01867c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/end-exceeds-length.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Large `end` index is clamped to [[ArrayBufferByteLength]].
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/extensible.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/extensible.js
new file mode 100644
index 0000000000..ad6dc3b3f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/extensible.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ SharedArrayBuffer.prototype.slice is extensible.
+info: |
+ SharedArrayBuffer.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.
+features: [SharedArrayBuffer]
+---*/
+
+assert(Object.isExtensible(SharedArrayBuffer.prototype.slice));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/length.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/length.js
new file mode 100644
index 0000000000..6760427fb6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/length.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ SharedArrayBuffer.prototype.slice.length is 2.
+info: |
+ SharedArrayBuffer.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]
+features: [SharedArrayBuffer]
+---*/
+
+assert.sameValue(SharedArrayBuffer.prototype.slice.length, 2);
+
+verifyNotEnumerable(SharedArrayBuffer.prototype.slice, "length");
+verifyNotWritable(SharedArrayBuffer.prototype.slice, "length");
+verifyConfigurable(SharedArrayBuffer.prototype.slice, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/name.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/name.js
new file mode 100644
index 0000000000..a3407d4b8a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/name.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ SharedArrayBuffer.prototype.slice.name is "slice".
+info: |
+ SharedArrayBuffer.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]
+features: [SharedArrayBuffer]
+---*/
+
+assert.sameValue(SharedArrayBuffer.prototype.slice.name, "slice");
+
+verifyNotEnumerable(SharedArrayBuffer.prototype.slice, "name");
+verifyNotWritable(SharedArrayBuffer.prototype.slice, "name");
+verifyConfigurable(SharedArrayBuffer.prototype.slice, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-end.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-end.js
new file mode 100644
index 0000000000..2e2b4bf7d7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-end.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Negative `end` index is relative to [[ArrayBufferByteLength]].
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/negative-start.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-start.js
new file mode 100644
index 0000000000..ed7213976b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/negative-start.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Negative `start` index is relative to [[ArrayBufferByteLength]].
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/nonconstructor.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/nonconstructor.js
new file mode 100644
index 0000000000..077e95b854
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/nonconstructor.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ SharedArrayBuffer.prototype.slice is not a constructor function.
+info: |
+ SharedArrayBuffer.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.
+features: [SharedArrayBuffer]
+---*/
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(SharedArrayBuffer.prototype.slice, "prototype"), false);
+
+var arrayBuffer = new SharedArrayBuffer(8);
+assert.throws(TypeError, function() {
+ new arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/not-a-constructor.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/not-a-constructor.js
new file mode 100644
index 0000000000..49713162b8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/not-a-constructor.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// 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: >
+ SharedArrayBuffer.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, SharedArrayBuffer, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(SharedArrayBuffer.prototype.slice),
+ false,
+ 'isConstructor(SharedArrayBuffer.prototype.slice) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let sab = new SharedArrayBuffer(1); new sab.slice();
+}, '`let sab = new SharedArrayBuffer(1); new sab.slice()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/number-conversion.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/number-conversion.js
new file mode 100644
index 0000000000..6882f49f2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/number-conversion.js
@@ -0,0 +1,34 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ ToInteger(start) is called before ToInteger(end).
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/shell.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/shell.js
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-not-object.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-not-object.js
new file mode 100644
index 0000000000..cf1dc0d9eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-not-object.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError if `constructor` property is not an object.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/species-constructor-is-undefined.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-undefined.js
new file mode 100644
index 0000000000..1192bdcd6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-undefined.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Uses default constructor is `constructor` property is undefined.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = undefined;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), SharedArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-constructor.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-constructor.js
new file mode 100644
index 0000000000..ada1f4d270
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-constructor.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if species constructor is not a constructor function.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/species-is-not-object.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-object.js
new file mode 100644
index 0000000000..559c5c8eb3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-object.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if species constructor is not an object.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/species-is-null.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-null.js
new file mode 100644
index 0000000000..5cfc458fe2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-null.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Uses default constructor is species constructor is null.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = null;
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), SharedArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-undefined.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-undefined.js
new file mode 100644
index 0000000000..022787b1f5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-undefined.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Uses default constructor is species constructor is undefined.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = undefined;
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(Object.getPrototypeOf(result), SharedArrayBuffer.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js
new file mode 100644
index 0000000000..3a08654715
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Does not throw TypeError if new SharedArrayBuffer is too large.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return new SharedArrayBuffer(10);
+};
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js
new file mode 100644
index 0000000000..4e979ddbff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if new object is not an SharedArrayBuffer instance.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return {};
+};
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js
new file mode 100644
index 0000000000..8a95e32219
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if species constructor returns `this` value.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return arrayBuffer;
+};
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js
new file mode 100644
index 0000000000..3ad6af8903
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if new SharedArrayBuffer is too small.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return new SharedArrayBuffer(4);
+};
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+assert.throws(TypeError, function() {
+ arrayBuffer.slice();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species.js
new file mode 100644
index 0000000000..6bda23c55b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/species.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ New SharedArrayBuffer instance is created from SpeciesConstructor.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer, Symbol.species]
+---*/
+
+var resultBuffer;
+
+var speciesConstructor = {};
+speciesConstructor[Symbol.species] = function(length) {
+ return resultBuffer = new SharedArrayBuffer(length);
+};
+
+var arrayBuffer = new SharedArrayBuffer(8);
+arrayBuffer.constructor = speciesConstructor;
+
+var result = arrayBuffer.slice();
+assert.sameValue(result, resultBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-absent.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-absent.js
new file mode 100644
index 0000000000..e559667926
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-absent.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `start` index defaults to 0 if absent.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(8);
+
+var result = arrayBuffer.slice();
+assert.sameValue(result.byteLength, 8);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-undefined.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-undefined.js
new file mode 100644
index 0000000000..7ffa5a541f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-undefined.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `start` index defaults to 0 if undefined.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/start-exceeds-end.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-end.js
new file mode 100644
index 0000000000..533d4efc9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-end.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Returns zero-length buffer if `start` index exceeds `end` index.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(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/SharedArrayBuffer/prototype/slice/start-exceeds-length.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-length.js
new file mode 100644
index 0000000000..30b3e9ece3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-length.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Large `start` index is clamped to [[ArrayBufferByteLength]].
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(8);
+var result;
+
+result = arrayBuffer.slice(10, 8);
+assert.sameValue(result.byteLength, 0, "slice(10, 8)");
+
+result = arrayBuffer.slice(0x100000000, 7);
+assert.sameValue(result.byteLength, 0, "slice(0x100000000, 7)");
+
+result = arrayBuffer.slice(+Infinity, 6);
+assert.sameValue(result.byteLength, 0, "slice(+Infinity, 6)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/this-is-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/this-is-arraybuffer.js
new file mode 100644
index 0000000000..ebe64e1ba9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/this-is-arraybuffer.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-sharedarraybuffer.prototype.slice
+description: >
+ Throws a TypeError if `this` is an ArrayBuffer
+features: [ArrayBuffer, SharedArrayBuffer]
+---*/
+
+assert.throws(TypeError, function() {
+ var ab = new ArrayBuffer(0);
+ SharedArrayBuffer.prototype.slice.call(ab);
+}, "`this` value cannot be an ArrayBuffer");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-end.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-end.js
new file mode 100644
index 0000000000..0f6cf12bd5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-end.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `end` index parameter is converted to an integral numeric value.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(8);
+var result;
+
+result = arrayBuffer.slice(0, 4.5);
+assert.sameValue(result.byteLength, 4, "slice(0, 4.5)");
+
+result = arrayBuffer.slice(0, NaN);
+assert.sameValue(result.byteLength, 0, "slice(0, NaN)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-start.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-start.js
new file mode 100644
index 0000000000..3291405e41
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-start.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `start` index parameter is converted to an integral numeric value.
+info: |
+ SharedArrayBuffer.prototype.slice ( start, end )
+features: [SharedArrayBuffer]
+---*/
+
+var arrayBuffer = new SharedArrayBuffer(8);
+var result;
+
+result = arrayBuffer.slice(4.5, 8);
+assert.sameValue(result.byteLength, 4, "slice(4.5, 8)");
+
+result = arrayBuffer.slice(NaN, 8);
+assert.sameValue(result.byteLength, 8, "slice(NaN, 8)");
+
+reportCompare(0, 0);