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 console.assert(WebInspector.debuggerModel.debuggerEnabled(), "Debugger has t
o be enabled"); | 5 console.assert(WebInspector.debuggerModel.debuggerEnabled(), "Debugger has t
o be enabled"); |
6 if (quiet !== undefined) | 6 if (quiet !== undefined) |
7 InspectorTest._quiet = quiet; | 7 InspectorTest._quiet = quiet; |
8 WebInspector.inspectorView.showPanel("sources"); | 8 WebInspector.inspectorView.showPanel("sources"); |
9 | 9 |
10 InspectorTest.addSniffer(WebInspector.debuggerModel, "_pausedScript", Inspec
torTest._pausedScript, true); | 10 InspectorTest.addSniffer(WebInspector.debuggerModel, "_pausedScript", Inspec
torTest._pausedScript, true); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 results.push(" <return>: " + frame.returnValue().descripti
on); | 193 results.push(" <return>: " + frame.returnValue().descripti
on); |
194 } | 194 } |
195 return printed; | 195 return printed; |
196 } | 196 } |
197 | 197 |
198 results.push("Call stack:"); | 198 results.push("Call stack:"); |
199 printCallFrames(callFrames); | 199 printCallFrames(callFrames); |
200 | 200 |
201 while (asyncStackTrace) { | 201 while (asyncStackTrace) { |
202 results.push(" [" + (asyncStackTrace.description || "Async Call") + "
]"); | 202 results.push(" [" + (asyncStackTrace.description || "Async Call") + "
]"); |
203 var printed = printCallFrames(WebInspector.DebuggerModel.CallFrame.fromP
ayloadArray(WebInspector.targetManager.activeTarget(), asyncStackTrace.callFrame
s)); | 203 var printed = printCallFrames(WebInspector.DebuggerModel.CallFrame.fromP
ayloadArray(WebInspector.targetManager.mainTarget(), asyncStackTrace.callFrames)
); |
204 if (!printed) | 204 if (!printed) |
205 results.pop(); | 205 results.pop(); |
206 if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction
") | 206 if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction
") |
207 break; | 207 break; |
208 asyncStackTrace = asyncStackTrace.asyncStackTrace; | 208 asyncStackTrace = asyncStackTrace.asyncStackTrace; |
209 } | 209 } |
210 return results.join("\n"); | 210 return results.join("\n"); |
211 }; | 211 }; |
212 | 212 |
213 InspectorTest.dumpSourceFrameContents = function(sourceFrame) | 213 InspectorTest.dumpSourceFrameContents = function(sourceFrame) |
214 { | 214 { |
215 InspectorTest.addResult("==Source frame contents start=="); | 215 InspectorTest.addResult("==Source frame contents start=="); |
216 var textEditor = sourceFrame._textEditor; | 216 var textEditor = sourceFrame._textEditor; |
217 for (var i = 0; i < textEditor.linesCount; ++i) | 217 for (var i = 0; i < textEditor.linesCount; ++i) |
218 InspectorTest.addResult(textEditor.line(i)); | 218 InspectorTest.addResult(textEditor.line(i)); |
219 InspectorTest.addResult("==Source frame contents end=="); | 219 InspectorTest.addResult("==Source frame contents end=="); |
220 }; | 220 }; |
221 | 221 |
222 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s, asyncStackTrace) | 222 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
s, asyncStackTrace) |
223 { | 223 { |
224 if (!InspectorTest._quiet) | 224 if (!InspectorTest._quiet) |
225 InspectorTest.addResult("Script execution paused."); | 225 InspectorTest.addResult("Script execution paused."); |
226 InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame
.fromPayloadArray(WebInspector.targetManager.activeTarget(), callFrames), reason
, breakpointIds, asyncStackTrace, auxData]; | 226 InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame
.fromPayloadArray(WebInspector.targetManager.mainTarget(), callFrames), reason,
breakpointIds, asyncStackTrace, auxData]; |
227 if (InspectorTest._waitUntilPausedCallback) { | 227 if (InspectorTest._waitUntilPausedCallback) { |
228 var callback = InspectorTest._waitUntilPausedCallback; | 228 var callback = InspectorTest._waitUntilPausedCallback; |
229 delete InspectorTest._waitUntilPausedCallback; | 229 delete InspectorTest._waitUntilPausedCallback; |
230 callback.apply(callback, InspectorTest._pausedScriptArguments); | 230 callback.apply(callback, InspectorTest._pausedScriptArguments); |
231 } | 231 } |
232 }; | 232 }; |
233 | 233 |
234 InspectorTest._resumedScript = function() | 234 InspectorTest._resumedScript = function() |
235 { | 235 { |
236 if (!InspectorTest._quiet) | 236 if (!InspectorTest._quiet) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return scripts; | 371 return scripts; |
372 }; | 372 }; |
373 | 373 |
374 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source) | 374 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source) |
375 { | 375 { |
376 var scriptId = ++InspectorTest._lastScriptId; | 376 var scriptId = ++InspectorTest._lastScriptId; |
377 var lineCount = source.lineEndings().length; | 377 var lineCount = source.lineEndings().length; |
378 var endLine = startLine + lineCount - 1; | 378 var endLine = startLine + lineCount - 1; |
379 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; | 379 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; |
380 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); | 380 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); |
381 var script = new WebInspector.Script(WebInspector.targetManager.activeTarget
(), scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript,
null, hasSourceURL); | 381 var script = new WebInspector.Script(WebInspector.targetManager.mainTarget()
, scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, nu
ll, hasSourceURL); |
382 script.requestContent = function(callback) | 382 script.requestContent = function(callback) |
383 { | 383 { |
384 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); | 384 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); |
385 callback(trimmedSource, false, "text/javascript"); | 385 callback(trimmedSource, false, "text/javascript"); |
386 }; | 386 }; |
387 WebInspector.debuggerModel._registerScript(script); | 387 WebInspector.debuggerModel._registerScript(script); |
388 return script; | 388 return script; |
389 }; | 389 }; |
390 | 390 |
391 InspectorTest._lastScriptId = 0; | 391 InspectorTest._lastScriptId = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
408 InspectorTest.scriptFormatter = function() | 408 InspectorTest.scriptFormatter = function() |
409 { | 409 { |
410 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); | 410 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); |
411 for (var i = 0; i < editorActions.length; ++i) { | 411 for (var i = 0; i < editorActions.length; ++i) { |
412 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) | 412 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) |
413 return editorActions[i]; | 413 return editorActions[i]; |
414 } | 414 } |
415 }; | 415 }; |
416 | 416 |
417 }; | 417 }; |
OLD | NEW |