| 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 InspectorTest._commandsForLogging = new Set(); | 10 InspectorTest._commandsForLogging = new Set(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 InspectorTest.logSourceLocation = function(location) | 146 InspectorTest.logSourceLocation = function(location) |
| 147 { | 147 { |
| 148 var scriptId = location.scriptId; | 148 var scriptId = location.scriptId; |
| 149 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { | 149 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { |
| 150 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot
ocol.Debugger.enable."); | 150 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot
ocol.Debugger.enable."); |
| 151 InspectorTest.completeTest(); | 151 InspectorTest.completeTest(); |
| 152 } | 152 } |
| 153 var script = InspectorTest._scriptMap.get(scriptId); | 153 var script = InspectorTest._scriptMap.get(scriptId); |
| 154 if (!script.scriptSource) { | 154 if (!script.scriptSource) { |
| 155 return Protocol.Debugger.getScriptSource({ scriptId }) | 155 // TODO(kozyatinskiy): doesn't assume that contextId == contextGroupId. |
| 156 return Protocol.Debugger.getScriptSource({ scriptId }, script.executionConte
xtId) |
| 156 .then(message => script.scriptSource = message.result.scriptSource) | 157 .then(message => script.scriptSource = message.result.scriptSource) |
| 157 .then(dumpSourceWithLocation); | 158 .then(dumpSourceWithLocation); |
| 158 } | 159 } |
| 159 return Promise.resolve().then(dumpSourceWithLocation); | 160 return Promise.resolve().then(dumpSourceWithLocation); |
| 160 | 161 |
| 161 function dumpSourceWithLocation() { | 162 function dumpSourceWithLocation() { |
| 162 var lines = script.scriptSource.split('\n'); | 163 var lines = script.scriptSource.split('\n'); |
| 163 var line = lines[location.lineNumber]; | 164 var line = lines[location.lineNumber]; |
| 164 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); | 165 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); |
| 165 lines[location.lineNumber] = line; | 166 lines[location.lineNumber] = line; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 311 } |
| 311 } catch (e) { | 312 } catch (e) { |
| 312 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 313 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
| 313 InspectorTest.completeTest(); | 314 InspectorTest.completeTest(); |
| 314 } | 315 } |
| 315 } | 316 } |
| 316 | 317 |
| 317 InspectorTest.loadScript = function(fileName) { | 318 InspectorTest.loadScript = function(fileName) { |
| 318 InspectorTest.addScript(utils.read(fileName)); | 319 InspectorTest.addScript(utils.read(fileName)); |
| 319 } | 320 } |
| OLD | NEW |