summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/TypedArray/from_typedarray_fastpath_detached.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/TypedArray/from_typedarray_fastpath_detached.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/src/tests/non262/TypedArray/from_typedarray_fastpath_detached.js b/js/src/tests/non262/TypedArray/from_typedarray_fastpath_detached.js
new file mode 100644
index 0000000000..d1f574cb10
--- /dev/null
+++ b/js/src/tests/non262/TypedArray/from_typedarray_fastpath_detached.js
@@ -0,0 +1,10 @@
+// Ensure the fast-path when TypedArray.from is called with a TypedArray still
+// checks for detached buffers.
+
+var ta = new Int32Array(4);
+detachArrayBuffer(ta.buffer);
+
+assertThrowsInstanceOf(() => Int32Array.from(ta), TypeError);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);