summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/class-05.js
blob: 4af7c23f832f07914992824dd99d4e9c504f4c5e (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
// |jit-test| error: TypeError

let g = newGlobal();
let dbg = Debugger(g);

let forceException = g.eval(`
    (class extends class {} {
        // Calling this will return a primitive immediately.
        constructor() {
            debugger;
            return {};
        }
    })
`);

let handler = {
    hit() {
        return {
            // Force the return of an illegal value.
            return: 1
        }
    }
};

dbg.onDebuggerStatement = function(frame) {
    var line0 = frame.script.getOffsetLocation(frame.offset).lineNumber;
    var offs = frame.script.getLineOffsets(line0 + 1);
    frame.script.setBreakpoint(offs[0], handler);
}

new forceException;