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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 { | 409 { |
410 var scripts = []; | 410 var scripts = []; |
411 for (var scriptId in WebInspector.debuggerModel._scripts) { | 411 for (var scriptId in WebInspector.debuggerModel._scripts) { |
412 var script = WebInspector.debuggerModel._scripts[scriptId]; | 412 var script = WebInspector.debuggerModel._scripts[scriptId]; |
413 if (!filter || filter(script)) | 413 if (!filter || filter(script)) |
414 scripts.push(script); | 414 scripts.push(script); |
415 } | 415 } |
416 return scripts; | 416 return scripts; |
417 }; | 417 }; |
418 | 418 |
419 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source) | 419 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
Script, source, target, preRegisterCallback) |
420 { | 420 { |
| 421 target = target || WebInspector.targetManager.mainTarget(); |
421 var scriptId = ++InspectorTest._lastScriptId; | 422 var scriptId = ++InspectorTest._lastScriptId; |
422 var lineCount = source.lineEndings().length; | 423 var lineCount = source.lineEndings().length; |
423 var endLine = startLine + lineCount - 1; | 424 var endLine = startLine + lineCount - 1; |
424 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; | 425 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt
h - source.lineEndings()[lineCount - 2]; |
425 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); | 426 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so
urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); |
426 var script = new WebInspector.Script(WebInspector.targetManager.mainTarget()
, scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, nu
ll, hasSourceURL); | 427 var script = new WebInspector.Script(target, scriptId, url, startLine, start
Column, endLine, endColumn, isContentScript, null, hasSourceURL); |
427 script.requestContent = function(callback) | 428 script.requestContent = function(callback) |
428 { | 429 { |
429 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); | 430 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); |
430 callback(trimmedSource, false, "text/javascript"); | 431 callback(trimmedSource, false, "text/javascript"); |
431 }; | 432 }; |
432 WebInspector.debuggerModel._registerScript(script); | 433 if (preRegisterCallback) |
| 434 preRegisterCallback(script); |
| 435 target.debuggerModel._registerScript(script); |
433 return script; | 436 return script; |
434 }; | 437 }; |
435 | 438 |
436 InspectorTest._lastScriptId = 0; | 439 InspectorTest._lastScriptId = 0; |
437 | 440 |
438 InspectorTest.checkRawLocation = function(script, lineNumber, columnNumber, loca
tion) | 441 InspectorTest.checkRawLocation = function(script, lineNumber, columnNumber, loca
tion) |
439 { | 442 { |
440 InspectorTest.assertEquals(script.scriptId, location.scriptId, "Incorrect sc
riptId"); | 443 InspectorTest.assertEquals(script.scriptId, location.scriptId, "Incorrect sc
riptId"); |
441 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN
umber"); | 444 InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineN
umber"); |
442 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c
olumnNumber"); | 445 InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect c
olumnNumber"); |
(...skipping 10 matching lines...) Expand all Loading... |
453 InspectorTest.scriptFormatter = function() | 456 InspectorTest.scriptFormatter = function() |
454 { | 457 { |
455 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); | 458 var editorActions = WebInspector.moduleManager.instances(WebInspector.Source
sView.EditorAction); |
456 for (var i = 0; i < editorActions.length; ++i) { | 459 for (var i = 0; i < editorActions.length; ++i) { |
457 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) | 460 if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction
) |
458 return editorActions[i]; | 461 return editorActions[i]; |
459 } | 462 } |
460 }; | 463 }; |
461 | 464 |
462 }; | 465 }; |
OLD | NEW |