summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Object-defineProperty-13.js
blob: 7da13e75c0419d21a3dceb05021148583a3d352b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}