OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 print('Checks framework debugging with blackboxed ranges.'); |
| 6 |
| 7 InspectorTest.addScript(` |
| 8 function foo() { |
| 9 return boo(); |
| 10 } |
| 11 function boo() { |
| 12 return 42; |
| 13 } |
| 14 function testFunction() { |
| 15 foo(); |
| 16 } |
| 17 //# sourceURL=test.js`, |
| 18 7, 26); |
| 19 |
| 20 InspectorTest.setupScriptMap(); |
| 21 Protocol.Debugger.onPaused(message => { |
| 22 InspectorTest.logCallFrames(message.params.callFrames); |
| 23 InspectorTest.log(''); |
| 24 Protocol.Debugger.stepInto(); |
| 25 }); |
| 26 var scriptId; |
| 27 Protocol.Debugger.onScriptParsed(message => { |
| 28 if (message.params.url === 'test.js') { |
| 29 scriptId = message.params.scriptId; |
| 30 } |
| 31 }); |
| 32 |
| 33 Protocol.Debugger.enable(); |
| 34 Protocol.Debugger.setBlackboxPatterns({patterns: ['expr\.js']}) |
| 35 .then(() => InspectorTest.runTestSuite(testSuite)); |
| 36 |
| 37 var testSuite = [ |
| 38 function testEntireScript(next) { |
| 39 testPositions([position(0, 0)]).then(next); |
| 40 }, |
| 41 function testFooNotBlackboxed(next) { |
| 42 testPositions([position(11, 0)]).then(next); |
| 43 }, |
| 44 function testFooBlackboxed(next) { |
| 45 testPositions([position(8,0), position(10, 0)]).then(next); |
| 46 }, |
| 47 function testBooPartiallyBlackboxed1(next) { |
| 48 // first line is not blackboxed, second and third - blackboxed. |
| 49 testPositions([position(12, 0)]).then(next); |
| 50 }, |
| 51 function testBooPartiallyBlackboxed2(next) { |
| 52 // first line is blackboxed, second - not, third - blackboxed. |
| 53 testPositions([ |
| 54 position(11, 0), position(12, 0), position(13, 0) |
| 55 ]).then(next); |
| 56 }, |
| 57 function testBooPartiallyBlackboxed3(next) { |
| 58 // first line is blackboxed, second and third - not. |
| 59 testPositions([ |
| 60 position(11, 0), position(12, 0), position(14, 0) |
| 61 ]).then(next); |
| 62 } |
| 63 ]; |
| 64 |
| 65 function testPositions(positions) { |
| 66 schedulePauseOnNextStatement('', ''); |
| 67 return Protocol.Debugger |
| 68 .setBlackboxedRanges({scriptId: scriptId, positions: positions}) |
| 69 .then(InspectorTest.logMessage) |
| 70 .then( |
| 71 () => Protocol.Runtime.evaluate( |
| 72 {expression: 'testFunction()//# sourceURL=expr.js'})); |
| 73 } |
| 74 |
| 75 function position(line, column) { |
| 76 return {lineNumber: line, columnNumber: column}; |
| 77 } |
OLD | NEW |