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 131 matching lines...) Loading... |
142 | 142 |
143 InspectorTest.logSourceLocation = function(location) | 143 InspectorTest.logSourceLocation = function(location) |
144 { | 144 { |
145 var scriptId = location.scriptId; | 145 var scriptId = location.scriptId; |
146 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { | 146 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { |
147 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot
ocol.Debugger.enable."); | 147 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot
ocol.Debugger.enable."); |
148 InspectorTest.completeTest(); | 148 InspectorTest.completeTest(); |
149 } | 149 } |
150 var script = InspectorTest._scriptMap.get(scriptId); | 150 var script = InspectorTest._scriptMap.get(scriptId); |
151 if (!script.scriptSource) { | 151 if (!script.scriptSource) { |
152 return Protocol.Debugger.getScriptSource({ scriptId }) | 152 // TODO(kozyatinskiy): doesn't assume that contextId == contextGroupId. |
| 153 return Protocol.Debugger.getScriptSource({ scriptId }, script.executionConte
xtId) |
153 .then(message => script.scriptSource = message.result.scriptSource) | 154 .then(message => script.scriptSource = message.result.scriptSource) |
154 .then(dumpSourceWithLocation); | 155 .then(dumpSourceWithLocation); |
155 } | 156 } |
156 return Promise.resolve().then(dumpSourceWithLocation); | 157 return Promise.resolve().then(dumpSourceWithLocation); |
157 | 158 |
158 function dumpSourceWithLocation() { | 159 function dumpSourceWithLocation() { |
159 var lines = script.scriptSource.split('\n'); | 160 var lines = script.scriptSource.split('\n'); |
160 var line = lines[location.lineNumber]; | 161 var line = lines[location.lineNumber]; |
161 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); | 162 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col
umnNumber) || ''); |
162 lines[location.lineNumber] = line; | 163 lines[location.lineNumber] = line; |
(...skipping 140 matching lines...) 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 |