OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startBlank(''); |
| 3 |
| 4 function printCallFrames(response) { |
| 5 var callFrames = response.params.callFrames; |
| 6 var topCallFrame = callFrames[0]; |
| 7 if (topCallFrame.functionName.startsWith('blackboxed')) |
| 8 testRunner.log('FAIL: blackboxed function in top call frame'); |
| 9 for (var callFrame of callFrames) |
| 10 testRunner.log(callFrame.functionName + ': ' + callFrame.location.lineNumb
er + ':' + callFrame.location.columnNumber); |
| 11 testRunner.log(''); |
| 12 } |
| 13 |
| 14 function printError(response) { |
| 15 if (response.error) |
| 16 testRunner.log(response.error.message); |
| 17 } |
| 18 |
| 19 await session.evaluate( |
| 20 `function blackboxedBoo() |
| 21 { |
| 22 var a = 42; |
| 23 var b = foo(); |
| 24 return a + b; |
| 25 } |
| 26 //# sourceURL=blackboxed-script.js |
| 27 `); |
| 28 |
| 29 await session.evaluate( |
| 30 `function notBlackboxedFoo() |
| 31 { |
| 32 var a = 42; |
| 33 var b = blackboxedBoo(); |
| 34 return a + b; |
| 35 } |
| 36 |
| 37 function blackboxedFoo() |
| 38 { |
| 39 var a = 42; |
| 40 var b = notBlackboxedFoo(); |
| 41 return a + b; |
| 42 } |
| 43 |
| 44 function notBlackboxedBoo() |
| 45 { |
| 46 var a = 42; |
| 47 var b = blackboxedFoo(); |
| 48 return a + b; |
| 49 } |
| 50 //# sourceURL=mixed-source.js |
| 51 `); |
| 52 |
| 53 await session.evaluate(` |
| 54 |
| 55 |
| 56 |
| 57 |
| 58 |
| 59 function testFunction() |
| 60 { |
| 61 notBlackboxedBoo(); // for setup ranges and stepOut |
| 62 notBlackboxedBoo(); // for stepIn |
| 63 } |
| 64 |
| 65 function foo() |
| 66 { |
| 67 debugger; |
| 68 return 239; |
| 69 } |
| 70 `); |
| 71 |
| 72 await dp.Debugger.enable(); |
| 73 session.evaluate('setTimeout(testFunction, 0);'); |
| 74 |
| 75 var response = await dp.Debugger.oncePaused(); |
| 76 printCallFrames(response); |
| 77 var scriptId = response.params.callFrames[2].location.scriptId; |
| 78 |
| 79 printError(await dp.Debugger.setBlackboxedRanges({ |
| 80 scriptId: response.params.callFrames[1].location.scriptId, |
| 81 positions: [{lineNumber: 0, columnNumber: 0}] // blackbox ranges for blackbo
xed.js |
| 82 })); |
| 83 |
| 84 var incorrectPositions = [ |
| 85 [{lineNumber: 0, columnNumber: 0}, {lineNumber: 0, columnNumber: 0}], |
| 86 [{lineNumber: 0, columnNumber: 1}, {lineNumber: 0, columnNumber: 0}], |
| 87 [{lineNumber: 0, columnNumber: -1}], |
| 88 ]; |
| 89 for (var positions of incorrectPositions) { |
| 90 testRunner.log('Try to set positions: ' + JSON.stringify(positions)); |
| 91 printError(await dp.Debugger.setBlackboxedRanges({scriptId, positions})); |
| 92 } |
| 93 |
| 94 await dp.Debugger.setBlackboxedRanges({ |
| 95 scriptId, |
| 96 positions: [{lineNumber: 6, columnNumber: 0}, {lineNumber: 14, columnNumber:
0}] // blackbox ranges for mixed.js |
| 97 }); |
| 98 |
| 99 testRunner.log('action: stepOut'); |
| 100 dp.Debugger.stepOut(); |
| 101 printCallFrames(await dp.Debugger.oncePaused()); |
| 102 testRunner.log('action: stepOut'); |
| 103 dp.Debugger.stepOut(); |
| 104 printCallFrames(await dp.Debugger.oncePaused()); |
| 105 testRunner.log('action: stepOut'); |
| 106 dp.Debugger.stepOut(); |
| 107 printCallFrames(await dp.Debugger.oncePaused()); |
| 108 testRunner.log('action: stepInto'); |
| 109 dp.Debugger.stepInto(); |
| 110 printCallFrames(await dp.Debugger.oncePaused()); |
| 111 testRunner.log('action: stepOver'); |
| 112 dp.Debugger.stepOver(); |
| 113 await dp.Debugger.oncePaused(); |
| 114 testRunner.log('action: stepInto'); |
| 115 dp.Debugger.stepInto(); |
| 116 printCallFrames(await dp.Debugger.oncePaused()); |
| 117 testRunner.log('action: stepOver'); |
| 118 dp.Debugger.stepOver(); |
| 119 await dp.Debugger.oncePaused(); |
| 120 testRunner.log('action: stepInto'); |
| 121 dp.Debugger.stepInto(); |
| 122 printCallFrames(await dp.Debugger.oncePaused()); |
| 123 testRunner.log('action: stepOver'); |
| 124 dp.Debugger.stepOver(); |
| 125 await dp.Debugger.oncePaused(); |
| 126 testRunner.log('action: stepInto'); |
| 127 dp.Debugger.stepInto(); |
| 128 printCallFrames(await dp.Debugger.oncePaused()); |
| 129 await dp.Debugger.resume(); |
| 130 testRunner.completeTest(); |
| 131 }) |
OLD | NEW |