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(); | |
7 InspectorTest._requestId = 0; | |
8 InspectorTest._dumpInspectorProtocolMessages = false; | 6 InspectorTest._dumpInspectorProtocolMessages = false; |
9 InspectorTest._eventHandler = {}; | |
10 InspectorTest._commandsForLogging = new Set(); | 7 InspectorTest._commandsForLogging = new Set(); |
11 | 8 |
12 Protocol = new Proxy({}, { | 9 InspectorTest.createContextGroup = function() { |
13 get: function(target, agentName, receiver) { | 10 var contextGroup = {}; |
14 return new Proxy({}, { | 11 contextGroup.id = utils.createContextGroup(); |
15 get: function(target, methodName, receiver) { | 12 contextGroup.schedulePauseOnNextStatement = (reason, details) => utils.schedul ePauseOnNextStatement(contextGroup.id, reason, details); |
16 const eventPattern = /^on(ce)?([A-Z][A-Za-z0-9]+)/; | 13 contextGroup.cancelPauseOnNextStatement = () => utils.cancelPauseOnNextStateme nt(contextGroup.id); |
17 var match = eventPattern.exec(methodName); | 14 contextGroup.addScript = (string, lineOffset, columnOffset, url) => utils.comp ileAndRunWithOrigin(contextGroup.id, string, url || '', lineOffset || 0, columnO ffset || 0, false); |
18 if (!match) { | 15 contextGroup.addModule = (string, url, lineOffset, columnOffset) => utils.comp ileAndRunWithOrigin(contextGroup.id, string, url, lineOffset || 0, columnOffset || 0, true); |
19 return (args, contextGroupId) => InspectorTest._sendCommandPromise(`${ agentName}.${methodName}`, args || {}, contextGroupId); | 16 return contextGroup; |
20 } else { | 17 } |
21 var eventName = match[2]; | 18 |
22 eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1); | 19 InspectorTest._sessions = new Map(); |
23 if (match[1]) | 20 InspectorTest.createSession = function(contextGroup) { |
24 return () => InspectorTest._waitForEventPromise( | 21 var session = { |
25 `${agentName}.${eventName}`); | 22 contextGroup: contextGroup, |
26 else | 23 _dispatchTable: new Map(), |
27 return (listener) => { InspectorTest._eventHandler[`${agentName}.${e ventName}`] = listener }; | 24 _eventHandler: {}, |
25 _requestId: 0, | |
26 }; | |
27 session.Protocol = new Proxy({}, { | |
28 get: function(target, agentName, receiver) { | |
29 return new Proxy({}, { | |
30 get: function(target, methodName, receiver) { | |
31 const eventPattern = /^on(ce)?([A-Z][A-Za-z0-9]+)/; | |
32 var match = eventPattern.exec(methodName); | |
33 if (!match) { | |
34 return args => session._sendCommandPromise(`${agentName}.${methodNam e}`, args || {}); | |
35 } else { | |
36 var eventName = match[2]; | |
37 eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1); | |
38 if (match[1]) | |
39 return () => InspectorTest._waitForEventPromise(session, `${agentN ame}.${eventName}`); | |
40 else | |
41 return (listener) => { session._eventHandler[`${agentName}.${event Name}`] = listener }; | |
42 } | |
28 } | 43 } |
29 } | 44 }); |
30 }); | 45 } |
46 }); | |
47 session.id = utils.connectSession(contextGroup.id); | |
48 InspectorTest._sessions.set(session.id, session); | |
49 session.disconnect = () => utils.disconnectSession(session.id); | |
50 session.reconnect = () => { | |
51 InspectorTest._sessions.delete(session.id); | |
52 var state = utils.disconnectSession(session.id); | |
53 session.id = utils.connectSession(contextGroup.id, state); | |
54 InspectorTest._sessions.set(session.id, session); | |
55 }; | |
56 session.sendRawCommand = (requestId, command, handler) => { | |
57 if (InspectorTest._dumpInspectorProtocolMessages) | |
58 utils.print("frontend: " + command); | |
59 session._dispatchTable.set(requestId, handler); | |
60 utils.sendMessageToBackend(session.id, command); | |
31 } | 61 } |
32 }); | 62 session._sendCommandPromise = (method, params) => { |
63 var requestId = ++session._requestId; | |
64 var messageObject = { "id": requestId, "method": method, "params": params }; | |
65 var fulfillCallback; | |
66 var promise = new Promise(fulfill => fulfillCallback = fulfill); | |
67 if (InspectorTest._commandsForLogging.has(method)) { | |
68 utils.print(method + ' called'); | |
69 } | |
70 session.sendRawCommand(requestId, JSON.stringify(messageObject), fulfillCall back); | |
71 return promise; | |
72 } | |
73 return session; | |
74 } | |
33 | 75 |
34 InspectorTest.logProtocolCommandCalls = (command) => InspectorTest._commandsForL ogging.add(command); | 76 InspectorTest.logProtocolCommandCalls = (command) => InspectorTest._commandsForL ogging.add(command); |
35 | 77 |
36 InspectorTest.log = utils.print.bind(null); | 78 InspectorTest.log = utils.print.bind(null); |
37 | 79 |
38 InspectorTest.logMessage = function(originalMessage) | 80 InspectorTest.logMessage = function(originalMessage) |
39 { | 81 { |
40 var message = JSON.parse(JSON.stringify(originalMessage)); | 82 var message = JSON.parse(JSON.stringify(originalMessage)); |
41 if (message.id) | 83 if (message.id) |
42 message.id = "<messageId>"; | 84 message.id = "<messageId>"; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 lines.push(firstLinePrefix + "["); | 143 lines.push(firstLinePrefix + "["); |
102 for (var i = 0; i < object.length; ++i) | 144 for (var i = 0; i < object.length; ++i) |
103 dumpValue(object[i], " " + prefix, " " + prefix + "[" + i + "] : "); | 145 dumpValue(object[i], " " + prefix, " " + prefix + "[" + i + "] : "); |
104 lines.push(prefix + "]"); | 146 lines.push(prefix + "]"); |
105 } | 147 } |
106 | 148 |
107 dumpValue(object, "", title || ""); | 149 dumpValue(object, "", title || ""); |
108 InspectorTest.log(lines.join("\n")); | 150 InspectorTest.log(lines.join("\n")); |
109 } | 151 } |
110 | 152 |
111 InspectorTest.logCallFrames = function(callFrames) | 153 InspectorTest.logCallFrames = function(callFrames, session) |
112 { | 154 { |
155 session = session || InspectorTest.session; | |
113 for (var frame of callFrames) { | 156 for (var frame of callFrames) { |
114 var functionName = frame.functionName || '(anonymous)'; | 157 var functionName = frame.functionName || '(anonymous)'; |
115 var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.locatio n.scriptId).url; | 158 var url = frame.url ? frame.url : session._scriptMap.get(frame.location.scri ptId).url; |
116 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb er; | 159 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb er; |
117 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu mnNumber; | 160 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu mnNumber; |
118 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`); | 161 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`); |
119 } | 162 } |
120 } | 163 } |
121 | 164 |
122 InspectorTest.logSourceLocation = function(location) | 165 InspectorTest.logSourceLocation = function(location, session) |
123 { | 166 { |
167 session = session || InspectorTest.session; | |
124 var scriptId = location.scriptId; | 168 var scriptId = location.scriptId; |
125 if (!InspectorTest._scriptMap || !InspectorTest._scriptMap.has(scriptId)) { | 169 if (!session._scriptMap || !session._scriptMap.has(scriptId)) { |
126 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot ocol.Debugger.enable."); | 170 InspectorTest.log("InspectorTest.setupScriptMap should be called before Prot ocol.Debugger.enable."); |
127 InspectorTest.completeTest(); | 171 InspectorTest.completeTest(); |
128 } | 172 } |
129 var script = InspectorTest._scriptMap.get(scriptId); | 173 var script = session._scriptMap.get(scriptId); |
130 if (!script.scriptSource) { | 174 if (!script.scriptSource) { |
131 // TODO(kozyatinskiy): doesn't assume that contextId == contextGroupId. | 175 return session.Protocol.Debugger.getScriptSource({ scriptId }) |
132 return Protocol.Debugger.getScriptSource({ scriptId }, script.executionConte xtId) | |
133 .then(message => script.scriptSource = message.result.scriptSource) | 176 .then(message => script.scriptSource = message.result.scriptSource) |
134 .then(dumpSourceWithLocation); | 177 .then(dumpSourceWithLocation); |
135 } | 178 } |
136 return Promise.resolve().then(dumpSourceWithLocation); | 179 return Promise.resolve().then(dumpSourceWithLocation); |
137 | 180 |
138 function dumpSourceWithLocation() { | 181 function dumpSourceWithLocation() { |
139 var lines = script.scriptSource.split('\n'); | 182 var lines = script.scriptSource.split('\n'); |
140 var line = lines[location.lineNumber]; | 183 var line = lines[location.lineNumber]; |
141 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col umnNumber) || ''); | 184 line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.col umnNumber) || ''); |
142 lines[location.lineNumber] = line; | 185 lines[location.lineNumber] = line; |
143 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); | 186 lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); |
144 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location .lineNumber + 2).join('\n')); | 187 InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location .lineNumber + 2).join('\n')); |
145 InspectorTest.log(''); | 188 InspectorTest.log(''); |
146 } | 189 } |
147 } | 190 } |
148 | 191 |
149 InspectorTest.logSourceLocations = function(locations) { | 192 InspectorTest.logSourceLocations = function(locations, session) { |
150 if (locations.length == 0) return Promise.resolve(); | 193 if (locations.length == 0) return Promise.resolve(); |
151 return InspectorTest.logSourceLocation(locations[0]) | 194 return InspectorTest.logSourceLocation(locations[0], session) |
152 .then(() => InspectorTest.logSourceLocations(locations.splice(1))); | 195 .then(() => InspectorTest.logSourceLocations(locations.splice(1), session) ); |
153 } | 196 } |
154 | 197 |
155 InspectorTest.logAsyncStackTrace = function(asyncStackTrace) | 198 InspectorTest.logAsyncStackTrace = function(asyncStackTrace, session) |
156 { | 199 { |
200 session = InspectorTest.session || session; | |
157 while (asyncStackTrace) { | 201 while (asyncStackTrace) { |
158 if (asyncStackTrace.promiseCreationFrame) { | 202 if (asyncStackTrace.promiseCreationFrame) { |
159 var frame = asyncStackTrace.promiseCreationFrame; | 203 var frame = asyncStackTrace.promiseCreationFrame; |
160 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url | 204 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url |
161 }:${frame.lineNumber}:${frame.columnNumber})--`); | 205 }:${frame.lineNumber}:${frame.columnNumber})--`); |
162 } else { | 206 } else { |
163 InspectorTest.log(`-- ${asyncStackTrace.description} --`); | 207 InspectorTest.log(`-- ${asyncStackTrace.description} --`); |
164 } | 208 } |
165 InspectorTest.logCallFrames(asyncStackTrace.callFrames); | 209 InspectorTest.logCallFrames(asyncStackTrace.callFrames, session); |
166 asyncStackTrace = asyncStackTrace.parent; | 210 asyncStackTrace = asyncStackTrace.parent; |
167 } | 211 } |
168 } | 212 } |
169 | 213 |
170 InspectorTest.completeTest = () => Protocol.Debugger.disable().then(() => utils. quit()); | 214 InspectorTest.completeTest = () => Protocol.Debugger.disable().then(() => utils. quit()); |
171 | 215 |
172 InspectorTest.completeTestAfterPendingTimeouts = function() | 216 InspectorTest.completeTestAfterPendingTimeouts = function() |
173 { | 217 { |
174 InspectorTest.waitPendingTasks().then(InspectorTest.completeTest); | 218 InspectorTest.waitPendingTasks().then(InspectorTest.completeTest); |
175 } | 219 } |
176 | 220 |
177 InspectorTest.waitPendingTasks = function() | 221 InspectorTest.waitPendingTasks = function() |
178 { | 222 { |
179 return Protocol.Runtime.evaluate({ expression: "new Promise(r => setTimeout(r, 0))//# sourceURL=wait-pending-tasks.js", awaitPromise: true }); | 223 var promises = []; |
224 for (var session of InspectorTest._sessions.values()) | |
225 promises.push(session.Protocol.Runtime.evaluate({ expression: "new Promise(r => setTimeout(r, 0))//# sourceURL=wait-pending-tasks.js", awaitPromise: true }) ); | |
226 return Promise.all(promises); | |
180 } | 227 } |
181 | 228 |
182 InspectorTest.addScript = (string, lineOffset, columnOffset) => utils.compileAnd RunWithOrigin(string, "", lineOffset || 0, columnOffset || 0, false); | |
183 InspectorTest.addScriptWithUrl = (string, url) => utils.compileAndRunWithOrigin( string, url, 0, 0, false); | |
184 InspectorTest.addModule = (string, url, lineOffset, columnOffset) => utils.compi leAndRunWithOrigin(string, url, lineOffset || 0, columnOffset || 0, true); | |
185 | |
186 InspectorTest.startDumpingProtocolMessages = function() | 229 InspectorTest.startDumpingProtocolMessages = function() |
187 { | 230 { |
188 InspectorTest._dumpInspectorProtocolMessages = true; | 231 InspectorTest._dumpInspectorProtocolMessages = true; |
189 } | 232 } |
190 | 233 |
191 InspectorTest.sendRawCommand = function(requestId, command, handler, contextGrou pId) | |
192 { | |
193 if (InspectorTest._dumpInspectorProtocolMessages) | |
194 utils.print("frontend: " + command); | |
195 InspectorTest._dispatchTable.set(requestId, handler); | |
196 sendMessageToBackend(command, contextGroupId || 0); | |
197 } | |
198 | |
199 InspectorTest.checkExpectation = function(fail, name, messageObject) | 234 InspectorTest.checkExpectation = function(fail, name, messageObject) |
200 { | 235 { |
201 if (fail === !!messageObject.error) { | 236 if (fail === !!messageObject.error) { |
202 InspectorTest.log("PASS: " + name); | 237 InspectorTest.log("PASS: " + name); |
203 return true; | 238 return true; |
204 } | 239 } |
205 | 240 |
206 InspectorTest.log("FAIL: " + name + ": " + JSON.stringify(messageObject)); | 241 InspectorTest.log("FAIL: " + name + ": " + JSON.stringify(messageObject)); |
207 InspectorTest.completeTest(); | 242 InspectorTest.completeTest(); |
208 return false; | 243 return false; |
209 } | 244 } |
210 InspectorTest.expectedSuccess = InspectorTest.checkExpectation.bind(null, false) ; | 245 InspectorTest.expectedSuccess = InspectorTest.checkExpectation.bind(null, false) ; |
211 InspectorTest.expectedError = InspectorTest.checkExpectation.bind(null, true); | 246 InspectorTest.expectedError = InspectorTest.checkExpectation.bind(null, true); |
212 | 247 |
213 InspectorTest.setupScriptMap = function() { | 248 InspectorTest.setupScriptMap = function(session) { |
214 if (InspectorTest._scriptMap) | 249 session = session || InspectorTest.session; |
250 if (session._scriptMap) | |
215 return; | 251 return; |
216 InspectorTest._scriptMap = new Map(); | 252 session._scriptMap = new Map(); |
217 } | 253 } |
218 | 254 |
219 InspectorTest.runTestSuite = function(testSuite) | 255 InspectorTest.runTestSuite = function(testSuite) |
220 { | 256 { |
221 function nextTest() | 257 function nextTest() |
222 { | 258 { |
223 if (!testSuite.length) { | 259 if (!testSuite.length) { |
224 InspectorTest.completeTest(); | 260 InspectorTest.completeTest(); |
225 return; | 261 return; |
226 } | 262 } |
227 var fun = testSuite.shift(); | 263 var fun = testSuite.shift(); |
228 InspectorTest.log("\nRunning test: " + fun.name); | 264 InspectorTest.log("\nRunning test: " + fun.name); |
229 fun(nextTest); | 265 fun(nextTest); |
230 } | 266 } |
231 nextTest(); | 267 nextTest(); |
232 } | 268 } |
233 | 269 |
234 InspectorTest.runAsyncTestSuite = async function(testSuite) { | 270 InspectorTest.runAsyncTestSuite = async function(testSuite) { |
235 for (var test of testSuite) { | 271 for (var test of testSuite) { |
236 InspectorTest.log("\nRunning test: " + test.name); | 272 InspectorTest.log("\nRunning test: " + test.name); |
237 await test(); | 273 try { |
274 await test(); | |
275 } catch (e) { | |
276 utils.print(e.stack); | |
277 } | |
238 } | 278 } |
239 InspectorTest.completeTest(); | 279 InspectorTest.completeTest(); |
240 } | 280 } |
241 | 281 |
242 InspectorTest._sendCommandPromise = function(method, params, contextGroupId) | 282 InspectorTest._waitForEventPromise = function(session, eventName) |
243 { | 283 { |
244 var requestId = ++InspectorTest._requestId; | 284 return new Promise(fulfill => session._eventHandler[eventName] = fullfillAndCl earListener.bind(null, fulfill)); |
245 var messageObject = { "id": requestId, "method": method, "params": params }; | |
246 var fulfillCallback; | |
247 var promise = new Promise(fulfill => fulfillCallback = fulfill); | |
248 if (InspectorTest._commandsForLogging.has(method)) { | |
249 utils.print(method + ' called'); | |
250 } | |
251 InspectorTest.sendRawCommand(requestId, JSON.stringify(messageObject), fulfill Callback, contextGroupId); | |
252 return promise; | |
253 } | |
254 | |
255 InspectorTest._waitForEventPromise = function(eventName) | |
256 { | |
257 return new Promise(fulfill => InspectorTest._eventHandler[eventName] = fullfil lAndClearListener.bind(null, fulfill)); | |
258 | 285 |
259 function fullfillAndClearListener(fulfill, result) | 286 function fullfillAndClearListener(fulfill, result) |
260 { | 287 { |
261 delete InspectorTest._eventHandler[eventName]; | 288 delete session._eventHandler[eventName]; |
262 fulfill(result); | 289 fulfill(result); |
263 } | 290 } |
264 } | 291 } |
265 | 292 |
266 InspectorTest._dispatchMessage = function(messageObject) | 293 InspectorTest._dispatchMessage = function(sessionId, messageObject) |
267 { | 294 { |
295 var session = InspectorTest._sessions.get(sessionId); | |
268 if (InspectorTest._dumpInspectorProtocolMessages) | 296 if (InspectorTest._dumpInspectorProtocolMessages) |
269 utils.print("backend: " + JSON.stringify(messageObject)); | 297 utils.print("backend: " + JSON.stringify(messageObject)); |
270 try { | 298 try { |
271 var messageId = messageObject["id"]; | 299 var messageId = messageObject["id"]; |
272 if (typeof messageId === "number") { | 300 if (typeof messageId === "number") { |
273 var handler = InspectorTest._dispatchTable.get(messageId); | 301 var handler = session._dispatchTable.get(messageId); |
274 if (handler) { | 302 if (handler) { |
275 handler(messageObject); | 303 handler(messageObject); |
276 InspectorTest._dispatchTable.delete(messageId); | 304 session._dispatchTable.delete(messageId); |
277 } | 305 } |
278 } else { | 306 } else { |
279 var eventName = messageObject["method"]; | 307 var eventName = messageObject["method"]; |
280 var eventHandler = InspectorTest._eventHandler[eventName]; | 308 var eventHandler = session._eventHandler[eventName]; |
281 if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed") | 309 if (session._scriptMap && eventName === "Debugger.scriptParsed") |
282 InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(J SON.stringify(messageObject.params))); | 310 session._scriptMap.set(messageObject.params.scriptId, JSON.parse(JSON.st ringify(messageObject.params))); |
283 if (eventName === "Debugger.scriptParsed" && messageObject.params.url === "wait-pending-tasks.js") | 311 if (eventName === "Debugger.scriptParsed" && messageObject.params.url === "wait-pending-tasks.js") |
284 return; | 312 return; |
285 if (eventHandler) | 313 if (eventHandler) |
286 eventHandler(messageObject); | 314 eventHandler(messageObject); |
287 } | 315 } |
288 } catch (e) { | 316 } catch (e) { |
289 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 317 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
290 InspectorTest.completeTest(); | 318 InspectorTest.completeTest(); |
291 } | 319 } |
292 } | 320 } |
293 | 321 |
294 InspectorTest.loadScript = function(fileName) { | 322 InspectorTest.setupInjectedScriptEnvironment = function(debug, session) { |
295 InspectorTest.addScript(utils.read(fileName)); | 323 session = session || InspectorTest.session; |
296 } | |
297 | |
298 InspectorTest.setupInjectedScriptEnvironment = function(debug) { | |
299 let scriptSource = ''; | 324 let scriptSource = ''; |
300 // First define all getters on Object.prototype. | 325 // First define all getters on Object.prototype. |
301 let injectedScriptSource = utils.read('src/inspector/injected-script-source.js '); | 326 let injectedScriptSource = utils.read('src/inspector/injected-script-source.js '); |
302 let getterRegex = /\.[a-zA-Z0-9]+/g; | 327 let getterRegex = /\.[a-zA-Z0-9]+/g; |
303 let match; | 328 let match; |
304 let getters = new Set(); | 329 let getters = new Set(); |
305 while (match = getterRegex.exec(injectedScriptSource)) { | 330 while (match = getterRegex.exec(injectedScriptSource)) { |
306 getters.add(match[0].substr(1)); | 331 getters.add(match[0].substr(1)); |
307 } | 332 } |
308 scriptSource += `(function installSettersAndGetters() { | 333 scriptSource += `(function installSettersAndGetters() { |
309 let defineProperty = Object.defineProperty; | 334 let defineProperty = Object.defineProperty; |
310 let ObjectPrototype = Object.prototype;\n`; | 335 let ObjectPrototype = Object.prototype;\n`; |
311 scriptSource += Array.from(getters).map(getter => ` | 336 scriptSource += Array.from(getters).map(getter => ` |
312 defineProperty(ObjectPrototype, '${getter}', { | 337 defineProperty(ObjectPrototype, '${getter}', { |
313 set() { debugger; throw 42; }, get() { debugger; throw 42; }, | 338 set() { debugger; throw 42; }, get() { debugger; throw 42; }, |
314 __proto__: null | 339 __proto__: null |
315 }); | 340 }); |
316 `).join('\n') + '})();'; | 341 `).join('\n') + '})();'; |
317 InspectorTest.addScript(scriptSource); | 342 session.contextGroup.addScript(scriptSource); |
318 | 343 |
319 if (debug) { | 344 if (debug) { |
320 InspectorTest.log('WARNING: InspectorTest.setupInjectedScriptEnvironment wit h debug flag for debugging only and should not be landed.'); | 345 InspectorTest.log('WARNING: InspectorTest.setupInjectedScriptEnvironment wit h debug flag for debugging only and should not be landed.'); |
321 InspectorTest.log('WARNING: run test with --expose-inspector-scripts flag to get more details.'); | 346 InspectorTest.log('WARNING: run test with --expose-inspector-scripts flag to get more details.'); |
322 InspectorTest.log('WARNING: you can additionally comment rjsmin in xxd.py to get unminified injected-script-source.js.'); | 347 InspectorTest.log('WARNING: you can additionally comment rjsmin in xxd.py to get unminified injected-script-source.js.'); |
323 InspectorTest.setupScriptMap(); | 348 InspectorTest.setupScriptMap(session); |
324 Protocol.Debugger.enable(); | 349 sesison.Protocol.Debugger.enable(); |
325 Protocol.Debugger.onPaused(message => { | 350 session.Protocol.Debugger.onPaused(message => { |
326 let callFrames = message.params.callFrames; | 351 let callFrames = message.params.callFrames; |
327 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location)); | 352 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location), session); |
328 }) | 353 }) |
329 } | 354 } |
330 } | 355 } |
356 | |
357 try { | |
358 InspectorTest.contextGroup = InspectorTest.createContextGroup(); | |
359 InspectorTest.session = InspectorTest.createSession(InspectorTest.contextGroup ); | |
360 var Protocol = InspectorTest.session.Protocol; | |
kozy
2017/05/18 18:35:28
this.Protocol = ...
dgozman
2017/05/18 19:03:21
Done.
| |
361 InspectorTest.addScript = InspectorTest.contextGroup.addScript.bind(InspectorT est.contextGroup); | |
362 InspectorTest.addModule = InspectorTest.contextGroup.addModule.bind(InspectorT est.contextGroup); | |
363 InspectorTest.loadScript = fileName => InspectorTest.addScript(utils.read(file Name)); | |
364 } catch (e) { | |
365 utils.print(e.stack); | |
366 } | |
OLD | NEW |