| 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 = {}; | 5 InspectorTest = {}; |
| 6 InspectorTest._dispatchTable = new Map(); | 6 InspectorTest._dispatchTable = new Map(); |
| 7 InspectorTest._requestId = 0; | 7 InspectorTest._requestId = 0; |
| 8 InspectorTest._dumpInspectorProtocolMessages = false; | 8 InspectorTest._dumpInspectorProtocolMessages = false; |
| 9 InspectorTest._eventHandler = {}; | 9 InspectorTest._eventHandler = {}; |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 .then(message => script.scriptSource = message.result.scriptSource) | 153 .then(message => script.scriptSource = message.result.scriptSource) |
| 154 .then(dumpSourceWithLocation); | 154 .then(dumpSourceWithLocation); |
| 155 } | 155 } |
| 156 return Promise.resolve().then(dumpSourceWithLocation); | 156 return Promise.resolve().then(dumpSourceWithLocation); |
| 157 | 157 |
| 158 function dumpSourceWithLocation() { | 158 function dumpSourceWithLocation() { |
| 159 var lines = script.scriptSource.split('\n'); | 159 var lines = script.scriptSource.split('\n'); |
| 160 var line = lines[location.lineNumber]; | 160 var line = lines[location.lineNumber]; |
| 161 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); | 161 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); |
| 162 lines[location.lineNumber] = line; | 162 lines[location.lineNumber] = line; |
| 163 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); |
| 163 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location
.lineNumber + 2).join('\n')); | 164 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location
.lineNumber + 2).join('\n')); |
| 164 InspectorTest.log(''); | 165 InspectorTest.log(''); |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 | 168 |
| 168 InspectorTest.logSourceLocations = function(locations) { | 169 InspectorTest.logSourceLocations = function(locations) { |
| 169 if (locations.length == 0) return Promise.resolve(); | 170 if (locations.length == 0) return Promise.resolve(); |
| 170 return InspectorTest.logSourceLocation(locations[0]) | 171 return InspectorTest.logSourceLocation(locations[0]) |
| 171 .then(() => InspectorTest.logSourceLocations(locations.splice(1))); | 172 .then(() => InspectorTest.logSourceLocations(locations.splice(1))); |
| 172 } | 173 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 304 } |
| 304 } catch (e) { | 305 } catch (e) { |
| 305 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 306 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
| 306 InspectorTest.completeTest(); | 307 InspectorTest.completeTest(); |
| 307 } | 308 } |
| 308 } | 309 } |
| 309 | 310 |
| 310 InspectorTest.loadScript = function(fileName) { | 311 InspectorTest.loadScript = function(fileName) { |
| 311 InspectorTest.addScript(utils.read(fileName)); | 312 InspectorTest.addScript(utils.read(fileName)); |
| 312 } | 313 } |
| OLD | NEW |