summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onPop-disabled.js
blob: f02e41f23f36f24ec059820536455c1047e2390b (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
// An onPop handler in a disabled Debugger's frame shouldn't fire.

var g = newGlobal();
var dbg = new Debugger(g);
g.eval('function f() { debugger; }');
var log;
dbg.onEnterFrame = function handleEnterFrame(f) {
    log += '(';
    assertEq(f.callee.name, 'f');
    f.onPop = function handlePop(c) {
        log += ')';
        assertEq(dbg.enabled, true);
    };
};

var enable;
dbg.onDebuggerStatement = function handleDebugger(f) {
    dbg.enabled = enable;
}


// This should fire the onEnterFrame and onPop handlers.
log = 'a';
enable = true;
g.f();

// This should fire the onEnterFrame handler, but not the onPop.
log += 'b';
enable = false;
g.f();

// This should fire neither.
log += 'c';
dbg.enabled = false;
enable = false;
g.f();

// This should fire both again.
log += 'd';
dbg.enabled = true;
enable = true;
g.f();

assertEq(log, 'a()b(cd()');