summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-enabled-01.js
blob: 3c4ab227f41ca4b623d683892794a0b9300ba7f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var desc = Object.getOwnPropertyDescriptor(Debugger.prototype, "enabled");
assertEq(typeof desc.get, 'function');
assertEq(typeof desc.set, 'function');

var g = newGlobal();
var hits;
var dbg = new Debugger(g);
assertEq(dbg.enabled, true);
dbg.onDebuggerStatement = function () { hits++; };

var vals = [true, false, null, undefined, NaN, "blah", {}];
for (var i = 0; i < vals.length; i++) {
    dbg.enabled = vals[i];
    assertEq(dbg.enabled, !!vals[i]);
    hits = 0;
    g.eval("debugger;");
    assertEq(hits, vals[i] ? 1 : 0);
}