InspectorTest.completeDebuggerTest = function()
{
- WebInspector.debuggerModel.setBreakpointsActive(true);
+ WebInspector.breakpointManager.setBreakpointsActive(true);
InspectorTest.resumeExecution(InspectorTest.completeTest.bind(InspectorTest));
};
}
};
+InspectorTest.waitUntilPausedAndPerformSteppingActions = function(actions, callback)
+{
+ callback = InspectorTest.safeWrap(callback);
+ InspectorTest.waitUntilPaused(didPause);
+
+ function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
+ {
+ var action = actions.shift();
+ if (action === "Print") {
+ InspectorTest.captureStackTrace(callFrames, asyncStackTrace);
+ InspectorTest.addResult("");
+ while (action === "Print")
+ action = actions.shift();
+ }
+
+ if (!action) {
+ callback()
+ return;
+ }
+
+ InspectorTest.addResult("Executing " + action + "...");
+
+ switch (action) {
+ case "StepInto":
+ WebInspector.panels.sources._stepIntoButton.element.click();
+ break;
+ case "StepOver":
+ WebInspector.panels.sources._stepOverButton.element.click();
+ break;
+ case "StepOut":
+ WebInspector.panels.sources._stepOutButton.element.click();
+ break;
+ case "Resume":
+ WebInspector.panels.sources.togglePause();
+ break;
+ default:
+ InspectorTest.addResult("FAIL: Unknown action: " + action);
+ callback()
+ return;
+ }
+
+ InspectorTest.waitUntilResumed(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
+ }
+};
+
InspectorTest.captureStackTrace = function(callFrames, asyncStackTrace, options)
{
InspectorTest.addResult(InspectorTest.captureStackTraceIntoString(callFrames, asyncStackTrace, options));
for (var i = 0; i < callFrames.length; i++) {
var frame = callFrames[i];
var script = WebInspector.debuggerModel.scriptForId(frame.location().scriptId);
- var isFramework = script.isFramework();
+ var isFramework = WebInspector.BlackboxSupport.isBlackboxedURL(script.sourceURL);
if (options.dropFrameworkCallFrames && isFramework)
continue;
var url;
while (asyncStackTrace) {
results.push(" [" + (asyncStackTrace.description || "Async Call") + "]");
- var printed = printCallFrames(WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.activeTarget(), asyncStackTrace.callFrames));
+ var printed = printCallFrames(WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.mainTarget(), asyncStackTrace.callFrames));
if (!printed)
results.pop();
if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction")
{
if (!InspectorTest._quiet)
InspectorTest.addResult("Script execution paused.");
- InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.activeTarget(), callFrames), reason, breakpointIds, asyncStackTrace, auxData];
+ InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.mainTarget(), callFrames), reason, breakpointIds, asyncStackTrace, auxData];
if (InspectorTest._waitUntilPausedCallback) {
var callback = InspectorTest._waitUntilPausedCallback;
delete InspectorTest._waitUntilPausedCallback;
return scripts;
};
-InspectorTest.createScriptMock = function(url, startLine, startColumn, isContentScript, source)
+InspectorTest.createScriptMock = function(url, startLine, startColumn, isContentScript, source, target, preRegisterCallback)
{
+ target = target || WebInspector.targetManager.mainTarget();
var scriptId = ++InspectorTest._lastScriptId;
var lineCount = source.lineEndings().length;
var endLine = startLine + lineCount - 1;
var endColumn = lineCount === 1 ? startColumn + source.length : source.length - source.lineEndings()[lineCount - 2];
var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!source.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m);
- var script = new WebInspector.Script(WebInspector.targetManager.activeTarget(), scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, null, hasSourceURL);
+ var script = new WebInspector.Script(target, scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, null, hasSourceURL);
script.requestContent = function(callback)
{
var trimmedSource = WebInspector.Script._trimSourceURLComment(source);
callback(trimmedSource, false, "text/javascript");
};
- WebInspector.debuggerModel._registerScript(script);
+ if (preRegisterCallback)
+ preRegisterCallback(script);
+ target.debuggerModel._registerScript(script);
return script;
};
InspectorTest.scriptFormatter = function()
{
- var editorActions = WebInspector.moduleManager.instances(WebInspector.SourcesView.EditorAction);
+ var editorActions = self.runtime.instances(WebInspector.SourcesView.EditorAction);
for (var i = 0; i < editorActions.length; ++i) {
if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction)
return editorActions[i];