| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 .then(dumpSourceWithLocation); | 127 .then(dumpSourceWithLocation); |
| 128 } | 128 } |
| 129 return Promise.resolve().then(dumpSourceWithLocation); | 129 return Promise.resolve().then(dumpSourceWithLocation); |
| 130 | 130 |
| 131 function dumpSourceWithLocation() { | 131 function dumpSourceWithLocation() { |
| 132 var location = callFrame.location; | 132 var location = callFrame.location; |
| 133 var lines = script.scriptSource.split('\n'); | 133 var lines = script.scriptSource.split('\n'); |
| 134 var line = lines[location.lineNumber]; | 134 var line = lines[location.lineNumber]; |
| 135 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); | 135 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); |
| 136 lines[location.lineNumber] = line; | 136 lines[location.lineNumber] = line; |
| 137 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); |
| 137 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location
.lineNumber + 2).join('\n')); | 138 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location
.lineNumber + 2).join('\n')); |
| 138 InspectorTest.log(''); | 139 InspectorTest.log(''); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 InspectorTest.logAsyncStackTrace = function(asyncStackTrace) | 143 InspectorTest.logAsyncStackTrace = function(asyncStackTrace) |
| 143 { | 144 { |
| 144 while (asyncStackTrace) { | 145 while (asyncStackTrace) { |
| 145 if (asyncStackTrace.promiseCreationFrame) { | 146 if (asyncStackTrace.promiseCreationFrame) { |
| 146 var frame = asyncStackTrace.promiseCreationFrame; | 147 var frame = asyncStackTrace.promiseCreationFrame; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 267 } |
| 267 } catch (e) { | 268 } catch (e) { |
| 268 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 269 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
| 269 InspectorTest.completeTest(); | 270 InspectorTest.completeTest(); |
| 270 } | 271 } |
| 271 } | 272 } |
| 272 | 273 |
| 273 InspectorTest.loadScript = function(fileName) { | 274 InspectorTest.loadScript = function(fileName) { |
| 274 InspectorTest.addScript(read(fileName)); | 275 InspectorTest.addScript(read(fileName)); |
| 275 } | 276 } |
| OLD | NEW |