summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Object-defineProperty-13.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Object-defineProperty-13.js')
-rw-r--r--js/src/jit-test/tests/debug/Object-defineProperty-13.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Object-defineProperty-13.js b/js/src/jit-test/tests/debug/Object-defineProperty-13.js
new file mode 100644
index 0000000000..3bfd554c14
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-13.js
@@ -0,0 +1,16 @@
+// defineProperty throws if a getter or setter is neither undefined nor callable.
+
+load(libdir + "asserts.js");
+
+var g = newGlobal({newCompartment: true});
+var dbg = new Debugger;
+var gw = dbg.addDebuggee(g);
+
+for (let v of [null, false, 'bad', 0, 2.76, {}]) {
+ assertThrowsInstanceOf(function () {
+ gw.defineProperty("p", {configurable: true, get: v});
+ }, TypeError);
+ assertThrowsInstanceOf(function () {
+ gw.defineProperty("p", {configurable: true, set: v});
+ }, TypeError);
+}