OLD | NEW |
1 var initialize_DebuggerTest = function() { | 1 var initialize_DebuggerTest = function() { |
2 | 2 |
3 InspectorTest.startDebuggerTest = function(callback, quiet) | 3 InspectorTest.startDebuggerTest = function(callback, quiet) |
4 { | 4 { |
5 if (quiet !== undefined) | 5 if (quiet !== undefined) |
6 InspectorTest._quiet = quiet; | 6 InspectorTest._quiet = quiet; |
7 WebInspector.showPanel("sources"); | 7 WebInspector.showPanel("sources"); |
8 | 8 |
9 if (WebInspector.debuggerModel.debuggerEnabled()) | 9 if (WebInspector.debuggerModel.debuggerEnabled()) |
10 startTest(); | 10 startTest(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 InspectorTest._waitUntilResumedCallback = callback; | 113 InspectorTest._waitUntilResumedCallback = callback; |
114 }; | 114 }; |
115 | 115 |
116 InspectorTest.resumeExecution = function(callback) | 116 InspectorTest.resumeExecution = function(callback) |
117 { | 117 { |
118 if (WebInspector.panels.sources.paused) | 118 if (WebInspector.panels.sources.paused) |
119 WebInspector.panels.sources._togglePause(); | 119 WebInspector.panels.sources._togglePause(); |
120 InspectorTest.waitUntilResumed(callback); | 120 InspectorTest.waitUntilResumed(callback); |
121 }; | 121 }; |
122 | 122 |
123 InspectorTest.captureStackTrace = function(callFrames, dropLineNumbers, printRet
urnValue) | 123 InspectorTest.captureStackTrace = function(callFrames, options) |
124 { | 124 { |
| 125 options = options || {}; |
| 126 |
| 127 function printCallFrames(callFrames, indent) |
| 128 { |
| 129 indent = indent || ""; |
| 130 for (var i = 0; i < callFrames.length; i++) { |
| 131 var frame = callFrames[i]; |
| 132 var script = WebInspector.debuggerModel.scriptForId(frame.location.s
criptId); |
| 133 var url; |
| 134 var lineNumber; |
| 135 if (script) { |
| 136 url = WebInspector.displayNameForURL(script.sourceURL); |
| 137 lineNumber = frame.location.lineNumber + 1; |
| 138 } else { |
| 139 url = "(internal script)"; |
| 140 lineNumber = "(line number)"; |
| 141 } |
| 142 var s = " " + i + ") " + frame.functionName + " (" + url + (optio
ns.dropLineNumbers ? "" : ":" + lineNumber) + ")"; |
| 143 InspectorTest.addResult(indent + s); |
| 144 if (options.printReturnValue && frame.returnValue) |
| 145 InspectorTest.addResult(indent + " <return>: " + frame.ret
urnValue.description); |
| 146 } |
| 147 } |
| 148 |
125 InspectorTest.addResult("Call stack:"); | 149 InspectorTest.addResult("Call stack:"); |
126 for (var i = 0; i < callFrames.length; i++) { | 150 printCallFrames(callFrames); |
127 var frame = callFrames[i]; | 151 |
128 var script = WebInspector.debuggerModel.scriptForId(frame.location.scrip
tId); | 152 if (options.printAsyncCallStack) { |
129 var url; | 153 var lastCallframe = callFrames[callFrames.length - 1]; |
130 var lineNumber; | 154 while (lastCallframe && lastCallframe.asyncCallFrames) { |
131 if (script) { | 155 InspectorTest.addResult(" [Async Call]"); |
132 url = WebInspector.displayNameForURL(script.sourceURL); | 156 callFrames = lastCallframe.asyncCallFrames; |
133 lineNumber = frame.location.lineNumber + 1; | 157 printCallFrames(callFrames, " "); |
134 } else { | 158 if (callFrames[0].functionName === "testFunction") |
135 url = "(internal script)"; | 159 break; |
136 lineNumber = "(line number)"; | 160 lastCallframe = callFrames[callFrames.length - 1]; |
137 } | 161 } |
138 var s = " " + i + ") " + frame.functionName + " (" + url + (dropLineN
umbers ? "" : ":" + lineNumber) + ")"; | |
139 InspectorTest.addResult(s); | |
140 if (printReturnValue && frame.returnValue) | |
141 InspectorTest.addResult(" <return>: " + frame.returnValue.desc
ription); | |
142 } | 162 } |
143 }; | 163 }; |
144 | 164 |
145 InspectorTest.captureStackTraceExtended = function(callFrames, dropLineNumbers) | |
146 { | |
147 InspectorTest.captureStackTrace(callFrames, dropLineNumbers, true); | |
148 }; | |
149 | |
150 InspectorTest.dumpSourceFrameContents = function(sourceFrame) | 165 InspectorTest.dumpSourceFrameContents = function(sourceFrame) |
151 { | 166 { |
152 InspectorTest.addResult("==Source frame contents start=="); | 167 InspectorTest.addResult("==Source frame contents start=="); |
153 var textEditor = sourceFrame._textEditor; | 168 var textEditor = sourceFrame._textEditor; |
154 for (var i = 0; i < textEditor.linesCount; ++i) | 169 for (var i = 0; i < textEditor.linesCount; ++i) |
155 InspectorTest.addResult(textEditor.line(i)); | 170 InspectorTest.addResult(textEditor.line(i)); |
156 InspectorTest.addResult("==Source frame contents end=="); | 171 InspectorTest.addResult("==Source frame contents end=="); |
157 }; | 172 }; |
158 | 173 |
159 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s) | 174 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s) |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 339 |
325 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber,
location) | 340 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber,
location) |
326 { | 341 { |
327 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u
iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "'
," + | 342 InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect u
iSourceCode, expected '" + (uiSourceCode ? uiSourceCode.originURL() : null) + "'
," + |
328 " but got '"
+ (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'"); | 343 " but got '"
+ (location.uiSourceCode ? location.uiSourceCode.originURL() : null) + "'"); |
329 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN
umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'"); | 344 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN
umber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'"); |
330 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c
olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber
+ "'"); | 345 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c
olumnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber
+ "'"); |
331 }; | 346 }; |
332 | 347 |
333 }; | 348 }; |
OLD | NEW |