Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: LayoutTests/http/tests/inspector/debugger-test.js

Issue 74063002: DevTools: Support asynchronous call stacks on backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Async call stacks are off by default, added Debugger.enableAsyncCallStacks protocol command Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/inspector/debugger-test.js
diff --git a/LayoutTests/http/tests/inspector/debugger-test.js b/LayoutTests/http/tests/inspector/debugger-test.js
index a258c951b36c3f648ecb15f005b41956a8b0a473..30a9933f49628eca53e33fb6f6e13aeb4cd1db42 100644
--- a/LayoutTests/http/tests/inspector/debugger-test.js
+++ b/LayoutTests/http/tests/inspector/debugger-test.js
@@ -120,31 +120,46 @@ InspectorTest.resumeExecution = function(callback)
InspectorTest.waitUntilResumed(callback);
};
-InspectorTest.captureStackTrace = function(callFrames, dropLineNumbers, printReturnValue)
+InspectorTest.captureStackTrace = function(callFrames, options)
{
- InspectorTest.addResult("Call stack:");
- for (var i = 0; i < callFrames.length; i++) {
- var frame = callFrames[i];
- var script = WebInspector.debuggerModel.scriptForId(frame.location.scriptId);
- var url;
- var lineNumber;
- if (script) {
- url = WebInspector.displayNameForURL(script.sourceURL);
- lineNumber = frame.location.lineNumber + 1;
- } else {
- url = "(internal script)";
- lineNumber = "(line number)";
+ options = options || {};
+
+ function printCallFrames(callFrames, indent)
+ {
+ indent = indent || "";
+ for (var i = 0; i < callFrames.length; i++) {
+ var frame = callFrames[i];
+ var script = WebInspector.debuggerModel.scriptForId(frame.location.scriptId);
+ var url;
+ var lineNumber;
+ if (script) {
+ url = WebInspector.displayNameForURL(script.sourceURL);
+ lineNumber = frame.location.lineNumber + 1;
+ } else {
+ url = "(internal script)";
+ lineNumber = "(line number)";
+ }
+ var s = " " + i + ") " + frame.functionName + " (" + url + (options.dropLineNumbers ? "" : ":" + lineNumber) + ")";
+ InspectorTest.addResult(indent + s);
+ if (options.printReturnValue && frame.returnValue)
+ InspectorTest.addResult(indent + " <return>: " + frame.returnValue.description);
}
- var s = " " + i + ") " + frame.functionName + " (" + url + (dropLineNumbers ? "" : ":" + lineNumber) + ")";
- InspectorTest.addResult(s);
- if (printReturnValue && frame.returnValue)
- InspectorTest.addResult(" <return>: " + frame.returnValue.description);
}
-};
-InspectorTest.captureStackTraceExtended = function(callFrames, dropLineNumbers)
-{
- InspectorTest.captureStackTrace(callFrames, dropLineNumbers, true);
+ InspectorTest.addResult("Call stack:");
+ printCallFrames(callFrames);
+
+ if (options.printAsyncCallStack) {
+ var lastCallframe = callFrames[callFrames.length - 1];
+ while (lastCallframe && lastCallframe.asyncCallFrames) {
+ InspectorTest.addResult(" [Async Call]");
+ callFrames = lastCallframe.asyncCallFrames;
+ printCallFrames(callFrames, " ");
+ if (callFrames[0].functionName === "testFunction")
+ break;
+ lastCallframe = callFrames[callFrames.length - 1];
+ }
+ }
};
InspectorTest.dumpSourceFrameContents = function(sourceFrame)
« no previous file with comments | « no previous file | LayoutTests/inspector/debugger/async-callstack.html » ('j') | Source/bindings/v8/ScriptDebugServer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698