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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 { | 105 { |
106 for (var frame of callFrames) { | 106 for (var frame of callFrames) { |
107 var functionName = frame.functionName || '(anonymous)'; | 107 var functionName = frame.functionName || '(anonymous)'; |
108 var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.locatio
n.scriptId).url; | 108 var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.locatio
n.scriptId).url; |
109 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb
er; | 109 var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumb
er; |
110 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu
mnNumber; | 110 var columnNumber = frame.location ? frame.location.columnNumber : frame.colu
mnNumber; |
111 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`); | 111 InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
| 115 InspectorTest.logAsyncStackTrace = function(asyncStackTrace) |
| 116 { |
| 117 while (asyncStackTrace) { |
| 118 if (asyncStackTrace.promiseCreationFrame) { |
| 119 var frame = asyncStackTrace.promiseCreationFrame; |
| 120 InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url |
| 121 }:${frame.lineNumber}:${frame.columnNumber})--`); |
| 122 } else { |
| 123 InspectorTest.log(`-- ${asyncStackTrace.description} --`); |
| 124 } |
| 125 InspectorTest.logCallFrames(asyncStackTrace.callFrames); |
| 126 asyncStackTrace = asyncStackTrace.parent; |
| 127 } |
| 128 } |
| 129 |
115 InspectorTest.completeTest = function() | 130 InspectorTest.completeTest = function() |
116 { | 131 { |
117 Protocol.Debugger.disable().then(() => quit()); | 132 Protocol.Debugger.disable().then(() => quit()); |
118 } | 133 } |
119 | 134 |
120 InspectorTest.completeTestAfterPendingTimeouts = function() | 135 InspectorTest.completeTestAfterPendingTimeouts = function() |
121 { | 136 { |
122 Protocol.Runtime.evaluate({ | 137 Protocol.Runtime.evaluate({ |
123 expression: "new Promise(resolve => setTimeout(resolve, 0))", | 138 expression: "new Promise(resolve => setTimeout(resolve, 0))", |
124 awaitPromise: true }).then(InspectorTest.completeTest); | 139 awaitPromise: true }).then(InspectorTest.completeTest); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed") | 229 if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed") |
215 InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(J
SON.stringify(messageObject.params))); | 230 InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(J
SON.stringify(messageObject.params))); |
216 if (eventHandler) | 231 if (eventHandler) |
217 eventHandler(messageObject); | 232 eventHandler(messageObject); |
218 } | 233 } |
219 } catch (e) { | 234 } catch (e) { |
220 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 235 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
221 InspectorTest.completeTest(); | 236 InspectorTest.completeTest(); |
222 } | 237 } |
223 } | 238 } |
OLD | NEW |