summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Object-defineProperty-13.js
blob: 3bfd554c14a3d887cb65cd9444850e5446b5eab1 (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({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);
}