Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Web Inspector: should always send Console.StackTrace instead of an ar…
…ray of Console.CallFrame https://bugs.webkit.org/show_bug.cgi?id=242826 Reviewed by Patrick Angle. The inspected page already has the full async stack trace information, so sending it to the frontend is just a matter of using the right protocol type (i.e. one that has a property for the parent `Console.StackTrace`). This will allow the Web Inspector frontend to show async stack traces everywhere that a stack trace is shown. * Source/JavaScriptCore/inspector/protocol/Animation.json: * Source/JavaScriptCore/inspector/protocol/Canvas.json: * Source/JavaScriptCore/inspector/protocol/Console.json: * Source/JavaScriptCore/inspector/protocol/Network.json: * Source/JavaScriptCore/inspector/protocol/Recording.json: * Source/JavaScriptCore/inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::addToFrontend): * Source/WebCore/inspector/InspectorCanvas.h: * Source/WebCore/inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::buildObjectForCanvas): (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildAction): * Source/WebCore/inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): * Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::bindAnimation): * Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildInitiatorObject): s/`buildInspectorArray`/`buildInspectorObject` * Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp: (Inspector::CreateScriptCallStackFunctor::CreateScriptCallStackFunctor): (Inspector::CreateScriptCallStackFunctor::operator() const): (Inspector::CreateScriptCallStackFunctor::takeStack): Added. (Inspector::createScriptCallStack): (Inspector::createScriptCallStackForConsole): (Inspector::createScriptCallStackFromException): * Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::currentParentStackTrace const): Added. Grab the current `AsyncStackTrace` from the `InspectorDebuggerAgent` when creating a `ScriptCallStack`. * Source/JavaScriptCore/inspector/ScriptCallStack.h: * Source/JavaScriptCore/inspector/ScriptCallStack.cpp: (Inspector::ScriptCallStack::create): (Inspector::ScriptCallStack::ScriptCallStack): (Inspector::ScriptCallStack::buildInspectorObject const): Include the `AsyncStackTrace` (if provided) when creating the `Console.StackTrace` protocol object. * Source/WebInspectorUI/UserInterface/Controllers/CallFrameTreeController.js: (WI.CallFrameTreeController): (WI.CallFrameTreeController.prototype.groupBlackboxedStackTrace): Added. (WI.CallFrameTreeController.prototype.get stackTrace): Renamed from `get callFrames`. (WI.CallFrameTreeController.prototype.set stackTrace): Renamed from `get stackTrace`. (WI.CallFrameTreeController.prototype._groupBlackboxedCallFrames): Renamed from `groupBlackboxedCallFrames`. * Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js: (WI.ThreadTreeElement.prototype.refresh): Move the logic for generating tree items for async stack traces to a generic helper for wider use. * Source/WebInspectorUI/UserInterface/Models/DebuggerData.js: (WI.DebuggerData): (WI.DebuggerData.prototype.get stackTrace): Renamed from `callFrames`. (WI.DebuggerData.prototype.updateForPause): (WI.DebuggerData.prototype.updateForResume): (WI.DebuggerData.prototype.get asyncStackTrace): Deleted. * Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager.prototype.debuggerDidPause): Instead of having separate `callFrames` and `asyncStackTrace`, just create a `WI.StackTrace`. * Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js: (WI.ConsoleManager.prototype.messageWasAdded): * Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js: (WI.NetworkManager.prototype.resourceRequestWillBeSent): (WI.NetworkManager.prototype.resourceRequestWasServedFromMemoryCache): (WI.NetworkManager.prototype._initiatorStackTraceFromPayload): Renamed from `_initiatorCallFramesFromPayload`. (WI.NetworkManager.prototype._initiatorSourceCodeLocationFromPayload): * Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): (WI.TimelineManager.prototype._stackTraceFromPayload): Renamed from `_callFramesFromPayload`. * Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js: (WI.ConsoleMessage): (WI.ConsoleMessage.prototype.get sourceCodeLocation): * Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js: (WI.LayoutTimelineRecord): (WI.LayoutTimelineRecord.async fromJSON): (WI.LayoutTimelineRecord.prototype.toJSON): * Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js: (WI.RenderingFrameTimelineRecord.prototype.durationForTask): * Source/WebInspectorUI/UserInterface/Models/Resource.js: (WI.Resource): (WI.Resource.prototype.get initiatorStackTrace): Renamed from `initiatorCallFrames`. * Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js: (WI.ScriptTimelineRecord): (WI.ScriptTimelineRecord.async fromJSON): (WI.ScriptTimelineRecord.prototype.toJSON): * Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js: (WI.TimelineRecord): (WI.TimelineRecord.prototype.get stackTrace): Renamed from `callFrames`. (WI.TimelineRecord.prototype.get initiatorCallFrame): * Source/WebInspectorUI/UserInterface/Views/AnimationDetailsSidebarPanel.js: (WI.AnimationDetailsSidebarPanel.prototype._refreshBacktraceSection): * Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js: (WI.CanvasDetailsSidebarPanel.prototype._refreshBacktraceSection): * Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): * Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor.prototype._addThreadIndicatorForTarget): * Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js: (WI.TimelineDataGrid.prototype._dataGridSelectedNodeChanged): (WI.TimelineDataGrid.prototype._createPopoverContent): s/`callFrames`/`stackTrace` * Source/WebInspectorUI/UserInterface/Models/Animation.js: (WI.Animation.fromPayload): (WI.Animation.prototype.get stackTrace): Renamed from `backtrace`. * Source/WebInspectorUI/UserInterface/Models/Canvas.js: (WI.Canvas.fromPayload): (WI.Canvas.prototype.get stackTrace): Renamed from `backtrace`. * Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js: (WI.RecordingActionTreeElement.prototype.populateContextMenu): * Source/WebInspectorUI/UserInterface/Views/RecordingTraceDetailsSidebarPanel.js: (WI.RecordingTraceDetailsSidebarPanel.prototype.set action): (WI.RecordingTraceDetailsSidebarPanel): * Source/WebInspectorUI/UserInterface/Views/RecordingTraceDetailsSidebarPanel.css: (.sidebar > .details.recording-trace > .content > .no-stack-trace): Renamed from `.sidebar > .details.recording-trace > .content > .no-trace-data`. (.sidebar > .details.recording-trace > .content > .no-stack-trace > .message): Renamed from `.sidebar > .details.recording-trace > .content > .no-trace-data > .message`. * Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js: (WI.ResourceHeadersContentView.prototype._refreshSummarySection): s/`backtrace`/`stackTrace` * Source/WebInspectorUI/UserInterface/Models/Recording.js: (WI.Recording.prototype.async swizzle): * Source/WebInspectorUI/UserInterface/Models/RecordingAction.js: (WI.RecordingAction): (WI.RecordingAction.fromPayload): (WI.RecordingAction.prototype.get stackTrace): Renamed from `trace`. (WI.RecordingAction.prototype.async swizzle): (WI.RecordingAction.prototype.toJSON): Bump the `Recording` version and teach the swizzle engine how to (re)create a `WI.StackTrace`. * Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement) * Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css: (.call-frame:is(.async-boundary, .truncated-boundary)): Renamed from `.tree-outline .item.call-frame.async-boundary`. (.tree-outline .item.call-frame.async-boundary::before): (.tree-outline .children .item.call-frame.async-boundary::before): (.tree-outline.single-thread .children .item.call-frame.async-boundary::before): Renamed from `.tree-outline.single-thread .item.call-frame.async-boundary::before`. * Source/WebInspectorUI/UserInterface/Views/CallFrameView.js: (WI.CallFrameView): Share styles for async/truncated boundary "call frames" between `WI.CallFrameTreeElement` and `WI.CallFrameView`. * Source/JavaScriptCore/debugger/Debugger.h: (JSC::Debugger::Client::isInspectorDebuggerAgent const): Added. (JSC::Debugger::client const): Added. * Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h: (isType): Added. Allow callers to turn a `Debugger::Client` into a `InspectorDebuggerAgent`. This is done so that we don't have to use `Inspector` objects (specifically `AsyncStackTrace`) inside `JSC::Debugger`. * Source/JavaScriptCore/inspector/AsyncStackTrace.h: * Source/JavaScriptCore/inspector/AsyncStackTrace.cpp: (Inspector::AsyncStackTrace::create): (Inspector::AsyncStackTrace::AsyncStackTrace): (Inspector::AsyncStackTrace::at const): Added. (Inspector::AsyncStackTrace::size const): Added. (Inspector::AsyncStackTrace::topCallFrameIsBoundary const): Added. (Inspector::AsyncStackTrace::buildInspectorObject const): (Inspector::AsyncStackTrace::truncate): Add some helpers to make generating protocol objects easier. * Source/WebInspectorUI/UserInterface/Views/TreeElement.js: (WI.TreeElement.prototype.set selectable): (WI.TreeElement.prototype._attach): * Source/WebInspectorUI/UserInterface/Views/TreeOutline.css: (.tree-outline.non-selectable .item:not(.non-selectable):hover): Renamed from `.tree-outline.non-selectable .item:hover`. Drive-by: Hovering a non-selectable `WI.TreeElement` should not show a background even if the parent `WI.TreeOutline` is also non-selectable. * Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel.prototype.handleCopyEvent): Drive-by: Copying a truncated boundary "call frame" should behave like copying an async bounary "call frame". * Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.css: (@media (prefers-color-scheme: dark) .tree-outline > .item.thread .icon): (.tree-outline > .item.thread + ol > .item.truncated-call-frames): Deleted. (.tree-outline > .item.thread + ol > .item.truncated-call-frames .icon): Deleted. (@media (prefers-color-scheme: dark) .tree-outline > .item.thread + ol > .item.truncated-call-frames .icon): Deleted. Drive-by: Use the native [N] icon for truncated boundary "call frame". * Source/WebInspectorUI/UserInterface/Views/StackTraceView.js: (WI.StackTraceView): (WI.StackTraceView.prototype.get element): Deleted. * Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js: (WI.ConsoleMessageView.prototype._appendLocationLink): (WI.ConsoleMessageView.prototype._appendStackTrace): (WI.ConsoleMessageView.prototype._formatParameterAsString): (WI.ConsoleMessageView.prototype._shouldShowStackTrace): * Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js: (WI.ErrorObjectView.prototype._buildStackTrace): Drive-by: Change `new WI.StackTraceView` to just return the element to match `WI.CallFrameView`. * Source/JavaScriptCore/CMakeLists.txt * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js: * LayoutTests/inspector/animation/lifecycle-web-animation-expected.txt: * LayoutTests/inspector/animation/resources/lifecycle-utilities.js: (createAnimation): (InspectorTest.AnimationLifecycleUtilities.awaitAnimationCreated): * LayoutTests/inspector/canvas/resources/create-context-utilities.js: (awaitCanvasAdded): * LayoutTests/inspector/canvas/resources/recording-utilities.js: (logRecording): * LayoutTests/inspector/console/message-stack-trace-expected.txt: * LayoutTests/inspector/console/resources/log-console-stack-trace.js: (window.logConsoleMessageStackTrace): * LayoutTests/inspector/debugger/continueUntilNextRunLoop.html: * LayoutTests/inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html: * LayoutTests/inspector/debugger/paused-scopes.html: * LayoutTests/inspector/debugger/resources/async-stack-trace-test.js: (window.getAsyncStackTrace): * LayoutTests/inspector/debugger/resources/log-active-stack-trace.js: (window.getActiveStackTrace): * LayoutTests/inspector/debugger/tail-deleted-frames-this-value.html: * LayoutTests/inspector/debugger/tail-deleted-frames/resources/stack-trace-utilities.js: (window.getAsyncStackTrace): * LayoutTests/inspector/debugger/tail-recursion.html: * LayoutTests/inspector/model/recording-expected.txt: * LayoutTests/inspector/timeline/line-column-expected.txt: * LayoutTests/inspector/worker/debugger-multiple-targets-pause.html: * LayoutTests/platform/gtk/inspector/timeline/line-column-expected.txt: Canonical link: https://commits.webkit.org/252630@main
- Loading branch information