summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArray/prototype/values
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/values')
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/detached-buffer.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-func.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-method.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/iter-prototype.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/length.js12
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/make-in-bounds-after-exhausted.js58
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/make-out-of-bounds-after-exhausted.js52
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/name.js12
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/not-a-constructor.js3
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/prop-desc.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js2
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/return-itor.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-object.js1
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-typedarray-instance.js1
14 files changed, 135 insertions, 12 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/detached-buffer.js
index 732b108995..765b75eb7e 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/detached-buffer.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/detached-buffer.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-func.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-func.js
index 6baf62480c..397d109a75 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-func.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-func.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-method.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-method.js
index 9b2e7689f7..29dbcaf63b 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-method.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/invoked-as-method.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/iter-prototype.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/iter-prototype.js
index 2ebe86343d..93a4e31383 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/iter-prototype.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/iter-prototype.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/length.js
index 11e022a134..a3a03837b3 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/length.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/length.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
@@ -23,10 +24,11 @@ includes: [propertyHelper.js, testTypedArray.js]
features: [TypedArray]
---*/
-assert.sameValue(TypedArray.prototype.values.length, 0);
-
-verifyNotEnumerable(TypedArray.prototype.values, "length");
-verifyNotWritable(TypedArray.prototype.values, "length");
-verifyConfigurable(TypedArray.prototype.values, "length");
+verifyProperty(TypedArray.prototype.values, "length", {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-in-bounds-after-exhausted.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-in-bounds-after-exhausted.js
new file mode 100644
index 0000000000..c567885f18
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-in-bounds-after-exhausted.js
@@ -0,0 +1,58 @@
+// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
+// Copyright (C) 2024 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ Iterator is still exhausted when typedarray is changed to in-bounds.
+features: [TypedArray, resizable-arraybuffer]
+---*/
+
+let rab = new ArrayBuffer(3, {maxByteLength: 5});
+let ta = new Int8Array(rab);
+
+// Ensure the TypedArray is correctly initialised.
+assert.sameValue(ta.length, 3);
+assert.sameValue(ta.byteOffset, 0);
+
+ta[0] = 11;
+ta[1] = 22;
+ta[2] = 33;
+
+let it = ta.values();
+let r;
+
+// Fetch the first value.
+r = it.next();
+assert.sameValue(r.done, false);
+assert.sameValue(r.value, 11);
+
+// Resize buffer to zero.
+rab.resize(0);
+
+// TypedArray is now out-of-bounds.
+assert.sameValue(ta.length, 0);
+assert.sameValue(ta.byteOffset, 0);
+
+// Resize buffer to zero.
+rab.resize(0);
+
+// Attempt to fetch the next value. This exhausts the iterator.
+r = it.next();
+assert.sameValue(r.done, true);
+assert.sameValue(r.value, undefined);
+
+// Resize buffer so the typed array is again in-bounds.
+rab.resize(5);
+
+// TypedArray is now in-bounds.
+assert.sameValue(ta.length, 5);
+assert.sameValue(ta.byteOffset, 0);
+
+// Attempt to fetch another value from an already exhausted iterator.
+r = it.next();
+assert.sameValue(r.done, true);
+assert.sameValue(r.value, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-out-of-bounds-after-exhausted.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-out-of-bounds-after-exhausted.js
new file mode 100644
index 0000000000..8baa1c0920
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/make-out-of-bounds-after-exhausted.js
@@ -0,0 +1,52 @@
+// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
+// Copyright (C) 2024 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ Calling next on an out-of-bounds typedarray throws no error when iterator exhausted.
+features: [TypedArray, resizable-arraybuffer]
+---*/
+
+let rab = new ArrayBuffer(3, {maxByteLength: 5});
+let ta = new Int8Array(rab, 1);
+
+// Ensure the TypedArray is correctly initialised.
+assert.sameValue(ta.length, 2);
+assert.sameValue(ta.byteOffset, 1);
+
+ta[0] = 11;
+ta[1] = 22;
+
+let it = ta.values();
+let r;
+
+// Fetch the first value.
+r = it.next();
+assert.sameValue(r.done, false);
+assert.sameValue(r.value, 11);
+
+// Fetch the second value.
+r = it.next();
+assert.sameValue(r.done, false);
+assert.sameValue(r.value, 22);
+
+// Iterator is now exhausted.
+r = it.next();
+assert.sameValue(r.done, true);
+assert.sameValue(r.value, undefined);
+
+// Resize buffer to zero.
+rab.resize(0);
+
+// TypedArray is now out-of-bounds.
+assert.sameValue(ta.length, 0);
+assert.sameValue(ta.byteOffset, 0);
+
+// Calling next doesn't throw an error.
+r = it.next();
+assert.sameValue(r.done, true);
+assert.sameValue(r.value, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/name.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/name.js
index eacaf7f45e..9db35f6120 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/name.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/name.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
@@ -20,10 +21,11 @@ includes: [propertyHelper.js, testTypedArray.js]
features: [TypedArray]
---*/
-assert.sameValue(TypedArray.prototype.values.name, "values");
-
-verifyNotEnumerable(TypedArray.prototype.values, "name");
-verifyNotWritable(TypedArray.prototype.values, "name");
-verifyConfigurable(TypedArray.prototype.values, "name");
+verifyProperty(TypedArray.prototype.values, "name", {
+ value: "values",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/not-a-constructor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/not-a-constructor.js
index 21b26b428f..ba8595192e 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/not-a-constructor.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/not-a-constructor.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
@@ -29,7 +30,7 @@ assert.sameValue(
assert.throws(TypeError, () => {
let u8 = new Uint8Array(1); new u8.values();
-}, '`let u8 = new Uint8Array(1); new u8.values()` throws TypeError');
+});
reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/prop-desc.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/prop-desc.js
index 3317588756..2d54e08a81 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/prop-desc.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/prop-desc.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js
index 1049477287..07dccc377a 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js
@@ -1,4 +1,4 @@
-// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
+// |reftest| shell-option(--enable-arraybuffer-resizable) shell-option(--enable-float16array) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-itor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-itor.js
index 5ebdfa17d5..a75bd6003f 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-itor.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/return-itor.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-object.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-object.js
index 0169af4e91..bd057bf9e2 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-object.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-object.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-typedarray-instance.js b/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-typedarray-instance.js
index 7afa67e4a5..57e7ba66b8 100644
--- a/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-typedarray-instance.js
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/values/this-is-not-typedarray-instance.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---