Summary: Console messages should include async stack trace if available. When console.trace, console.error, etc, are called from an asynchronous callback the call stack shown the console should include async frames in addition to the standard call frames. Note: Inspector::Protocol::Console::ConsoleMessage already has a stackTrace property, which is currently an array of Console::CallFrame. This can be replaced with Console::StackTrace, and a simple check added to LogManager in the frontend: messageWasAdded(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, requestId) { // Called from WebInspector.ConsoleObserver. stackTrace = stackTrace.callFrames ? stackTrace : WebInspector.StackTrace.fromPayload(target, {callFrames: stackTrace}); ... }
or rather: let stackTracePayload = stackTrace.callFrames ? stackTrace : {callFrames: stackTrace}; WebInspector.StackTrace.fromPayload(target, stackTracePayload);
<rdar://problem/29301189>
The frontend part sounds "easy", but how about the backend part? I think this would be SUPER awesome 😁, especially for protocol tracing.