summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js65
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/indexed-value.js28
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer.js48
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/inherited-property.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-greater-than-last-index.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-lower-than-zero.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-minus-zero.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-canonical-index.js55
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-integer.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-numeric-index.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-symbol.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js65
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-not-number.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-symbol.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/indexed-value.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer.js52
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/inherited-property.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-greater-than-last-index.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-lower-than-zero.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-minus-zero.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-canonical-index.js55
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-integer.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-numeric-index.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-symbol.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js64
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-fixed.js57
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/shell.js142
36 files changed, 1392 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js
new file mode 100644
index 0000000000..fcec3e4db7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js
@@ -0,0 +1,65 @@
+// 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-hasproperty-p
+description: Return abrupt from OrdinaryHasProperty parent's [[HasProperty]]
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+
+ 9.1.7.1 OrdinaryHasProperty (O, P)
+
+ ...
+ 2. Let hasOwn be ? O.[[GetOwnProperty]](P).
+ 3. If hasOwn is not undefined, return true.
+ 4. Let parent be ? O.[[GetPrototypeOf]]().
+ 5. If parent is not null, then
+ a. Return ? parent.[[HasProperty]](P).
+ 6. Return false.
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, Proxy, TypedArray]
+---*/
+
+var handler = {
+ has: function() {
+ throw new Test262Error();
+ }
+};
+
+var proxy = new Proxy(TypedArray.prototype, handler);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ Object.setPrototypeOf(sample, proxy);
+
+ assert.sameValue(
+ Reflect.has(sample, 0), true,
+ 'Reflect.has(sample, 0) must return true'
+ );
+ assert.sameValue(
+ Reflect.has(sample, 1), false,
+ 'Reflect.has(sample, 1) must return false'
+ );
+
+ assert.throws(Test262Error, function() {
+ Reflect.has(sample, "foo");
+ }, '`Reflect.has(sample, "foo")` throws Test262Error');
+
+ Object.defineProperty(sample, "foo", { value: 42 });
+
+ assert.sameValue(
+ Reflect.has(sample, "foo"),
+ true,
+ 'Reflect.has(sample, "foo") must return true'
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js
new file mode 100644
index 0000000000..011a63acd1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-getproperty-p
+description: >
+ Does not throw on an instance with a detached buffer if key is not a
+ CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ Object.defineProperty(sample, "bar", { value: 42 });
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, "foo"), false);
+ assert.sameValue(Reflect.has(sample, "bar"), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js
new file mode 100644
index 0000000000..e24e8e58ea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js
@@ -0,0 +1,33 @@
+// 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-hasproperty-p
+description: >
+ Does not throw on an instance with a detached buffer if key is a Symbol
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Reflect, Symbol, TypedArray]
+---*/
+
+var s1 = Symbol("foo");
+var s2 = Symbol("bar");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ Object.defineProperty(sample, s1, { value: "baz" });
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, s1), true);
+ assert.sameValue(Reflect.has(sample, s2), false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js
new file mode 100644
index 0000000000..298c79428b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js
@@ -0,0 +1,33 @@
+// 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-hasproperty-p
+description: >
+ Returns false if this has a detached buffer (honoring the Realm of the
+ current execution context)
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var OtherTA = other[TA.name];
+ var sample = new OtherTA(1);
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, '0'), false, 'Reflect.has(sample, "0") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer.js
new file mode 100644
index 0000000000..7e58bd2473
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: Returns false if this has a detached buffer
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, "0"), false, 'Reflect.has(sample, "0") must return false');
+ assert.sameValue(Reflect.has(sample, "-0"), false, 'Reflect.has(sample, "-0") must return false');
+ assert.sameValue(Reflect.has(sample, "1.1"), false, 'Reflect.has(sample, "1.1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/indexed-value.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/indexed-value.js
new file mode 100644
index 0000000000..6773bd1487
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/indexed-value.js
@@ -0,0 +1,28 @@
+// 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-hasproperty-p
+description: >
+ Return true for indexed properties
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ iv. Return true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray]
+---*/
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ assert.sameValue(Reflect.has(sample, 0), true, 'Reflect.has(sample, 0) must return true');
+ assert.sameValue(Reflect.has(sample, 1), true, 'Reflect.has(sample, 1) must return true');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer.js
new file mode 100644
index 0000000000..80a9f396cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: >
+ "Infinity" is a canonical numeric string, test with access on detached buffer.
+info: |
+ 9.4.5.2 [[HasProperty]]( P )
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+
+ 7.1.16 CanonicalNumericIndexString ( argument )
+ ...
+ 3. Let n be ! ToNumber(argument).
+ 4. If SameValue(! ToString(n), argument) is false, return undefined.
+ 5. Return n.
+
+flags: [noStrict]
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray]
+---*/
+testWithBigIntTypedArrayConstructors(function(TA) {
+ let counter = 0;
+
+ let n = {
+ valueOf() {
+ counter++;
+ return 9n;
+ }
+ };
+
+ assert.sameValue(counter, 0, 'The value of `counter` is 0');
+ let ta = new TA([n]);
+ assert.sameValue(counter, 1, 'The value of `counter` is 1');
+ $DETACHBUFFER(ta.buffer);
+
+ with (ta) {
+ Infinity;
+ assert.sameValue(counter, 1, 'The value of `counter` is 1');
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/inherited-property.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/inherited-property.js
new file mode 100644
index 0000000000..d2ec511afd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/inherited-property.js
@@ -0,0 +1,37 @@
+// 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-hasproperty-p
+description: >
+ Find inherited properties if property is not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+TypedArray.prototype.foo = 42;
+TypedArray.prototype[42] = true;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ TA.prototype.bar = 42;
+
+ assert.sameValue(Reflect.has(sample, "subarray"), true, "subarray");
+ assert.sameValue(Reflect.has(sample, "foo"), true, "foo");
+ assert.sameValue(Reflect.has(sample, "bar"), true, "bar");
+ assert.sameValue(Reflect.has(sample, "baz"), false, "baz");
+
+ assert.sameValue(Reflect.has(sample, "42"), false, "42");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-greater-than-last-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-greater-than-last-index.js
new file mode 100644
index 0000000000..3c51c7f6df
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-greater-than-last-index.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: Return false if P's value is >= this's [[ArrayLength]]
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray]
+---*/
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype[1] = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "1"), false, 'Reflect.has(sample, "1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-lower-than-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-lower-than-zero.js
new file mode 100644
index 0000000000..e445238631
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-lower-than-zero.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-hasproperty-p
+description: Return false if P's value is < 0
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype[-1] = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "-1"), false, 'Reflect.has(sample, "-1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-minus-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-minus-zero.js
new file mode 100644
index 0000000000..f8e938299b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-minus-zero.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-hasproperty-p
+description: Return false if P's value is "-0"
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype["-0"] = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "-0"), false, 'Reflect.has(sample, "-0") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-canonical-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-canonical-index.js
new file mode 100644
index 0000000000..828aa9b570
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-canonical-index.js
@@ -0,0 +1,55 @@
+// 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-hasproperty-p
+description: >
+ Return boolean from numeric keys that are not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var keys = [
+ "1.0",
+ "+1",
+ "1000000000000000000000",
+ "0.0000001"
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ keys.forEach(function(key) {
+ var sample = new TA(1);
+
+ assert.sameValue(
+ Reflect.has(sample, key), false,
+ "returns false without key [" + key + "]"
+ );
+
+ TypedArray.prototype[key] = 42;
+
+ assert.sameValue(
+ Reflect.has(sample, key), true,
+ "returns true with inherited key [" + key + "]"
+ );
+
+ delete TypedArray.prototype[key];
+
+ Object.defineProperty(sample, key, {value: 42n});
+
+ assert.sameValue(
+ Reflect.has(sample, key), true,
+ "returns true with own key [" + key + "]"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-integer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-integer.js
new file mode 100644
index 0000000000..196ad49ef3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-integer.js
@@ -0,0 +1,32 @@
+// 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-hasproperty-p
+description: Return false if P's value is not an integer
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If IsInteger(numericIndex) is false, return false.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype["1.1"] = "test262";
+TypedArray.prototype["0.000001"] = "test262";
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "1.1"), false, "1.1");
+ assert.sameValue(Reflect.has(sample, "0.000001"), false, "0.000001");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-numeric-index.js
new file mode 100644
index 0000000000..e29503e510
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-numeric-index.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: >
+ Return boolean from properties that are not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "foo"), false);
+
+ Object.defineProperty(sample, "foo", { value: 42 });
+
+ assert.sameValue(Reflect.has(sample, "foo"), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-symbol.js
new file mode 100644
index 0000000000..d86caa85b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/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-hasproperty-p
+description: >
+ Return boolean from Symbol properties
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, Symbol, TypedArray]
+---*/
+
+var s = Symbol("foo");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, s), false);
+
+ Object.defineProperty(sample, s, { value: 42 });
+
+ assert.sameValue(Reflect.has(sample, s), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/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/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js
new file mode 100644
index 0000000000..3513862b71
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js
@@ -0,0 +1,65 @@
+// 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-hasproperty-p
+description: Return abrupt from OrdinaryHasProperty parent's [[HasProperty]]
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+
+ 9.1.7.1 OrdinaryHasProperty (O, P)
+
+ ...
+ 2. Let hasOwn be ? O.[[GetOwnProperty]](P).
+ 3. If hasOwn is not undefined, return true.
+ 4. Let parent be ? O.[[GetPrototypeOf]]().
+ 5. If parent is not null, then
+ a. Return ? parent.[[HasProperty]](P).
+ 6. Return false.
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, Proxy, TypedArray]
+---*/
+
+var handler = {
+ has: function() {
+ throw new Test262Error();
+ }
+};
+
+var proxy = new Proxy(TypedArray.prototype, handler);
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ Object.setPrototypeOf(sample, proxy);
+
+ assert.sameValue(
+ Reflect.has(sample, 0), true,
+ 'Reflect.has(sample, 0) must return true'
+ );
+ assert.sameValue(
+ Reflect.has(sample, 1), false,
+ 'Reflect.has(sample, 1) must return false'
+ );
+
+ assert.throws(Test262Error, function() {
+ Reflect.has(sample, "foo");
+ }, '`Reflect.has(sample, "foo")` throws Test262Error');
+
+ Object.defineProperty(sample, "foo", { value: 42 });
+
+ assert.sameValue(
+ Reflect.has(sample, "foo"),
+ true,
+ 'Reflect.has(sample, "foo") must return true'
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-not-number.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-not-number.js
new file mode 100644
index 0000000000..3a8d2511e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-not-number.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-getproperty-p
+description: >
+ Does not throw on an instance with a detached buffer if key is not a
+ CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [Reflect, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+ Object.defineProperty(sample, "bar", { value: 42 });
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, "foo"), false);
+ assert.sameValue(Reflect.has(sample, "bar"), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-symbol.js
new file mode 100644
index 0000000000..80810d3d8c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-key-is-symbol.js
@@ -0,0 +1,33 @@
+// 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-hasproperty-p
+description: >
+ Does not throw on an instance with a detached buffer if key is a Symbol
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [Reflect, Symbol, TypedArray]
+---*/
+
+var s1 = Symbol("foo");
+var s2 = Symbol("bar");
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+ Object.defineProperty(sample, s1, { value: "baz" });
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, s1), true);
+ assert.sameValue(Reflect.has(sample, s2), false);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js
new file mode 100644
index 0000000000..d9be7d2e18
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js
@@ -0,0 +1,32 @@
+// 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-hasproperty-p
+description: >
+ Returns false if this has a detached buffer (honoring the Realm of the current execution context)
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+
+testWithTypedArrayConstructors(function(TA) {
+ var OtherTA = other[TA.name];
+ var sample = new OtherTA(1);
+
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, '0'), false, 'Reflect.has(sample, "0") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer.js
new file mode 100644
index 0000000000..80f3d2aaf3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: Return false if this has a detached buffer
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.sameValue(Reflect.has(sample, "0"), false, 'Reflect.has(sample, "0") must return false');
+ assert.sameValue(Reflect.has(sample, "-0"), false, 'Reflect.has(sample, "-0") must return false');
+ assert.sameValue(Reflect.has(sample, "1.1"), false, 'Reflect.has(sample, "1.1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/indexed-value.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/indexed-value.js
new file mode 100644
index 0000000000..3cb63c33ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/indexed-value.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-hasproperty-p
+description: >
+ Return true for indexed properties
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ iv. Return true.
+ ...
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA([42, 43]);
+
+ assert.sameValue(Reflect.has(sample, 0), true, 'Reflect.has("new TA([42, 43])", 0) must return true');
+ assert.sameValue(Reflect.has(sample, 1), true, 'Reflect.has("new TA([42, 43])", 1) must return true');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer.js
new file mode 100644
index 0000000000..b71d009764
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: >
+ "Infinity" is a canonical numeric string, test with access on detached buffer.
+info: |
+ 9.4.5.2 [[HasProperty]]( P )
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Let buffer be O.[[ViewedArrayBuffer]].
+ ii. If IsDetachedBuffer(buffer) is true, return false.
+ ...
+
+ 7.1.16 CanonicalNumericIndexString ( argument )
+ ...
+ 3. Let n be ! ToNumber(argument).
+ 4. If SameValue(! ToString(n), argument) is false, return undefined.
+ 5. Return n.
+
+flags: [noStrict]
+includes: [testTypedArray.js, detachArrayBuffer.js]
+features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ let counter = 0;
+ let n = {
+ valueOf() {
+ counter++;
+ return 9;
+ }
+ };
+
+ assert.sameValue(counter, 0, 'The value of `counter` is 0');
+
+ let ta = new TA([n]);
+
+ assert.sameValue(counter, 1, 'The value of `counter` is 1');
+
+ $DETACHBUFFER(ta.buffer);
+
+ with (ta) {
+ Infinity;
+ assert.sameValue(counter, 1, 'The value of `counter` is 1');
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/inherited-property.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/inherited-property.js
new file mode 100644
index 0000000000..eb736978dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/inherited-property.js
@@ -0,0 +1,37 @@
+// 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-hasproperty-p
+description: >
+ Find inherited properties if property is not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray]
+---*/
+
+TypedArray.prototype.foo = 42;
+TypedArray.prototype[42] = true;
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ TA.prototype.bar = 42;
+
+ assert.sameValue(Reflect.has(sample, "subarray"), true, "subarray");
+ assert.sameValue(Reflect.has(sample, "foo"), true, "foo");
+ assert.sameValue(Reflect.has(sample, "bar"), true, "bar");
+ assert.sameValue(Reflect.has(sample, "baz"), false, "baz");
+
+ assert.sameValue(Reflect.has(sample, "42"), false, "42");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-greater-than-last-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-greater-than-last-index.js
new file mode 100644
index 0000000000..1c930e4005
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-greater-than-last-index.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: Return false if P's value is >= this's [[ArrayLength]]
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
+---*/
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype[1] = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "1"), false, 'Reflect.has(sample, "1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-lower-than-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-lower-than-zero.js
new file mode 100644
index 0000000000..3cbe081f30
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-lower-than-zero.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-hasproperty-p
+description: Return false if P's value is < 0
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype[-1] = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "-1"), false, 'Reflect.has(sample, "-1") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-minus-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-minus-zero.js
new file mode 100644
index 0000000000..870cc9a039
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-minus-zero.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-hasproperty-p
+description: Return false if P's value is "-0"
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If ! IsValidIntegerIndex(O, numericIndex) is false, return false.
+ ...
+includes: [testTypedArray.js]
+features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype["-0"] = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "-0"), false, 'Reflect.has(sample, "-0") must return false');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-canonical-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-canonical-index.js
new file mode 100644
index 0000000000..4207b866e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-canonical-index.js
@@ -0,0 +1,55 @@
+// 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-hasproperty-p
+description: >
+ Return boolean from numeric keys that are not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray]
+---*/
+
+var keys = [
+ "1.0",
+ "+1",
+ "1000000000000000000000",
+ "0.0000001"
+];
+
+testWithTypedArrayConstructors(function(TA) {
+ keys.forEach(function(key) {
+ var sample = new TA(1);
+
+ assert.sameValue(
+ Reflect.has(sample, key), false,
+ "returns false without key [" + key + "]"
+ );
+
+ TypedArray.prototype[key] = 42;
+
+ assert.sameValue(
+ Reflect.has(sample, key), true,
+ "returns true with inherited key [" + key + "]"
+ );
+
+ delete TypedArray.prototype[key];
+
+ Object.defineProperty(sample, key, {value: 42});
+
+ assert.sameValue(
+ Reflect.has(sample, key), true,
+ "returns true with own key [" + key + "]"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-integer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-integer.js
new file mode 100644
index 0000000000..3b9b39bae2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-integer.js
@@ -0,0 +1,32 @@
+// 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-hasproperty-p
+description: Return false if P's value is not an integer
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ iii. If IsInteger(numericIndex) is false, return false.
+ ...
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray]
+---*/
+
+
+// Prevents false positives using OrdinaryHasProperty
+TypedArray.prototype["1.1"] = "test262";
+TypedArray.prototype["0.000001"] = "test262";
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "1.1"), false, "1.1");
+ assert.sameValue(Reflect.has(sample, "0.000001"), false, "0.000001");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-numeric-index.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-numeric-index.js
new file mode 100644
index 0000000000..acb5905ae0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-numeric-index.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-integer-indexed-exotic-objects-hasproperty-p
+description: >
+ Return boolean from properties that are not a CanonicalNumericIndexString
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+ ...
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray]
+---*/
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, "foo"), false);
+
+ Object.defineProperty(sample, "foo", { value: 42 });
+
+ assert.sameValue(Reflect.has(sample, "foo"), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-symbol.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/key-is-symbol.js
new file mode 100644
index 0000000000..915af90334
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/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-hasproperty-p
+description: >
+ Return boolean from Symbol properties
+info: |
+ 9.4.5.2 [[HasProperty]](P)
+
+ ...
+ 3. If Type(P) is String, then
+ ...
+ 4. Return ? OrdinaryHasProperty(O, P).
+includes: [testTypedArray.js]
+features: [Reflect, Symbol, TypedArray]
+---*/
+
+var s = Symbol("foo");
+
+testWithTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.sameValue(Reflect.has(sample, s), false);
+
+ Object.defineProperty(sample, s, { value: 42 });
+
+ assert.sameValue(Reflect.has(sample, s), true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js
new file mode 100644
index 0000000000..223834ba20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js
@@ -0,0 +1,64 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 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-hasproperty-p
+description: returned keys reflect resized ArrayBuffer for a dynamically-sized TypedArray
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray, resizable-arraybuffer]
+---*/
+
+// If the host chooses to throw as allowed by the specification, the observed
+// behavior will be identical to the case where `ArrayBuffer.prototype.resize`
+// has not been implemented. The following assertion prevents this test from
+// passing in runtimes which have not implemented the method.
+assert.sameValue(typeof ArrayBuffer.prototype.resize, "function");
+
+function inspect(array) {
+ return [
+ Reflect.has(array, 0),
+ Reflect.has(array, 1),
+ Reflect.has(array, 2),
+ Reflect.has(array, 3),
+ Reflect.has(array, 4)
+ ].join(",");
+}
+
+testWithTypedArrayConstructors(function(TA) {
+ var BPE = TA.BYTES_PER_ELEMENT;
+ var ab = new ArrayBuffer(BPE * 4, {maxByteLength: BPE * 5});
+ var array = new TA(ab, BPE);
+ var expected = "true,true,true,false,false";
+
+ assert.sameValue(inspect(array), expected, "initial");
+
+ try {
+ ab.resize(BPE * 5);
+ expected = "true,true,true,true,false";
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), expected, "following grow");
+
+ try {
+ ab.resize(BPE * 3);
+ expected = "true,true,false,false,false";
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), expected, "following shrink (within bounds)");
+
+ try {
+ ab.resize(BPE);
+ expected = "false,false,false,false,false";
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), expected, "following shrink (on boundary)");
+
+ try {
+ ab.resize(0);
+ expected = "false,false,false,false,false";
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), expected, "following shrink (out of bounds)");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-fixed.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-fixed.js
new file mode 100644
index 0000000000..6e63fbe2b7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-fixed.js
@@ -0,0 +1,57 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 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-hasproperty-p
+description: returned keys reflect resized ArrayBuffer for a fixed-sized TypedArray
+includes: [testTypedArray.js]
+features: [Reflect, TypedArray, resizable-arraybuffer]
+---*/
+
+// If the host chooses to throw as allowed by the specification, the observed
+// behavior will be identical to the case where `ArrayBuffer.prototype.resize`
+// has not been implemented. The following assertion prevents this test from
+// passing in runtimes which have not implemented the method.
+assert.sameValue(typeof ArrayBuffer.prototype.resize, "function");
+
+function inspect(array) {
+ return [
+ Reflect.has(array, 0),
+ Reflect.has(array, 1),
+ Reflect.has(array, 2),
+ Reflect.has(array, 3),
+ Reflect.has(array, 4)
+ ].join(",");
+}
+
+testWithTypedArrayConstructors(function(TA) {
+ var BPE = TA.BYTES_PER_ELEMENT;
+ var ab = new ArrayBuffer(BPE * 4, {maxByteLength: BPE * 5});
+ var array = new TA(ab, BPE, 2);
+
+ assert.sameValue(inspect(array), "true,true,false,false,false", "initial");
+
+ try {
+ ab.resize(BPE * 5);
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), "true,true,false,false,false", "following grow");
+
+ try {
+ ab.resize(BPE * 3);
+ } catch (_) {}
+
+ assert.sameValue(inspect(array), "true,true,false,false,false", "following shrink (within bounds)");
+
+ var expected;
+ try {
+ ab.resize(BPE * 2);
+ expected = "false,false,false,false,false";
+ } catch (_) {
+ expected = "true,true,false,false,false";
+ }
+
+ assert.sameValue(inspect(array), expected, "following shrink (out of bounds)");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/shell.js
new file mode 100644
index 0000000000..f9aa35231b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/HasProperty/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);
+ });
+ });
+}