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 Debugger.getPossibleBreakpoints'); |
| 6 |
| 7 var source = read('test/inspector/debugger/resources/break-locations.js'); |
| 8 InspectorTest.addScript(source); |
| 9 |
| 10 Protocol.Debugger.onceScriptParsed() |
| 11 .then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumbe
r: 0, columnNumber : 0, scriptId: message.params.scriptId }})) |
| 12 .then(dumpAllLocations) |
| 13 .then(InspectorTest.completeTest); |
| 14 Protocol.Debugger.enable(); |
| 15 |
| 16 function dumpAllLocations(message) { |
| 17 if (message.error) { |
| 18 InspectorTest.logMessage(message); |
| 19 return; |
| 20 } |
| 21 var lines = source.split('\n'); |
| 22 var locations = message.result.locations.sort((loc1, loc2) => { |
| 23 if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineN
umber; |
| 24 return loc2.columnNumber - loc1.columnNumber; |
| 25 }); |
| 26 for (var location of locations) { |
| 27 var line = lines[location.lineNumber]; |
| 28 line = line.slice(0, location.columnNumber) + '#' + line.slice(location.colu
mnNumber); |
| 29 lines[location.lineNumber] = line; |
| 30 } |
| 31 InspectorTest.log(lines.join('\n')); |
| 32 return message; |
| 33 } |
OLD | NEW |