|
1 // Debugger.prototype.onDebuggerStatement |
|
2 |
|
3 load(libdir + 'asserts.js'); |
|
4 |
|
5 var g = newGlobal(); |
|
6 var dbg = new Debugger(g); |
|
7 gc(); // don't assert marking debug hooks |
|
8 assertEq(dbg.onDebuggerStatement, undefined); |
|
9 |
|
10 function f() {} |
|
11 |
|
12 assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = null; }, TypeError); |
|
13 assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = "bad"; }, TypeError); |
|
14 assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = {}; }, TypeError); |
|
15 dbg.onDebuggerStatement = f; |
|
16 assertEq(dbg.onDebuggerStatement, f); |
|
17 |
|
18 assertEq(Object.getOwnPropertyNames(dbg).length, 0); |
|
19 var desc = Object.getOwnPropertyDescriptor(Debugger.prototype, "onDebuggerStatement"); |
|
20 assertEq(desc.configurable, true); |
|
21 assertEq(desc.enumerable, false); |
|
22 |
|
23 assertThrowsInstanceOf(function () { desc.get(); }, TypeError); |
|
24 assertThrowsInstanceOf(function () { desc.get.call(undefined); }, TypeError); |
|
25 assertThrowsInstanceOf(function () { desc.get.call(Debugger.prototype); }, TypeError); |
|
26 assertEq(desc.get.call(dbg), f); |
|
27 |
|
28 assertThrowsInstanceOf(function () { desc.set(); }, TypeError); |
|
29 assertThrowsInstanceOf(function () { desc.set.call(dbg); }, TypeError); |
|
30 assertThrowsInstanceOf(function () { desc.set.call({}, f); }, TypeError); |
|
31 assertThrowsInstanceOf(function () { desc.set.call(Debugger.prototype, f); }, TypeError); |