summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-symbol.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value-sab.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-canonical-index.js63
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-integer.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-minus-zero.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-out-of-bounds.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-symbol.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-not-numeric-index.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-symbol.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value-sab.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-canonical-index.js63
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-integer.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-minus-zero.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index-get-throws.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-out-of-bounds.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-symbol.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/shell.js142
32 files changed, 1289 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js
new file mode 100644
index 0000000000..e8296d36f4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js
@@ -0,0 +1,30 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Does not throw on an instance with a detached buffer if key is not a number
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ sample.foo = "test262";
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample.undef, undefined);
+ assert.sameValue(sample.foo, "test262");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-symbol.js
new file mode 100644
index 0000000000..a0316ccb2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-key-is-symbol.js
@@ -0,0 +1,30 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Does not throw on an instance with a detached buffer if key is a Symbol
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ $DETACHBUFFER(sample.buffer);
+
+ var s = Symbol("1");
+
+ assert.sameValue(sample[s], undefined);
+
+ sample[s] = "test262";
+ assert.sameValue(sample[s], "test262");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js
new file mode 100644
index 0000000000..f979db1546
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js
@@ -0,0 +1,38 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns undefined if key has a numeric index and object has a detached
+ buffer (honoring the Realm of the current execution context)
+info: |
+ [[Get]] ( P, Receiver )
+
+ If Type(P) is String, then
+ Let numericIndex be ! CanonicalNumericIndexString(P).
+ If numericIndex is not undefined, then
+ Return ! IntegerIndexedElementGet(O, numericIndex).
+
+ IntegerIndexedElementGet ( O, index )
+
+ Assert: O is an Integer-Indexed exotic object.
+ Assert: Type(index) is Number.
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is true, return undefined.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, cross-realm, TypedArray]
+---*/
+
+let other = $262.createRealm().global;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ let OtherTA = other[TA.name];
+ let sample = new OtherTA(1);
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample[0], undefined, 'The value of sample[0] is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer.js
new file mode 100644
index 0000000000..b7ee084085
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer.js
@@ -0,0 +1,38 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns undefined if key has a numeric index and object has a detached buffer
+info: |
+ [[Get]] ( P, Receiver )
+
+ If Type(P) is String, then
+ Let numericIndex be ! CanonicalNumericIndexString(P).
+ If numericIndex is not undefined, then
+ Return ! IntegerIndexedElementGet(O, numericIndex).
+
+ IntegerIndexedElementGet ( O, index )
+
+ Assert: O is an Integer-Indexed exotic object.
+ Assert: Type(index) is Number.
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is true, return undefined.
+
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ let sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample[0], undefined, 'The value of sample[0] is expected to equal `undefined`');
+ assert.sameValue(sample["1.1"], undefined, 'The value of sample["1.1"] is expected to equal `undefined`');
+ assert.sameValue(sample["-0"], undefined, 'The value of sample["-0"] is expected to equal `undefined`');
+ assert.sameValue(sample["-1"], undefined, 'The value of sample["-1"] is expected to equal `undefined`');
+ assert.sameValue(sample["1"], undefined, 'The value of sample["1"] is expected to equal `undefined`');
+ assert.sameValue(sample["2"], undefined, 'The value of sample["2"] is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value-sab.js
new file mode 100644
index 0000000000..c3eac9165f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value-sab.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return value from valid numeric index, with SharedArrayBuffer
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray, SharedArrayBuffer]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "0", throwDesc);
+Object.defineProperty(proto, "1", throwDesc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
+ var sample = new TA(sab);
+ sample.set([42n, 1n]);
+
+ assert.sameValue(sample["0"], 42n);
+ assert.sameValue(sample["1"], 1n);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value.js
new file mode 100644
index 0000000000..4c54b6f3d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value.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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return value from valid numeric index
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "0", throwDesc);
+Object.defineProperty(proto, "1", throwDesc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 1n]);
+
+ assert.sameValue(sample["0"], 42n);
+ assert.sameValue(sample["1"], 1n);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer.js
new file mode 100644
index 0000000000..b1c9e74b09
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integerindexedelementget
+description: >
+ "Infinity" is a canonical numeric string, test with access on detached buffer.
+info: |
+ 9.4.5.4 [[Get]] ( P, Receiver )
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 7.1.16 CanonicalNumericIndexString ( argument )
+ ...
+ 3. Let n be ! ToNumber(argument).
+ 4. If SameValue(! ToString(n), argument) is false, return undefined.
+ 5. Return n.
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+ ...
+ 3. Let buffer be O.[[ViewedArrayBuffer]].
+ 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ let sample = new TA(0);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample.Infinity, undefined, 'The value of sample.Infinity is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-canonical-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-canonical-index.js
new file mode 100644
index 0000000000..115b604b18
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-canonical-index.js
@@ -0,0 +1,63 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if numeric key is not a CanonicalNumericIndex
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+
+var keys = [
+ "1.0",
+ "+1",
+ "1000000000000000000000",
+ "0.0000001"
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ keys.forEach(function(key) {
+ var sample = new TA();
+
+ assert.sameValue(
+ sample[key], undefined,
+ "return undefined for inexistent properties [" + key + "]"
+ );
+
+ TypedArray.prototype[key] = "test262";
+
+ assert.sameValue(
+ sample[key],
+ "test262",
+ "return value from inherited key [" + key + "]"
+ );
+
+ sample[key] = "bar";
+ assert.sameValue(
+ sample[key], "bar",
+ "return value from own key [" + key + "]"
+ );
+
+ Object.defineProperty(sample, key, {
+ get: function() { return "baz"; }
+ });
+
+ assert.sameValue(
+ sample[key], "baz",
+ "return value from get accessor [" + key + "]"
+ );
+
+ delete TypedArray.prototype[key];
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-integer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-integer.js
new file mode 100644
index 0000000000..251231fc65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-integer.js
@@ -0,0 +1,39 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index is not an integer.
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 5. If IsInteger(index) is false, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+Object.defineProperty(proto, "1.1", {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ assert.sameValue(sample["1.1"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-minus-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-minus-zero.js
new file mode 100644
index 0000000000..99d6d4f7af
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-minus-zero.js
@@ -0,0 +1,39 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index is -0.
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 6. If index = -0, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+Object.defineProperty(proto, "-0", {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ assert.sameValue(sample["-0"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js
new file mode 100644
index 0000000000..9073ee159a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js
@@ -0,0 +1,40 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns abrupt from OrdinaryGet when key is not a numeric index
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+
+ 9.1.8.1 OrdinaryGet (O, P, Receiver)
+
+ ...
+ 8. Return ? Call(getter, Receiver).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ Object.defineProperty(sample, "test262", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.test262;
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index.js
new file mode 100644
index 0000000000..7d4e873e52
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-numeric-index.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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if key is not a CanonicalNumericIndex
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+
+TypedArray.prototype.baz = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ assert.sameValue(
+ sample.foo, undefined,
+ "return undefined for inexistent properties"
+ );
+
+ sample.foo = "bar";
+ assert.sameValue(sample.foo, "bar", "return value");
+
+ Object.defineProperty(sample, "bar", {
+ get: function() { return "baz"; }
+ });
+ assert.sameValue(sample.bar, "baz", "return value from get accessor");
+
+ assert.sameValue(sample.baz, "test262", "return value from inherited key");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-out-of-bounds.js
new file mode 100644
index 0000000000..30ccf64286
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-out-of-bounds.js
@@ -0,0 +1,45 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index < 0 or index ≥ [[ArrayLength]].
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 7. Let length be the value of O's [[ArrayLength]] internal slot.
+ 8. If index < 0 or index ≥ length, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "-1", throwDesc);
+Object.defineProperty(proto, "2", throwDesc);
+Object.defineProperty(proto, "3", throwDesc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ assert.sameValue(sample["-1"], undefined);
+ assert.sameValue(sample["2"], undefined);
+ assert.sameValue(sample["3"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-symbol.js
new file mode 100644
index 0000000000..0ef9bee129
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-symbol.js
@@ -0,0 +1,42 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if key is a Symbol
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Symbol, TypedArray]
+---*/
+
+var parentKey = Symbol("2");
+TypedArray.prototype[parentKey] = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n]);
+
+ var s1 = Symbol("1");
+
+ assert.sameValue(
+ sample[s1], undefined,
+ "return undefined if not property is present"
+ );
+
+ sample[s1] = "foo";
+ assert.sameValue(sample[s1], "foo", "return value");
+
+ Object.defineProperty(sample, s1, {
+ get: function() { return "bar"; }
+ });
+ assert.sameValue(sample[s1], "bar", "return value from get accessor");
+
+ assert.sameValue(sample[parentKey], "test262", "value from parent key");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/shell.js
@@ -0,0 +1,42 @@
+// GENERATED, DO NOT EDIT
+// file: testBigIntTypedArray.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 BigInt TypedArray objects.
+defines:
+ - TypedArray
+ - testWithBigIntTypedArrayConstructors
+---*/
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * 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 testWithBigIntTypedArrayConstructors(f, selected) {
+ /**
+ * Array containing every BigInt typed array constructor.
+ */
+ var constructors = selected || [
+ BigInt64Array,
+ BigUint64Array
+ ];
+
+ 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;
+ }
+ }
+}
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-not-numeric-index.js
new file mode 100644
index 0000000000..85a5dd2845
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-not-numeric-index.js
@@ -0,0 +1,30 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Does not throw on an instance with a detached buffer if key is not a number
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+ sample.foo = "test262";
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample.undef, undefined);
+ assert.sameValue(sample.foo, "test262");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-symbol.js
new file mode 100644
index 0000000000..5d7d4fcb48
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-key-is-symbol.js
@@ -0,0 +1,30 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Does not throw on an instance with a detached buffer if key is a Symbol
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [Symbol, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+ $DETACHBUFFER(sample.buffer);
+
+ var s = Symbol("1");
+
+ assert.sameValue(sample[s], undefined);
+
+ sample[s] = "test262";
+ assert.sameValue(sample[s], "test262");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js
new file mode 100644
index 0000000000..5c54ccfa2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js
@@ -0,0 +1,38 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns undefined if key has a numeric index and object has a detached
+ buffer (honoring the Realm of the current execution context)
+info: |
+ [[Get]] ( P, Receiver )
+
+ If Type(P) is String, then
+ Let numericIndex be ! CanonicalNumericIndexString(P).
+ If numericIndex is not undefined, then
+ Return ! IntegerIndexedElementGet(O, numericIndex).
+
+ IntegerIndexedElementGet ( O, index )
+
+ Assert: O is an Integer-Indexed exotic object.
+ Assert: Type(index) is Number.
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is true, return undefined.
+ ...
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, cross-realm, TypedArray]
+---*/
+
+let other = $262.createRealm().global;
+
+testWithTypedArrayConstructors(function(TA) {
+ let OtherTA = other[TA.name];
+ let sample = new OtherTA(1);
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample[0], undefined, 'The value of sample[0] is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer.js
new file mode 100644
index 0000000000..ca6783aa51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/detached-buffer.js
@@ -0,0 +1,38 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns undefined if key has a numeric index and object has a detached buffer
+info: |
+ [[Get]] ( P, Receiver )
+
+ If Type(P) is String, then
+ Let numericIndex be ! CanonicalNumericIndexString(P).
+ If numericIndex is not undefined, then
+ Return ! IntegerIndexedElementGet(O, numericIndex).
+
+ IntegerIndexedElementGet ( O, index )
+
+ Assert: O is an Integer-Indexed exotic object.
+ Assert: Type(index) is Number.
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is true, return undefined.
+
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42]);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample[0], undefined, 'The value of sample[0] is expected to equal `undefined`');
+ assert.sameValue(sample["1.1"], undefined, 'The value of sample["1.1"] is expected to equal `undefined`');
+ assert.sameValue(sample["-0"], undefined, 'The value of sample["-0"] is expected to equal `undefined`');
+ assert.sameValue(sample["-1"], undefined, 'The value of sample["-1"] is expected to equal `undefined`');
+ assert.sameValue(sample["1"], undefined, 'The value of sample["1"] is expected to equal `undefined`');
+ assert.sameValue(sample["2"], undefined, 'The value of sample["2"] is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value-sab.js
new file mode 100644
index 0000000000..508254c872
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value-sab.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return value from valid numeric index, with SharedArrayBuffer
+includes: [testTypedArray.js]
+features: [TypedArray, SharedArrayBuffer]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "0", throwDesc);
+Object.defineProperty(proto, "1", throwDesc);
+
+testWithTypedArrayConstructors(function(TA) {
+ var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
+ var sample = new TA(sab);
+ sample.set([42, 1]);
+
+ assert.sameValue(sample["0"], 42);
+ assert.sameValue(sample["1"], 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value.js
new file mode 100644
index 0000000000..f99235ad50
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value.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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return value from valid numeric index
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+includes: [testTypedArray.js]
+features: [TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "0", throwDesc);
+Object.defineProperty(proto, "1", throwDesc);
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 1]);
+
+ assert.sameValue(sample["0"], 42);
+ assert.sameValue(sample["1"], 1);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer.js
new file mode 100644
index 0000000000..64cf13940d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integerindexedelementget
+description: >
+ "Infinity" is a canonical numeric string, test with access on detached buffer.
+info: |
+ 9.4.5.4 [[Get]] ( P, Receiver )
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ CanonicalNumericIndexString ( argument )
+ ...
+ 3. Let n be ! ToNumber(argument).
+ 4. If SameValue(! ToString(n), argument) is false, return undefined.
+ 5. Return n.
+
+ IntegerIndexedElementGet ( O, index )
+
+ Assert: O is an Integer-Indexed exotic object.
+ Assert: Type(index) is Number.
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is true, return undefined.
+
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ let sample = new TA(0);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(sample.Infinity, undefined, 'The value of sample.Infinity is expected to equal `undefined`');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-canonical-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-canonical-index.js
new file mode 100644
index 0000000000..985516626b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-canonical-index.js
@@ -0,0 +1,63 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if numeric key is not a CanonicalNumericIndex
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+var keys = [
+ "1.0",
+ "+1",
+ "1000000000000000000000",
+ "0.0000001"
+];
+
+testWithTypedArrayConstructors(function(TA) {
+ keys.forEach(function(key) {
+ var sample = new TA();
+
+ assert.sameValue(
+ sample[key], undefined,
+ "return undefined for inexistent properties [" + key + "]"
+ );
+
+ TypedArray.prototype[key] = "test262";
+
+ assert.sameValue(
+ sample[key],
+ "test262",
+ "return value from inherited key [" + key + "]"
+ );
+
+ sample[key] = "bar";
+ assert.sameValue(
+ sample[key], "bar",
+ "return value from own key [" + key + "]"
+ );
+
+ Object.defineProperty(sample, key, {
+ get: function() { return "baz"; }
+ });
+
+ assert.sameValue(
+ sample[key], "baz",
+ "return value from get accessor [" + key + "]"
+ );
+
+ delete TypedArray.prototype[key];
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-integer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-integer.js
new file mode 100644
index 0000000000..3059457150
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-integer.js
@@ -0,0 +1,39 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index is not an integer.
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 5. If IsInteger(index) is false, return undefined.
+ ...
+includes: [testTypedArray.js]
+features: [TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+Object.defineProperty(proto, "1.1", {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+});
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+
+ assert.sameValue(sample["1.1"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-minus-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-minus-zero.js
new file mode 100644
index 0000000000..2810260d97
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-minus-zero.js
@@ -0,0 +1,39 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index is -0.
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 6. If index = -0, return undefined.
+ ...
+includes: [testTypedArray.js]
+features: [TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+Object.defineProperty(proto, "-0", {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+});
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+
+ assert.sameValue(sample["-0"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index-get-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index-get-throws.js
new file mode 100644
index 0000000000..12ad42d27c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index-get-throws.js
@@ -0,0 +1,40 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Returns abrupt from OrdinaryGet when key is not a numeric index
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+
+ 9.1.8.1 OrdinaryGet (O, P, Receiver)
+
+ ...
+ 8. Return ? Call(getter, Receiver).
+ ...
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ Object.defineProperty(sample, "test262", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.test262;
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index.js
new file mode 100644
index 0000000000..928add152b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-not-numeric-index.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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if key is not a CanonicalNumericIndex
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+TypedArray.prototype.baz = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+
+ assert.sameValue(
+ sample.foo, undefined,
+ "return undefined for inexistent properties"
+ );
+
+ sample.foo = "bar";
+ assert.sameValue(sample.foo, "bar", "return value");
+
+ Object.defineProperty(sample, "bar", {
+ get: function() { return "baz"; }
+ });
+ assert.sameValue(sample.bar, "baz", "return value from get accessor");
+
+ assert.sameValue(sample.baz, "test262", "return value from inherited key");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-out-of-bounds.js
new file mode 100644
index 0000000000..b8534bf612
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-out-of-bounds.js
@@ -0,0 +1,45 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Return undefined if key is numeric index < 0 or index ≥ [[ArrayLength]].
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Return ? IntegerIndexedElementGet(O, numericIndex).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 7. Let length be the value of O's [[ArrayLength]] internal slot.
+ 8. If index < 0 or index ≥ length, return undefined.
+ ...
+includes: [testTypedArray.js]
+features: [TypedArray]
+---*/
+
+var proto = TypedArray.prototype;
+var throwDesc = {
+ get: function() {
+ throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
+ }
+};
+Object.defineProperty(proto, "-1", throwDesc);
+Object.defineProperty(proto, "2", throwDesc);
+Object.defineProperty(proto, "3", throwDesc);
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+
+ assert.sameValue(sample["-1"], undefined);
+ assert.sameValue(sample["2"], undefined);
+ assert.sameValue(sample["3"], undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-symbol.js
new file mode 100644
index 0000000000..c0dcf29c51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/key-is-symbol.js
@@ -0,0 +1,42 @@
+// 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-integer-indexed-exotic-objects-get-p-receiver
+description: >
+ Use OrdinaryGet if key is a Symbol
+info: |
+ 9.4.5.4 [[Get]] (P, Receiver)
+
+ ...
+ 2. If Type(P) is String, then
+ ...
+ 3. Return ? OrdinaryGet(O, P, Receiver).
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Symbol, TypedArray]
+---*/
+
+var parentKey = Symbol("2");
+TypedArray.prototype[parentKey] = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42]);
+
+ var s1 = Symbol("1");
+
+ assert.sameValue(
+ sample[s1], undefined,
+ "return undefined if not property is present"
+ );
+
+ sample[s1] = "foo";
+ assert.sameValue(sample[s1], "foo", "return value");
+
+ Object.defineProperty(sample, s1, {
+ get: function() { return "bar"; }
+ });
+ assert.sameValue(sample[s1], "bar", "return value from get accessor");
+
+ assert.sameValue(sample[parentKey], "test262", "value from parent key");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/shell.js
new file mode 100644
index 0000000000..f9aa35231b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/Get/shell.js
@@ -0,0 +1,142 @@
+// 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);
+}
+
+// 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);
+ });
+ });
+}