summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js')
-rw-r--r--js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js b/js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js
new file mode 100644
index 000000000..5cae35a38
--- /dev/null
+++ b/js/src/jit-test/tests/collections/WeakMap-constructor-nonnull.js
@@ -0,0 +1,11 @@
+// WeakMap constructor should throw when key is nonnull.
+
+load(libdir + "asserts.js");
+
+var v1 = 42;
+
+var primitive = 10;
+assertThrowsInstanceOf(() => new WeakMap([[primitive, v1]]), TypeError);
+
+var empty_array = [];
+assertThrowsInstanceOf(() => new WeakMap([empty_array]), TypeError);