| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 InspectorTest.log('Test for Debugger.getPossibleBreakpoints'); | 5 InspectorTest.log('Test for Debugger.getPossibleBreakpoints'); |
| 6 | 6 |
| 7 Protocol.Runtime.enable(); | 7 Protocol.Runtime.enable(); |
| 8 Protocol.Debugger.enable(); | 8 Protocol.Debugger.enable(); |
| 9 | 9 |
| 10 InspectorTest.runTestSuite([ | 10 InspectorTest.runTestSuite([ |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 var source = 'function foo(){}\nfunction boo(){}\nfunction main(f1,f2){}\nma
in(foo(), boo());\n'; | 146 var source = 'function foo(){}\nfunction boo(){}\nfunction main(f1,f2){}\nma
in(foo(), boo());\n'; |
| 147 waitForPossibleBreakpoints(source, { lineNumber: 0, columnNumber: 0 }) | 147 waitForPossibleBreakpoints(source, { lineNumber: 0, columnNumber: 0 }) |
| 148 .then(message => dumpAllLocations(message, source)) | 148 .then(message => dumpAllLocations(message, source)) |
| 149 .then(next); | 149 .then(next); |
| 150 } | 150 } |
| 151 ]); | 151 ]); |
| 152 | 152 |
| 153 function compileScript(source, origin) { | 153 function compileScript(source, origin) { |
| 154 var promise = Protocol.Debugger.onceScriptParsed().then(message => message.par
ams.scriptId); | 154 var promise = Protocol.Debugger.onceScriptParsed().then(message => message.par
ams.scriptId); |
| 155 if (!origin) origin = { name: '', line_offset: 0, column_offset: 0 }; | 155 if (!origin) origin = { name: '', line_offset: 0, column_offset: 0 }; |
| 156 utils.compileAndRunWithOrigin(source, origin.name, origin.line_offset, origin.
column_offset, false); | 156 InspectorTest.addScript(source, origin.line_offset, origin.column_offset, orig
in.name); |
| 157 return promise; | 157 return promise; |
| 158 } | 158 } |
| 159 | 159 |
| 160 function waitForPossibleBreakpoints(source, start, end, origin) { | 160 function waitForPossibleBreakpoints(source, start, end, origin) { |
| 161 return compileScript(source, origin) | 161 return compileScript(source, origin) |
| 162 .then(scriptId => { (start || {}).scriptId = scriptId; (end || {}).scriptId
= scriptId }) | 162 .then(scriptId => { (start || {}).scriptId = scriptId; (end || {}).scriptId
= scriptId }) |
| 163 .then(() => Protocol.Debugger.getPossibleBreakpoints({ start: start, end: en
d })); | 163 .then(() => Protocol.Debugger.getPossibleBreakpoints({ start: start, end: en
d })); |
| 164 } | 164 } |
| 165 | 165 |
| 166 function waitForPossibleBreakpointsOnPause(source, start, end, next) { | 166 function waitForPossibleBreakpointsOnPause(source, start, end, next) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 var lineNumber = location.lineNumber - lineOffset; | 225 var lineNumber = location.lineNumber - lineOffset; |
| 226 var columnNumber = lineNumber !== 0 ? location.columnNumber : location.columnN
umber - columnOffset; | 226 var columnNumber = lineNumber !== 0 ? location.columnNumber : location.columnN
umber - columnOffset; |
| 227 | 227 |
| 228 var line = sourceLines[lineNumber]; | 228 var line = sourceLines[lineNumber]; |
| 229 line = line.slice(0, columnNumber) + '^' + line.slice(columnNumber); | 229 line = line.slice(0, columnNumber) + '^' + line.slice(columnNumber); |
| 230 sourceLines[lineNumber] = line; | 230 sourceLines[lineNumber] = line; |
| 231 InspectorTest.log(sourceLines.join('\n')); | 231 InspectorTest.log(sourceLines.join('\n')); |
| 232 Protocol.Debugger.resume(); | 232 Protocol.Debugger.resume(); |
| 233 } | 233 } |
| OLD | NEW |