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 000000000..7da13e75c
--- /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();
+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);
+}