Frame-onPop-return.js (1274B)
1 // |jit-test| error: TestComplete 2 // onPop fires when frames return normally. 3 4 var g = newGlobal({newCompartment: true}); 5 var dbg = new Debugger(g); 6 7 function test(type, provocation) { 8 var log; 9 var wasConstructing; 10 11 // Help people figure out which 'test' call failed. 12 print("type: " + JSON.stringify(type)); 13 print("provocation: " + JSON.stringify(provocation)); 14 15 dbg.onDebuggerStatement = function handleDebuggerStatement(f) { 16 log += 'd'; 17 }; 18 19 dbg.onEnterFrame = function handleEnterFrame(f) { 20 log += '('; 21 assertEq(f.type, type); 22 wasConstructing = f.constructing; 23 f.onPop = function handlePop(c) { 24 log += ')'; 25 assertEq(c.return, 'compliment'); 26 }; 27 }; 28 29 log = ''; 30 var result = provocation(); 31 if (wasConstructing) 32 assertEq(typeof result, "object"); 33 else 34 assertEq(result, 'compliment'); 35 assertEq(log, "(d)"); 36 37 print(); 38 } 39 40 g.eval("function f() { debugger; return 'compliment'; }"); 41 test("call", g.f); 42 test("call", function () { return new g.f; }); 43 test("eval", function () { return g.eval("debugger; \'compliment\';"); }); 44 test("global", function () { return g.evaluate("debugger; \'compliment\';"); }); 45 throw 'TestComplete';