| 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.inspectorView.showPanel("sources"); | 7 WebInspector.inspectorView.showPanel("sources"); |
| 8 | 8 |
| 9 if (WebInspector.debuggerModel.debuggerEnabled()) | 9 if (WebInspector.debuggerModel.debuggerEnabled()) |
| 10 startTest(); | 10 startTest(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 InspectorTest.setQuiet(true); | 88 InspectorTest.setQuiet(true); |
| 89 InspectorTest.startDebuggerTest(step1); | 89 InspectorTest.startDebuggerTest(step1); |
| 90 | 90 |
| 91 function step1() | 91 function step1() |
| 92 { | 92 { |
| 93 DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2); | 93 DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2); |
| 94 } | 94 } |
| 95 | 95 |
| 96 function step2() | 96 function step2() |
| 97 { | 97 { |
| 98 InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused); | 98 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 99 } | 99 } |
| 100 | 100 |
| 101 var step = 0; | 101 var step = 0; |
| 102 var callStacksOutput = []; | 102 var callStacksOutput = []; |
| 103 function didPaused(callFrames, reason, breakpointIds, asyncStackTrace) | 103 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) |
| 104 { | 104 { |
| 105 ++step; | 105 ++step; |
| 106 callStacksOutput.push(InspectorTest.captureStackTraceIntoString(callFram
es, asyncStackTrace) + "\n"); | 106 callStacksOutput.push(InspectorTest.captureStackTraceIntoString(callFram
es, asyncStackTrace) + "\n"); |
| 107 if (step < totalDebuggerStatements) { | 107 if (step < totalDebuggerStatements) { |
| 108 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(Ins
pectorTest, didPaused)); | 108 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(Ins
pectorTest, didPause)); |
| 109 } else { | 109 } else { |
| 110 InspectorTest.addResult("Captured call stacks in no particular order
:"); | 110 InspectorTest.addResult("Captured call stacks in no particular order
:"); |
| 111 callStacksOutput.sort(); | 111 callStacksOutput.sort(); |
| 112 InspectorTest.addResults(callStacksOutput); | 112 InspectorTest.addResults(callStacksOutput); |
| 113 InspectorTest.completeDebuggerTest(); | 113 InspectorTest.completeDebuggerTest(); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 InspectorTest.waitUntilPausedNextTime = function(callback) | 118 InspectorTest.waitUntilPausedNextTime = function(callback) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 InspectorTest.captureStackTraceIntoString = function(callFrames, asyncStackTrace
, options) | 160 InspectorTest.captureStackTraceIntoString = function(callFrames, asyncStackTrace
, options) |
| 161 { | 161 { |
| 162 var results = []; | 162 var results = []; |
| 163 options = options || {}; | 163 options = options || {}; |
| 164 | 164 |
| 165 function printCallFrames(callFrames) | 165 function printCallFrames(callFrames) |
| 166 { | 166 { |
| 167 for (var i = 0; i < callFrames.length; i++) { | 167 for (var i = 0; i < callFrames.length; i++) { |
| 168 var frame = callFrames[i]; | 168 var frame = callFrames[i]; |
| 169 var script = WebInspector.debuggerModel.scriptForId(frame.location.s
criptId); | 169 var script = WebInspector.debuggerModel.scriptForId(frame.location()
.scriptId); |
| 170 var url; | 170 var url; |
| 171 var lineNumber; | 171 var lineNumber; |
| 172 if (script) { | 172 if (script) { |
| 173 url = WebInspector.displayNameForURL(script.sourceURL); | 173 url = WebInspector.displayNameForURL(script.sourceURL); |
| 174 lineNumber = frame.location.lineNumber + 1; | 174 lineNumber = frame.location().lineNumber + 1; |
| 175 } else { | 175 } else { |
| 176 url = "(internal script)"; | 176 url = "(internal script)"; |
| 177 lineNumber = "(line number)"; | 177 lineNumber = "(line number)"; |
| 178 } | 178 } |
| 179 var s = " " + i + ") " + frame.functionName + " (" + url + (optio
ns.dropLineNumbers ? "" : ":" + lineNumber) + ")"; | 179 var s = " " + i + ") " + frame.functionName + " (" + url + (optio
ns.dropLineNumbers ? "" : ":" + lineNumber) + ")"; |
| 180 results.push(s); | 180 results.push(s); |
| 181 if (options.printReturnValue && frame.returnValue) | 181 if (options.printReturnValue && frame.returnValue()) |
| 182 results.push(" <return>: " + frame.returnValue.description
); | 182 results.push(" <return>: " + frame.returnValue().descripti
on); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 results.push("Call stack:"); | 186 results.push("Call stack:"); |
| 187 printCallFrames(callFrames); | 187 printCallFrames(callFrames); |
| 188 | 188 |
| 189 while (asyncStackTrace) { | 189 while (asyncStackTrace) { |
| 190 results.push(" [" + (asyncStackTrace.description || "Async Call") + "
]"); | 190 results.push(" [" + (asyncStackTrace.description || "Async Call") + "
]"); |
| 191 printCallFrames(asyncStackTrace.callFrames); | 191 printCallFrames(WebInspector.DebuggerModel.CallFrame.fromPayloadArray(We
bInspector.targetManager.activeTarget(), asyncStackTrace.callFrames)); |
| 192 if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction
") | 192 if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction
") |
| 193 break; | 193 break; |
| 194 asyncStackTrace = asyncStackTrace.asyncStackTrace; | 194 asyncStackTrace = asyncStackTrace.asyncStackTrace; |
| 195 } | 195 } |
| 196 return results.join("\n"); | 196 return results.join("\n"); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 InspectorTest.dumpSourceFrameContents = function(sourceFrame) | 199 InspectorTest.dumpSourceFrameContents = function(sourceFrame) |
| 200 { | 200 { |
| 201 InspectorTest.addResult("==Source frame contents start=="); | 201 InspectorTest.addResult("==Source frame contents start=="); |
| 202 var textEditor = sourceFrame._textEditor; | 202 var textEditor = sourceFrame._textEditor; |
| 203 for (var i = 0; i < textEditor.linesCount; ++i) | 203 for (var i = 0; i < textEditor.linesCount; ++i) |
| 204 InspectorTest.addResult(textEditor.line(i)); | 204 InspectorTest.addResult(textEditor.line(i)); |
| 205 InspectorTest.addResult("==Source frame contents end=="); | 205 InspectorTest.addResult("==Source frame contents end=="); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s, asyncStackTrace) | 208 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s, asyncStackTrace) |
| 209 { | 209 { |
| 210 if (!InspectorTest._quiet) | 210 if (!InspectorTest._quiet) |
| 211 InspectorTest.addResult("Script execution paused."); | 211 InspectorTest.addResult("Script execution paused."); |
| 212 InspectorTest._pausedScriptArguments = [callFrames, reason, breakpointIds, a
syncStackTrace]; | 212 InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame
.fromPayloadArray(WebInspector.targetManager.activeTarget(), callFrames), reason
, breakpointIds, asyncStackTrace]; |
| 213 if (InspectorTest._waitUntilPausedCallback) { | 213 if (InspectorTest._waitUntilPausedCallback) { |
| 214 var callback = InspectorTest._waitUntilPausedCallback; | 214 var callback = InspectorTest._waitUntilPausedCallback; |
| 215 delete InspectorTest._waitUntilPausedCallback; | 215 delete InspectorTest._waitUntilPausedCallback; |
| 216 callback.apply(callback, InspectorTest._pausedScriptArguments); | 216 callback.apply(callback, InspectorTest._pausedScriptArguments); |
| 217 } | 217 } |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 InspectorTest._resumedScript = function() | 220 InspectorTest._resumedScript = function() |
| 221 { | 221 { |
| 222 if (!InspectorTest._quiet) | 222 if (!InspectorTest._quiet) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return scripts; | 357 return scripts; |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source) | 360 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source) |
| 361 { | 361 { |
| 362 var scriptId = ++InspectorTest._lastScriptId; | 362 var scriptId = ++InspectorTest._lastScriptId; |
| 363 var lineCount = source.lineEndings().length; | 363 var lineCount = source.lineEndings().length; |
| 364 var endLine = startLine + lineCount - 1; | 364 var endLine = startLine + lineCount - 1; |
| 365 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; | 365 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; |
| 366 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); | 366 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); |
| 367 var script = new WebInspector.Script(scriptId, url, startLine, startColumn,
endLine, endColumn, isContentScript, null, hasSourceURL); | 367 var script = new WebInspector.Script(WebInspector.targetManager.activeTarget
(), scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript,
null, hasSourceURL); |
| 368 script.requestContent = function(callback) | 368 script.requestContent = function(callback) |
| 369 { | 369 { |
| 370 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); | 370 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); |
| 371 callback(trimmedSource, false, "text/javascript"); | 371 callback(trimmedSource, false, "text/javascript"); |
| 372 }; | 372 }; |
| 373 WebInspector.debuggerModel._registerScript(script); | 373 WebInspector.debuggerModel._registerScript(script); |
| 374 return script; | 374 return script; |
| 375 }; | 375 }; |
| 376 | 376 |
| 377 InspectorTest._lastScriptId = 0; | 377 InspectorTest._lastScriptId = 0; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 394 InspectorTest.scriptFormatter = function() | 394 InspectorTest.scriptFormatter = function() |
| 395 { | 395 { |
| 396 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); | 396 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); |
| 397 for (var i = 0; i < editorActions.length; ++i) { | 397 for (var i = 0; i < editorActions.length; ++i) { |
| 398 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) | 398 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) |
| 399 return editorActions[i]; | 399 return editorActions[i]; |
| 400 } | 400 } |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 }; | 403 }; |
| OLD | NEW |