breakpoint-dot-generator.js (1074B)
1 const g = newGlobal({ newCompartment: true }); 2 g.eval(` 3 function* func() { 4 } 5 `); 6 const d = new Debugger(); 7 const dg = d.addDebuggee(g); 8 const script = dg.makeDebuggeeValue(g.func).script; 9 10 // The following test assumes the above `func` function has the following 11 // bytecode sequences: 12 // 13 // 00000: Generator # GENERATOR 14 // 00001: SetAliasedVar ".generator" # GENERATOR 15 // 00007: InitialYield 0 # RVAL GENERATOR RESUMEKIND 16 17 // Setting a breakpoint at `SetAliasedVar ".generator"` should be disallow. 18 let caught = false; 19 try { 20 script.setBreakpoint(1, {}); 21 } catch (e) { 22 caught = true; 23 assertEq(e.message.includes("not allowed"), true); 24 } 25 26 assertEq(caught, true); 27 28 // Setting breakpoints to other opcodes should be allowed. 29 script.setBreakpoint(0, {}); 30 script.setBreakpoint(7, {}); 31 32 // Offset 1 shouldn't be exposed. 33 assertEq(script.getPossibleBreakpoints().some(p => p.offset == 1), false); 34 assertEq(script.getAllColumnOffsets().some(p => p.offset == 1), false); 35 assertEq(script.getEffectfulOffsets().includes(1), false);