Index: test/inspector/debugger/get-possible-breakpoints-master.js |
diff --git a/test/inspector/debugger/get-possible-breakpoints-master.js b/test/inspector/debugger/get-possible-breakpoints-master.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5926a89e7dac9bd23be9c3575cd87e970a4c39e1 |
--- /dev/null |
+++ b/test/inspector/debugger/get-possible-breakpoints-master.js |
@@ -0,0 +1,34 @@ |
+// Copyright 2017 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+print('Checks Debugger.getPossibleBreakpoints'); |
+ |
+var source = read('test/inspector/debugger/resources/break-locations.js'); |
+InspectorTest.addScript(source); |
+ |
+Protocol.Debugger.onceScriptParsed() |
+ .then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumber: 0, columnNumber : 0, scriptId: message.params.scriptId }})) |
+ .then(dumpAllLocations) |
+ .then(InspectorTest.completeTest); |
+Protocol.Debugger.enable(); |
+ |
+function dumpAllLocations(message) { |
+ if (message.error) { |
+ InspectorTest.logMessage(message); |
+ return; |
+ } |
+ var lines = source.split('\n'); |
+ var locations = message.result.locations.sort((loc1, loc2) => { |
+ if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineNumber; |
+ return loc2.columnNumber - loc1.columnNumber; |
+ }); |
+ for (var location of locations) { |
+ var line = lines[location.lineNumber]; |
+ line = line.slice(0, location.columnNumber) + '#' + line.slice(location.columnNumber); |
+ lines[location.lineNumber] = line; |
+ } |
+ lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); |
+ InspectorTest.log(lines.join('\n')); |
+ return message; |
+} |