blob: f56195d00d218e95fbfc32636a226aef7f26fc9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Check that setters throw TypeError when passed no arguments, instead of crashing.
function check(obj) {
let proto = Object.getPrototypeOf(obj);
let props = Object.getOwnPropertyNames(proto);
for (let prop of props) {
let desc = Object.getOwnPropertyDescriptor(proto, prop);
if (desc.set) {
print("bleah: " + JSON.stringify(prop));
assertEq(typeof desc.set, 'function');
try {
desc.set.call(obj);
assertEq("should have thrown TypeError", false);
} catch (e) {
assertEq(e instanceof TypeError, true);
}
}
}
}
var dbg = new Debugger;
var g = newGlobal({newCompartment: true});
var gw = dbg.addDebuggee(g);
// Debugger
check(dbg);
// Debugger.Memory
check(dbg.memory);
// Debugger.Object
g.eval('function f() { debugger; }');
var fw = gw.getOwnPropertyDescriptor('f').value;
check(fw);
// Debugger.Script
check(fw.script);
// Debugger.Source
check(fw.script.source);
// Debugger.Environment
check(fw.environment);
// Debugger.Frame
var log = '';
dbg.onDebuggerStatement = function(frame) {
log += 'd';
check(frame);
}
g.eval('f()');
assertEq(log, 'd');
|