class-derived-default-constructor-2.js (923B)
1 const g = newGlobal({newCompartment: true}); 2 g.eval(` 3 class Base {} 4 class Derived extends Base {} 5 this.Derived = Derived; 6 `); 7 8 const dbg = new Debugger(g); 9 const gw = dbg.addDebuggee(g); 10 11 let calleeCount = 0; 12 13 dbg.onEnterFrame = frame => { 14 // Ignore any other callees. 15 if (frame.callee !== gw.makeDebuggeeValue(g.Derived)) { 16 return; 17 } 18 19 calleeCount++; 20 21 const names = frame.environment.names(); 22 23 // Add a hole to all variables. This mustn't affect the implicit rest-argument 24 // of the default derived class constructor, otherwise we'll crash when 25 // passing the rest-argument to the super spread-call. 26 frame.onStep = () => { 27 names.forEach(name => { 28 var args = frame.environment.getVariable(name); 29 if (args && args.deleteProperty) { 30 args.deleteProperty(0); 31 } 32 }); 33 }; 34 }; 35 36 new g.Derived(1, 2); 37 38 // |Derived| should be called at most once. 39 assertEq(calleeCount, 1);