chrome-devtools-frontend 1.0.1657110 → 1.0.1660788

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +125 -0
  2. package/.agents/skills/migrate-chromium-test/SKILL.md +15 -70
  3. package/.agents/skills/repro-flaky-tests/SKILL.md +53 -0
  4. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +37 -18
  5. package/.agents/skills/version-control/SKILL.md +8 -1
  6. package/AUTHORS +1 -0
  7. package/SECURITY.md +3 -0
  8. package/docs/get_the_code.md +6 -0
  9. package/front_end/Images/src/ads.svg +1 -0
  10. package/front_end/Tests.js +6 -6
  11. package/front_end/core/common/Gzip.ts +12 -5
  12. package/front_end/core/common/ResourceType.ts +19 -19
  13. package/front_end/core/common/Revealer.ts +15 -15
  14. package/front_end/core/common/SettingRegistration.ts +19 -19
  15. package/front_end/core/host/AidaClient.ts +35 -9
  16. package/front_end/core/host/GdpClient.ts +10 -7
  17. package/front_end/core/platform/StringUtilities.ts +35 -0
  18. package/front_end/core/sdk/AccessibilityModel.snapshot.txt +17 -0
  19. package/front_end/core/sdk/AccessibilityModel.ts +132 -2
  20. package/front_end/core/sdk/CPUThrottlingManager.ts +8 -5
  21. package/front_end/core/sdk/CSSMetadata.ts +110 -16
  22. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -5
  23. package/front_end/core/sdk/ConsoleModel.ts +5 -5
  24. package/front_end/core/sdk/DOMDebuggerModel.ts +5 -1
  25. package/front_end/core/sdk/DOMModel.ts +32 -18
  26. package/front_end/core/sdk/NetworkManager.ts +58 -14
  27. package/front_end/core/sdk/NetworkRequest.ts +37 -1
  28. package/front_end/core/sdk/OverlayModel.ts +45 -6
  29. package/front_end/core/sdk/ResourceTreeModel.ts +6 -7
  30. package/front_end/core/sdk/ScreenCaptureModel.ts +2 -2
  31. package/front_end/core/sdk/ServerTiming.ts +17 -13
  32. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +4 -2
  33. package/front_end/core/sdk/ServiceWorkerManager.ts +19 -5
  34. package/front_end/core/sdk/TargetManager.ts +10 -1
  35. package/front_end/core/sdk/TraceObject.ts +4 -2
  36. package/front_end/core/sdk/sdk-meta.ts +170 -0
  37. package/front_end/design_system_tokens.css +0 -5
  38. package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -1
  39. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +13 -4
  40. package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +5 -2
  41. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +23 -4
  42. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +33 -10
  43. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +8 -3
  44. package/front_end/entrypoints/inspector_main/InspectorMain.ts +4 -4
  45. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +2 -2
  46. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +36 -37
  47. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +15 -33
  48. package/front_end/entrypoints/js_app/js_app.ts +6 -5
  49. package/front_end/entrypoints/main/GlobalAiButton.ts +4 -4
  50. package/front_end/entrypoints/main/MainImpl.ts +25 -55
  51. package/front_end/entrypoints/main/main-meta.ts +50 -50
  52. package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +5 -5
  53. package/front_end/entrypoints/node_app/app/NodeMain.ts +3 -3
  54. package/front_end/entrypoints/node_app/node_app.ts +10 -9
  55. package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
  56. package/front_end/foundation/Universe.ts +76 -6
  57. package/front_end/generated/InspectorBackendCommands.ts +3 -3
  58. package/front_end/generated/SupportedCSSProperties.js +19 -12
  59. package/front_end/generated/protocol.ts +7 -1
  60. package/front_end/models/ai_assistance/AiConversation.ts +19 -17
  61. package/front_end/models/ai_assistance/AiHistoryStorage.ts +37 -14
  62. package/front_end/models/ai_assistance/AiUtils.ts +38 -42
  63. package/front_end/models/ai_assistance/agents/AiAgent.ts +5 -1
  64. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -2
  65. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -1
  66. package/front_end/models/ai_assistance/agents/StorageAgent.ts +7 -5
  67. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +270 -286
  68. package/front_end/models/ai_assistance/data_formatters/UnitFormatters.ts +20 -0
  69. package/front_end/models/ai_assistance/performance/AICallTree.ts +3 -1
  70. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +3 -2
  71. package/front_end/models/autofill_manager/AutofillManager.ts +3 -1
  72. package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -5
  73. package/front_end/models/bindings/CompilerScriptMapping.ts +2 -1
  74. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +15 -16
  75. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +6 -4
  76. package/front_end/models/bindings/FileUtils.ts +11 -12
  77. package/front_end/models/bindings/NetworkProject.ts +4 -0
  78. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +2 -1
  79. package/front_end/models/bindings/ResourceUtils.ts +1 -1
  80. package/front_end/models/bindings/SASSSourceMapping.ts +8 -5
  81. package/front_end/models/emulation/DeviceModeModel.ts +14 -14
  82. package/front_end/models/emulation/EmulatedDevices.ts +392 -11
  83. package/front_end/models/extensions/ExtensionAPI.ts +6 -6
  84. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +13 -12
  85. package/front_end/models/issues_manager/BounceTrackingIssue.ts +1 -1
  86. package/front_end/models/issues_manager/ClientHintIssue.ts +1 -1
  87. package/front_end/models/issues_manager/ConnectionAllowlistIssue.ts +1 -1
  88. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +7 -7
  89. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +2 -2
  90. package/front_end/models/issues_manager/CookieIssue.ts +6 -7
  91. package/front_end/models/issues_manager/CorsIssue.ts +3 -3
  92. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +2 -2
  93. package/front_end/models/issues_manager/DeprecationIssue.ts +3 -3
  94. package/front_end/models/issues_manager/EmailVerificationRequestIssue.ts +1 -1
  95. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +1 -1
  96. package/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.ts +1 -1
  97. package/front_end/models/issues_manager/GenericIssue.ts +7 -7
  98. package/front_end/models/issues_manager/HeavyAdIssue.ts +3 -3
  99. package/front_end/models/issues_manager/Issue.ts +8 -8
  100. package/front_end/models/issues_manager/MixedContentIssue.ts +1 -1
  101. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +3 -3
  102. package/front_end/models/issues_manager/QuirksModeIssue.ts +1 -1
  103. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
  104. package/front_end/models/issues_manager/SelectivePermissionsInterventionIssue.ts +2 -2
  105. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +2 -2
  106. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +1 -1
  107. package/front_end/models/issues_manager/UnencodedDigestIssue.ts +3 -3
  108. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  109. package/front_end/models/stack_trace/StackTraceModel.ts +3 -3
  110. package/front_end/models/text_utils/ContentData.ts +27 -0
  111. package/front_end/models/trace/helpers/SamplesIntegrator.ts +21 -5
  112. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +29 -14
  113. package/front_end/models/web_mcp/WebMCPModel.ts +24 -6
  114. package/front_end/models/workspace/IgnoreListManager.ts +6 -6
  115. package/front_end/models/workspace/UISourceCode.ts +3 -3
  116. package/front_end/models/workspace_diff/WorkspaceDiff.ts +23 -12
  117. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -22
  118. package/front_end/panels/ai_assistance/ExportConversation.ts +3 -4
  119. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +3 -3
  120. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
  121. package/front_end/panels/ai_assistance/components/ChatMessage.ts +7 -0
  122. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +2 -2
  123. package/front_end/panels/animation/AnimationTimeline.ts +17 -19
  124. package/front_end/panels/animation/AnimationUI.ts +5 -5
  125. package/front_end/panels/animation/animation-meta.ts +2 -2
  126. package/front_end/panels/application/ApplicationPanelSidebar.ts +13 -4
  127. package/front_end/panels/application/BackgroundServiceView.ts +2 -1
  128. package/front_end/panels/application/DeviceBoundSessionsView.ts +2 -6
  129. package/front_end/panels/application/IndexedDBViews.ts +245 -262
  130. package/front_end/panels/application/OpenedWindowDetailsView.ts +1 -1
  131. package/front_end/panels/application/ResourcesPanel.ts +9 -2
  132. package/front_end/panels/application/ServiceWorkersView.ts +252 -211
  133. package/front_end/panels/application/StorageView.ts +97 -33
  134. package/front_end/panels/application/WebMCPView.ts +15 -1
  135. package/front_end/panels/application/components/AdsView.ts +1 -1
  136. package/front_end/panels/application/indexedDBViews.css +38 -9
  137. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +2 -1
  138. package/front_end/panels/application/resourcesSidebar.css +5 -0
  139. package/front_end/panels/application/storageView.css +26 -9
  140. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +5 -1
  141. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +8 -6
  142. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  143. package/front_end/panels/common/ExtensionServer.ts +119 -14
  144. package/front_end/panels/console/ConsoleContextSelector.ts +4 -4
  145. package/front_end/panels/console/ConsolePinPane.ts +12 -12
  146. package/front_end/panels/console/ConsolePrompt.ts +6 -6
  147. package/front_end/panels/console/ConsoleSidebar.ts +7 -7
  148. package/front_end/panels/console/ConsoleView.ts +45 -44
  149. package/front_end/panels/console/ConsoleViewMessage.ts +40 -40
  150. package/front_end/panels/console/SymbolizedErrorWidget.ts +2 -1
  151. package/front_end/panels/console/console-meta.ts +34 -34
  152. package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -2
  153. package/front_end/panels/coverage/CoverageListView.ts +28 -28
  154. package/front_end/panels/coverage/CoverageModel.ts +2 -1
  155. package/front_end/panels/coverage/CoverageView.ts +23 -23
  156. package/front_end/panels/coverage/coverage-meta.ts +5 -5
  157. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +36 -36
  158. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +1 -1
  159. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +2 -2
  160. package/front_end/panels/css_overview/CSSOverviewStartView.ts +6 -6
  161. package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +6 -6
  162. package/front_end/panels/css_overview/css_overview-meta.ts +2 -2
  163. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +20 -21
  164. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +6 -8
  165. package/front_end/panels/developer_resources/developer_resources-meta.ts +2 -2
  166. package/front_end/panels/elements/AccessibilityTreeUtils.ts +8 -102
  167. package/front_end/panels/elements/AccessibilityTreeView.ts +163 -70
  168. package/front_end/panels/elements/ElementsPanel.ts +17 -11
  169. package/front_end/panels/elements/ElementsTreeElement.ts +49 -2
  170. package/front_end/panels/elements/ElementsTreeOutline.ts +4 -4
  171. package/front_end/panels/elements/LayoutPane.ts +1 -1
  172. package/front_end/panels/elements/MetricsSidebarPane.ts +100 -34
  173. package/front_end/panels/elements/StylePropertiesSection.ts +2 -2
  174. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -2
  175. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  176. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +7 -18
  177. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +2 -2
  178. package/front_end/panels/elements/components/QueryContainer.ts +1 -1
  179. package/front_end/panels/issues/AffectedDirectivesView.ts +1 -1
  180. package/front_end/panels/issues/AffectedResourcesView.ts +2 -1
  181. package/front_end/panels/layer_viewer/LayerViewHost.ts +1 -1
  182. package/front_end/panels/media/EventDisplayTable.ts +2 -2
  183. package/front_end/panels/media/EventTimelineView.ts +4 -4
  184. package/front_end/panels/media/MainView.ts +4 -4
  185. package/front_end/panels/media/PlayerDetailView.ts +5 -5
  186. package/front_end/panels/media/PlayerListView.ts +1 -1
  187. package/front_end/panels/media/PlayerMessagesView.ts +12 -12
  188. package/front_end/panels/media/PlayerPropertiesView.ts +17 -17
  189. package/front_end/panels/network/NetworkDataGridNode.ts +124 -36
  190. package/front_end/panels/network/NetworkLogView.ts +11 -2
  191. package/front_end/panels/network/NetworkLogViewColumns.ts +18 -0
  192. package/front_end/panels/network/NetworkPanel.ts +2 -1
  193. package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -3
  194. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  195. package/front_end/panels/network/RequestPayloadView.ts +53 -7
  196. package/front_end/panels/network/RequestPreviewView.ts +7 -1
  197. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  198. package/front_end/panels/network/forward/UIFilter.ts +1 -0
  199. package/front_end/panels/network/networkPanel.css +1 -0
  200. package/front_end/panels/network/networkTimingTable.css +1 -1
  201. package/front_end/panels/network/requestPayloadView.css +10 -0
  202. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +12 -12
  203. package/front_end/panels/performance_monitor/performance_monitor-meta.ts +7 -7
  204. package/front_end/panels/profiler/HeapDetachedElementsView.ts +2 -2
  205. package/front_end/panels/profiler/HeapProfileView.ts +563 -51
  206. package/front_end/panels/profiler/HeapSnapshotView.ts +15 -9
  207. package/front_end/panels/profiler/ProfilesPanel.ts +13 -7
  208. package/front_end/panels/profiler/WritableProfileHeader.ts +152 -0
  209. package/front_end/panels/profiler/profiler.ts +2 -2
  210. package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -10
  211. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +28 -32
  212. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  213. package/front_end/panels/recorder/RecorderController.ts +15 -15
  214. package/front_end/panels/recorder/RecorderEvents.ts +8 -0
  215. package/front_end/panels/recorder/components/CreateRecordingView.ts +11 -11
  216. package/front_end/panels/recorder/components/ExtensionView.ts +74 -83
  217. package/front_end/panels/recorder/components/RecordingListView.ts +3 -3
  218. package/front_end/panels/recorder/components/RecordingView.ts +13 -10
  219. package/front_end/panels/recorder/components/ReplaySection.ts +9 -9
  220. package/front_end/panels/recorder/components/StepEditor.ts +352 -321
  221. package/front_end/panels/recorder/components/StepView.ts +36 -37
  222. package/front_end/panels/recorder/components/recordingView.css +1 -1
  223. package/front_end/panels/recorder/models/RecorderSettings.ts +2 -2
  224. package/front_end/panels/recorder/recorder-meta.ts +7 -7
  225. package/front_end/panels/screencast/ScreencastApp.ts +1 -1
  226. package/front_end/panels/screencast/ScreencastView.ts +12 -12
  227. package/front_end/panels/search/SearchResultsPane.ts +4 -4
  228. package/front_end/panels/search/SearchView.ts +20 -20
  229. package/front_end/panels/security/SecurityModel.ts +7 -7
  230. package/front_end/panels/security/SecurityPanel.ts +99 -107
  231. package/front_end/panels/security/SecurityPanelSidebar.ts +7 -7
  232. package/front_end/panels/security/security-meta.ts +2 -2
  233. package/front_end/panels/sensors/LocationsSettingsTab.ts +19 -19
  234. package/front_end/panels/sensors/SensorsView.ts +27 -27
  235. package/front_end/panels/sensors/sensors-meta.ts +13 -167
  236. package/front_end/panels/settings/AISettingsTab.ts +98 -56
  237. package/front_end/panels/settings/EditFileSystemView.ts +2 -2
  238. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +20 -20
  239. package/front_end/panels/settings/KeybindsSettingsTab.ts +20 -21
  240. package/front_end/panels/settings/SettingsScreen.ts +11 -11
  241. package/front_end/panels/settings/WorkspaceSettingsTab.ts +5 -5
  242. package/front_end/panels/settings/components/SyncSection.ts +12 -12
  243. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +13 -13
  244. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +31 -31
  245. package/front_end/panels/settings/emulation/emulation-meta.ts +1 -1
  246. package/front_end/panels/settings/settings-meta.ts +14 -14
  247. package/front_end/panels/sources/NavigatorView.ts +7 -6
  248. package/front_end/panels/sources/ScopeChainSidebarPane.ts +83 -37
  249. package/front_end/panels/sources/SourcesNavigator.ts +20 -18
  250. package/front_end/panels/sources/SourcesView.ts +10 -1
  251. package/front_end/panels/sources/scopeChainSidebarPane.css +12 -4
  252. package/front_end/panels/sources/sources-meta.ts +4 -4
  253. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +5 -2
  254. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -1
  255. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +2 -1
  256. package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
  257. package/front_end/panels/timeline/TimelinePanel.ts +2 -1
  258. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
  259. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +4 -2
  260. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +4 -2
  261. package/front_end/panels/timeline/components/insights/ImageRef.ts +2 -1
  262. package/front_end/panels/utils/utils.ts +7 -3
  263. package/front_end/panels/web_audio/WebAudioView.ts +17 -18
  264. package/front_end/panels/web_audio/web_audio-meta.ts +3 -3
  265. package/front_end/panels/webauthn/WebauthnPane.ts +10 -10
  266. package/front_end/panels/whats_new/ReleaseNoteView.ts +1 -1
  267. package/front_end/panels/whats_new/whats_new-meta.ts +11 -11
  268. package/front_end/third_party/chromium/README.chromium +1 -1
  269. package/front_end/third_party/lit/lib/async-directive.d.ts +2 -1
  270. package/front_end/third_party/lit/lib/async-directive.js +1 -1
  271. package/front_end/third_party/lit/lib/async-directive.js.map +1 -1
  272. package/front_end/third_party/lit/lib/decorators.d.ts +2 -1
  273. package/front_end/third_party/lit/lib/decorators.js.map +1 -1
  274. package/front_end/third_party/lit/lib/directive.d.ts +2 -1
  275. package/front_end/third_party/lit/lib/directive.js.map +1 -1
  276. package/front_end/third_party/lit/lib/directives.d.ts +2 -1
  277. package/front_end/third_party/lit/lib/directives.js +8 -8
  278. package/front_end/third_party/lit/lib/directives.js.map +1 -1
  279. package/front_end/third_party/lit/lib/lit.d.ts +2 -1
  280. package/front_end/third_party/lit/lib/lit.js +1 -1
  281. package/front_end/third_party/lit/lib/lit.js.map +1 -1
  282. package/front_end/third_party/lit/lib/static-html.d.ts +2 -1
  283. package/front_end/third_party/lit/lib/static-html.js +1 -1
  284. package/front_end/third_party/lit/lib/static-html.js.map +1 -1
  285. package/front_end/third_party/lit/package.json +2 -2
  286. package/front_end/third_party/lit/rebuild.sh +1 -1
  287. package/front_end/third_party/lit/src/async-directive.ts +5 -0
  288. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  289. package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -1
  290. package/front_end/ui/components/dialogs/shortcutDialog.css +15 -12
  291. package/front_end/ui/components/diff_view/DiffView.ts +2 -2
  292. package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
  293. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +5 -5
  294. package/front_end/ui/components/lists/List.ts +2 -2
  295. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  296. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +5 -5
  297. package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
  298. package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
  299. package/front_end/ui/components/survey_link/SurveyLink.ts +3 -3
  300. package/front_end/ui/components/text_editor/config.ts +2 -2
  301. package/front_end/ui/components/tree_outline/TreeOutline.ts +34 -1
  302. package/front_end/ui/legacy/ReportView.ts +5 -0
  303. package/front_end/ui/legacy/Treeoutline.ts +18 -0
  304. package/front_end/ui/legacy/View.ts +1 -1
  305. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -0
  306. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +8 -3
  307. package/front_end/ui/legacy/components/data_grid/data_grid.ts +1 -0
  308. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
  309. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +100 -36
  310. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +7 -1
  311. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +5 -0
  312. package/front_end/ui/legacy/components/utils/ImagePreview.ts +4 -2
  313. package/front_end/ui/legacy/inspectorCommon.css +5 -0
  314. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  315. package/mcp/mcp.ts +2 -0
  316. package/package.json +4 -4
  317. package/front_end/panels/profiler/ProfileView.ts +0 -610
@@ -4,22 +4,29 @@
4
4
  /* eslint-disable @devtools/no-imperative-dom-api */
5
5
 
6
6
  import * as Common from '../../core/common/common.js';
7
+ import * as Host from '../../core/host/host.js';
7
8
  import * as i18n from '../../core/i18n/i18n.js';
8
9
  import * as Platform from '../../core/platform/platform.js';
9
10
  import * as SDK from '../../core/sdk/sdk.js';
10
11
  import type * as Protocol from '../../generated/protocol.js';
12
+ import * as Bindings from '../../models/bindings/bindings.js';
11
13
  import * as CPUProfile from '../../models/cpu_profile/cpu_profile.js';
14
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
15
+ import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
12
16
  import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
13
17
  import * as SettingsUI from '../../ui/legacy/components/settings_ui/settings_ui.js';
14
18
  import * as Components from '../../ui/legacy/components/utils/utils.js';
15
19
  import * as UI from '../../ui/legacy/legacy.js';
20
+ import {Directives, html, nothing, type TemplateResult} from '../../ui/lit/lit.js';
16
21
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
22
 
23
+ import {BottomUpProfileDataGridTree} from './BottomUpProfileDataGrid.js';
18
24
  import {Events, HeapTimelineOverview, type IdsRangeChangedEvent, type Samples} from './HeapTimelineOverview.js';
19
- import type {Formatter, ProfileDataGridNode} from './ProfileDataGrid.js';
20
- import {ProfileFlameChartDataProvider} from './ProfileFlameChartDataProvider.js';
25
+ import {type Formatter, type ProfileDataGridNode, ProfileDataGridTree} from './ProfileDataGrid.js';
26
+ import {ProfileFlameChart, ProfileFlameChartDataProvider} from './ProfileFlameChartDataProvider.js';
21
27
  import {ProfileEvents, type ProfileHeader, ProfileType} from './ProfileHeader.js';
22
- import {ProfileView, WritableProfileHeader} from './ProfileView.js';
28
+ import {TopDownProfileDataGridTree} from './TopDownProfileDataGrid.js';
29
+ import {WritableProfileHeader} from './WritableProfileHeader.js';
23
30
 
24
31
  const UIStrings = {
25
32
  /**
@@ -108,28 +115,117 @@ const UIStrings = {
108
115
  * @description Label for a checkbox in the memory panel to enable sampling heap profiler timeline.
109
116
  */
110
117
  samplingHeapProfilerTimeline: 'Sampling heap profiler timeline',
118
+ /**
119
+ * @description Text in Profile View of a profiler tool
120
+ */
121
+ profile: 'Profile',
122
+ /**
123
+ * @description Placeholder text in the search box of the JavaScript profiler tool. Users can search
124
+ *the results by the cost in milliseconds, the name of the function, or the file name.
125
+ */
126
+ findByCostMsNameOrFile: 'Find by cost (>50ms), name or file',
127
+ /**
128
+ * @description Text for a programming function
129
+ */
130
+ function: 'Function',
131
+ /**
132
+ * @description Title of the Profiler tool
133
+ */
134
+ profiler: 'Profiler',
135
+ /**
136
+ * @description Aria-label for profiles view combobox in memory tool
137
+ */
138
+ profileViewMode: 'Profile view mode',
139
+ /**
140
+ * @description Tooltip text that appears when hovering over the largeicon visibility button in the Profile View of a profiler tool
141
+ */
142
+ focusSelectedFunction: 'Focus selected function',
143
+ /**
144
+ * @description Tooltip text that appears when hovering over the largeicon delete button in the Profile View of a profiler tool
145
+ */
146
+ excludeSelectedFunction: 'Exclude selected function',
147
+ /**
148
+ * @description Tooltip text that appears when hovering over the largeicon refresh button in the Profile View of a profiler tool
149
+ */
150
+ restoreAllFunctions: 'Restore all functions',
151
+ /**
152
+ * @description Text in Profile View of a profiler tool
153
+ */
154
+ chart: 'Chart',
155
+ /**
156
+ * @description Text in Profile View of a profiler tool
157
+ */
158
+ heavyBottomUp: 'Heavy (Bottom Up)',
159
+ /**
160
+ * @description Text for selecting different profile views in the JS profiler tool. This option is a tree view.
161
+ */
162
+ treeTopDown: 'Tree (Top Down)',
111
163
  } as const;
112
164
  const str_ = i18n.i18n.registerUIStrings('panels/profiler/HeapProfileView.ts', UIStrings);
113
165
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
166
+ const {ref} = Directives;
167
+
114
168
  function convertToSamplingHeapProfile(profileHeader: SamplingHeapProfileHeader):
115
169
  Protocol.HeapProfiler.SamplingHeapProfile {
116
170
  return (profileHeader.profile || profileHeader.protocolProfile()) as Protocol.HeapProfiler.SamplingHeapProfile;
117
171
  }
118
172
 
119
- export class HeapProfileView extends ProfileView implements UI.SearchableView.Searchable {
120
- override profileHeader: SamplingHeapProfileHeader;
173
+ export const maxLinkLength = 30;
174
+
175
+ export const enum ViewTypes {
176
+ FLAME = 'Flame',
177
+ TREE = 'Tree',
178
+ HEAVY = 'Heavy',
179
+ }
180
+
181
+ export class HeapProfileView extends UI.View.SimpleView implements UI.SearchableView.Searchable {
182
+ profileHeader: SamplingHeapProfileHeader;
121
183
  readonly profileType: SamplingHeapProfileTypeBase;
122
- override adjustedTotal: number;
123
- readonly selectedSizeText: UI.Toolbar.ToolbarText;
124
- timestamps: number[];
125
- sizes: number[];
126
- max: number[];
127
- ordinals: number[];
128
- totalTime: number;
129
- lastOrdinal: number;
130
- readonly timelineOverview: HeapTimelineOverview;
184
+ adjustedTotal: number;
185
+ selectedSizeText: HTMLElement|undefined;
186
+ timestamps: number[] = [];
187
+ sizes: number[] = [];
188
+ max: number[] = [];
189
+ ordinals: number[] = [];
190
+ totalTime = 0;
191
+ lastOrdinal = 0;
192
+ readonly timelineOverview: HeapTimelineOverview = new HeapTimelineOverview();
193
+ profileInternal: CPUProfile.ProfileTreeModel.ProfileTreeModel|null = null;
194
+ searchableViewInternal!: UI.SearchableView.SearchableView;
195
+ dataGrid: DataGrid.DataGrid.DataGridImpl<unknown>;
196
+ viewSelectComboBox: HTMLSelectElement|undefined;
197
+ focusButton!: UI.Toolbar.ToolbarButton;
198
+ excludeButton!: UI.Toolbar.ToolbarButton;
199
+ resetButton: Buttons.Button.Button|undefined;
200
+ readonly linkifierInternal: Components.Linkifier.Linkifier = new Components.Linkifier.Linkifier(maxLinkLength);
201
+ nodeFormatter!: Formatter;
202
+ viewType!: Common.Settings.Setting<ViewTypes>;
203
+ bottomUpProfileDataGridTree?: BottomUpProfileDataGridTree|null;
204
+ topDownProfileDataGridTree?: TopDownProfileDataGridTree|null;
205
+ currentSearchResultIndex?: number;
206
+ dataProvider?: ProfileFlameChartDataProvider;
207
+ flameChart?: ProfileFlameChart;
208
+ visibleView?: ProfileFlameChart|DataGrid.DataGrid.DataGridWidget<unknown>;
209
+ searchableElement?: ProfileDataGridTree|ProfileFlameChart;
210
+ profileDataGridTree?: ProfileDataGridTree;
211
+
212
+ #isNodeSelected = false;
213
+ #isResetEnabled = false;
214
+ #selectedSize: number|null = null;
215
+ #minId: number|null = null;
216
+ #maxId: number|null = null;
217
+ #lastAppliedRange: {minId: number, maxId: number}|null = null;
218
+ #lastAppliedViewType: ViewTypes|null = null;
219
+
131
220
  constructor(profileHeader: SamplingHeapProfileHeader) {
132
- super();
221
+ super({
222
+ title: i18nString(UIStrings.profile),
223
+ viewId: 'profile',
224
+ });
225
+
226
+ this.#setupSearchableView();
227
+
228
+ this.dataGrid = this.#createDataGrid();
133
229
 
134
230
  this.profileHeader = profileHeader;
135
231
  this.profileType = profileHeader.profileType();
@@ -138,17 +234,10 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
138
234
  this.adjustedTotal = profile.total;
139
235
  this.setProfile(profile);
140
236
 
141
- this.selectedSizeText = new UI.Toolbar.ToolbarText();
142
-
143
- this.timestamps = [];
144
- this.sizes = [];
145
- this.max = [];
146
- this.ordinals = [];
147
- this.totalTime = 0;
148
- this.lastOrdinal = 0;
149
-
150
- this.timelineOverview = new HeapTimelineOverview();
237
+ this.#setupTimelineOverview();
238
+ }
151
239
 
240
+ #setupTimelineOverview(): void {
152
241
  if (this.profileType.hasTemporaryView()) {
153
242
  this.timelineOverview.addEventListener(Events.IDS_RANGE_CHANGED, this.onIdsRangeChanged.bind(this));
154
243
  this.timelineOverview.show(this.element, this.element.firstChild);
@@ -163,15 +252,113 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
163
252
  }
164
253
  }
165
254
 
166
- override async toolbarItems(): Promise<UI.Toolbar.ToolbarItem[]> {
167
- return [...await super.toolbarItems(), this.selectedSizeText];
255
+ #setupSearchableView(): void {
256
+ this.searchableViewInternal = new UI.SearchableView.SearchableView(this, null);
257
+ this.searchableViewInternal.setPlaceholder(i18nString(UIStrings.findByCostMsNameOrFile));
258
+ this.searchableViewInternal.show(this.element);
259
+ }
260
+
261
+ #createDataGrid(): DataGrid.DataGrid.DataGridImpl<unknown> {
262
+ const columns: DataGrid.DataGrid.ColumnDescriptor[] = [];
263
+ columns.push({
264
+ id: 'self',
265
+ title: this.columnHeader('self'),
266
+ width: '120px',
267
+ fixedWidth: true,
268
+ sortable: true,
269
+ sort: DataGrid.DataGrid.Order.Descending,
270
+ });
271
+ columns.push({
272
+ id: 'total',
273
+ title: this.columnHeader('total'),
274
+ width: '120px',
275
+ fixedWidth: true,
276
+ sortable: true,
277
+ });
278
+ columns.push({
279
+ id: 'function',
280
+ title: i18nString(UIStrings.function),
281
+ disclosure: true,
282
+ sortable: true,
283
+ });
284
+
285
+ const dataGrid = new DataGrid.DataGrid.DataGridImpl({
286
+ displayName: i18nString(UIStrings.profiler),
287
+ columns,
288
+ });
289
+ dataGrid.addEventListener(DataGrid.DataGrid.Events.SORTING_CHANGED, this.sortProfile, this);
290
+ dataGrid.addEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.nodeSelected.bind(this, true));
291
+ dataGrid.addEventListener(DataGrid.DataGrid.Events.DESELECTED_NODE, this.nodeSelected.bind(this, false));
292
+ dataGrid.setRowContextMenuCallback(this.populateContextMenu.bind(this));
293
+
294
+ return dataGrid;
295
+ }
296
+
297
+ override async toolbarItems(): Promise<TemplateResult> {
298
+ const currentViewType = this.viewType.get();
299
+ const isFlame = currentViewType === ViewTypes.FLAME;
300
+
301
+ // clang-format off
302
+ return html`
303
+ <select title=${i18nString(UIStrings.profileViewMode)} aria-label=${i18nString(UIStrings.profileViewMode)}
304
+ @change=${this.changeView.bind(this)}
305
+ jslog=${VisualLogging.dropDown('profile-view.selected-view').track({change: true})}
306
+ ${ref(e => { this.viewSelectComboBox = e as HTMLSelectElement; })}>
307
+ <option value=${ViewTypes.FLAME} ?selected=${currentViewType === ViewTypes.FLAME}>
308
+ ${i18nString(UIStrings.chart)}
309
+ </option>
310
+ <option value=${ViewTypes.HEAVY} ?selected=${currentViewType === ViewTypes.HEAVY}>
311
+ ${i18nString(UIStrings.heavyBottomUp)}
312
+ </option>
313
+ <option value=${ViewTypes.TREE} ?selected=${currentViewType === ViewTypes.TREE}>
314
+ ${i18nString(UIStrings.treeTopDown)}
315
+ </option>
316
+ </select>
317
+ <devtools-button .data=${{
318
+ iconName: 'eye',
319
+ variant: Buttons.Button.Variant.TOOLBAR,
320
+ title: i18nString(UIStrings.focusSelectedFunction),
321
+ jslogContext: 'profile-view.focus-selected-function',
322
+ disabled: !this.#isNodeSelected,
323
+ } as Buttons.Button.ButtonData}
324
+ @click=${this.focusClicked.bind(this)}
325
+ ?hidden=${isFlame}>
326
+ </devtools-button>
327
+ <devtools-button .data=${{
328
+ iconName: 'cross',
329
+ variant: Buttons.Button.Variant.TOOLBAR,
330
+ title: i18nString(UIStrings.excludeSelectedFunction),
331
+ jslogContext: 'profile-view.exclude-selected-function',
332
+ disabled: !this.#isNodeSelected,
333
+ } as Buttons.Button.ButtonData}
334
+ @click=${this.excludeClicked.bind(this)}
335
+ ?hidden=${isFlame}>
336
+ </devtools-button>
337
+ <devtools-button .data=${{
338
+ iconName: 'refresh',
339
+ variant: Buttons.Button.Variant.TOOLBAR,
340
+ title: i18nString(UIStrings.restoreAllFunctions),
341
+ jslogContext: 'profile-view.restore-all-functions',
342
+ disabled: !this.#isResetEnabled,
343
+ } as Buttons.Button.ButtonData}
344
+ @click=${this.resetClicked.bind(this)}
345
+ ?hidden=${isFlame}
346
+ ${ref(e => {this.resetButton = e as Buttons.Button.Button; })}>
347
+ </devtools-button>
348
+ <span ${ref(e => { this.selectedSizeText = e as HTMLElement; })}>
349
+ ${this.#selectedSize !== null ?
350
+ i18nString(UIStrings.selectedSizeS, {PH1: i18n.ByteUtilities.bytesToString(this.#selectedSize)})
351
+ : nothing}
352
+ </span>`;
353
+ // clang-format on
168
354
  }
169
355
 
170
356
  onIdsRangeChanged(event: Common.EventTarget.EventTargetEvent<IdsRangeChangedEvent>): void {
171
357
  const {minId, maxId} = event.data;
172
- this.selectedSizeText.setText(
173
- i18nString(UIStrings.selectedSizeS, {PH1: i18n.ByteUtilities.bytesToString(event.data.size)}));
174
- this.setSelectionRange(minId, maxId);
358
+ this.#selectedSize = event.data.size;
359
+ this.#minId = minId;
360
+ this.#maxId = maxId;
361
+ this.performUpdate();
175
362
  }
176
363
 
177
364
  setSelectionRange(minId: number, maxId: number): void {
@@ -199,8 +386,8 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
199
386
  this.ordinals.push(this.lastOrdinal + 1);
200
387
  for (const sample of profile?.samples ?? []) {
201
388
  this.lastOrdinal = Math.max(this.lastOrdinal, sample.ordinal);
202
- const bucket = Platform.ArrayUtilities.upperBound(
203
- this.ordinals, sample.ordinal, Platform.ArrayUtilities.DEFAULT_COMPARATOR) -
389
+ const bucket = Platform.ArrayUtilities.upperBound(this.ordinals, sample.ordinal,
390
+ Platform.ArrayUtilities.DEFAULT_COMPARATOR) -
204
391
  1;
205
392
  this.sizes[bucket] += sample.size;
206
393
  }
@@ -211,18 +398,10 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
211
398
  this.totalTime *= 2;
212
399
  }
213
400
 
214
- const samples = ({
215
- sizes: this.sizes,
216
- max: this.max,
217
- ids: this.ordinals,
218
- timestamps: this.timestamps,
219
- totalTime: this.totalTime,
220
- } as Samples);
221
-
222
- this.timelineOverview.setSamples(samples);
401
+ this.performUpdate();
223
402
  }
224
403
 
225
- override columnHeader(columnId: string): Common.UIString.LocalizedString {
404
+ columnHeader(columnId: string): Common.UIString.LocalizedString {
226
405
  switch (columnId) {
227
406
  case 'self':
228
407
  return i18nString(UIStrings.selfSizeBytes);
@@ -232,9 +411,343 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
232
411
  return Common.UIString.LocalizedEmptyString;
233
412
  }
234
413
 
235
- override createFlameChartDataProvider(): ProfileFlameChartDataProvider {
236
- return new HeapFlameChartDataProvider(
237
- (this.profile() as SamplingHeapProfileModel), this.profileHeader.heapProfilerModel());
414
+ createFlameChartDataProvider(): ProfileFlameChartDataProvider {
415
+ return new HeapFlameChartDataProvider((this.profile() as SamplingHeapProfileModel),
416
+ this.profileHeader.heapProfilerModel());
417
+ }
418
+
419
+ static buildPopoverTable(popoverInfo: Array<{
420
+ title: string,
421
+ value: string,
422
+ }>): Element {
423
+ const table = document.createElement('table');
424
+ for (const entry of popoverInfo) {
425
+ const row = table.createChild('tr');
426
+ row.createChild('td').textContent = entry.title;
427
+ row.createChild('td').textContent = entry.value;
428
+ }
429
+ return table;
430
+ }
431
+
432
+ setProfile(profile: CPUProfile.ProfileTreeModel.ProfileTreeModel): void {
433
+ this.profileInternal = profile;
434
+ this.bottomUpProfileDataGridTree = null;
435
+ this.topDownProfileDataGridTree = null;
436
+ this.changeView();
437
+ this.refresh();
438
+ }
439
+
440
+ profile(): CPUProfile.ProfileTreeModel.ProfileTreeModel|null {
441
+ return this.profileInternal;
442
+ }
443
+
444
+ initialize(nodeFormatter: Formatter): void {
445
+ this.nodeFormatter = nodeFormatter;
446
+
447
+ this.viewType = Common.Settings.Settings.instance().createSetting('profile-view', ViewTypes.HEAVY);
448
+
449
+ this.changeView();
450
+ if (this.flameChart) {
451
+ this.flameChart.update();
452
+ }
453
+ }
454
+
455
+ override focus(): void {
456
+ if (this.flameChart) {
457
+ this.flameChart.focus();
458
+ } else {
459
+ super.focus();
460
+ }
461
+ }
462
+
463
+ selectRange(timeLeft: number, timeRight: number): void {
464
+ if (!this.flameChart) {
465
+ return;
466
+ }
467
+ this.flameChart.selectRange(timeLeft, timeRight);
468
+ }
469
+
470
+ getBottomUpProfileDataGridTree(): ProfileDataGridTree {
471
+ if (!this.bottomUpProfileDataGridTree) {
472
+ this.bottomUpProfileDataGridTree = new BottomUpProfileDataGridTree(
473
+ this.nodeFormatter, this.searchableViewInternal,
474
+ (this.profileInternal as CPUProfile.ProfileTreeModel.ProfileTreeModel).root, this.adjustedTotal);
475
+ }
476
+ return this.bottomUpProfileDataGridTree;
477
+ }
478
+
479
+ getTopDownProfileDataGridTree(): ProfileDataGridTree {
480
+ if (!this.topDownProfileDataGridTree) {
481
+ this.topDownProfileDataGridTree = new TopDownProfileDataGridTree(
482
+ this.nodeFormatter, this.searchableViewInternal,
483
+ (this.profileInternal as CPUProfile.ProfileTreeModel.ProfileTreeModel).root, this.adjustedTotal);
484
+ }
485
+ return this.topDownProfileDataGridTree;
486
+ }
487
+
488
+ populateContextMenu(contextMenu: UI.ContextMenu.ContextMenu,
489
+ gridNode: DataGrid.DataGrid.DataGridNode<unknown>): void {
490
+ const node = (gridNode as ProfileDataGridNode);
491
+ if (node.linkElement) {
492
+ contextMenu.appendApplicableItems(node.linkElement);
493
+ }
494
+ }
495
+
496
+ override willHide(): void {
497
+ super.willHide();
498
+ this.currentSearchResultIndex = -1;
499
+ }
500
+
501
+ refresh(): void {
502
+ if (!this.profileDataGridTree) {
503
+ return;
504
+ }
505
+ this.dataGrid.rootNode().removeChildren();
506
+
507
+ const children = this.profileDataGridTree.children;
508
+ const count = children.length;
509
+
510
+ for (let index = 0; index < count; ++index) {
511
+ this.dataGrid.rootNode().appendChild(children[index]);
512
+ }
513
+ }
514
+
515
+ refreshVisibleData(): void {
516
+ let child: (DataGrid.DataGrid.DataGridNode<unknown>|null) = this.dataGrid.rootNode().children[0];
517
+ while (child) {
518
+ child.refresh();
519
+ child = child.traverseNextNode(false, null, true);
520
+ }
521
+ }
522
+
523
+ searchableView(): UI.SearchableView.SearchableView {
524
+ return this.searchableViewInternal;
525
+ }
526
+
527
+ supportsCaseSensitiveSearch(): boolean {
528
+ return true;
529
+ }
530
+
531
+ supportsWholeWordSearch(): boolean {
532
+ return false;
533
+ }
534
+
535
+ supportsRegexSearch(): boolean {
536
+ return false;
537
+ }
538
+
539
+ onSearchCanceled(): void {
540
+ if (this.searchableElement) {
541
+ this.searchableElement.onSearchCanceled();
542
+ }
543
+ }
544
+
545
+ performSearch(searchConfig: UI.SearchableView.SearchConfig, shouldJump: boolean, jumpBackwards?: boolean): void {
546
+ if (this.searchableElement) {
547
+ this.searchableElement.performSearch(searchConfig, shouldJump, jumpBackwards);
548
+ }
549
+ }
550
+
551
+ jumpToNextSearchResult(): void {
552
+ if (this.searchableElement) {
553
+ this.searchableElement.jumpToNextSearchResult();
554
+ }
555
+ }
556
+
557
+ jumpToPreviousSearchResult(): void {
558
+ if (this.searchableElement) {
559
+ this.searchableElement.jumpToPreviousSearchResult();
560
+ }
561
+ }
562
+
563
+ linkifier(): Components.Linkifier.Linkifier {
564
+ return this.linkifierInternal;
565
+ }
566
+
567
+ ensureFlameChartCreated(): void {
568
+ if (this.flameChart) {
569
+ return;
570
+ }
571
+ this.dataProvider = this.createFlameChartDataProvider();
572
+ this.flameChart = new ProfileFlameChart(this.searchableViewInternal, this.dataProvider);
573
+ this.flameChart.addEventListener(PerfUI.FlameChart.Events.ENTRY_INVOKED, event => {
574
+ void this.onEntryInvoked(event);
575
+ });
576
+ }
577
+
578
+ async onEntryInvoked(event: Common.EventTarget.EventTargetEvent<number>): Promise<void> {
579
+ if (!this.dataProvider) {
580
+ return;
581
+ }
582
+ const entryIndex = event.data;
583
+ const node = this.dataProvider.entryNodes[entryIndex];
584
+ const debuggerModel = this.profileHeader.debuggerModel;
585
+ if (!node || !node.scriptId || !debuggerModel) {
586
+ return;
587
+ }
588
+ const script = debuggerModel.scriptForId(node.scriptId);
589
+ if (!script) {
590
+ return;
591
+ }
592
+ const location = (debuggerModel.createRawLocation(script, node.lineNumber, node.columnNumber));
593
+ const uiLocation =
594
+ await Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().rawLocationToUILocation(location);
595
+ void Common.Revealer.reveal(uiLocation);
596
+ }
597
+
598
+ changeView(): void {
599
+ if (!this.profileInternal) {
600
+ return;
601
+ }
602
+
603
+ if (this.viewSelectComboBox) {
604
+ this.viewType.set(this.viewSelectComboBox.value as ViewTypes);
605
+ }
606
+ this.performUpdate();
607
+ }
608
+
609
+ nodeSelected(selected: boolean): void {
610
+ this.#isNodeSelected = selected;
611
+ this.performUpdate();
612
+ }
613
+
614
+ focusClicked(): void {
615
+ if (!this.dataGrid.selectedNode) {
616
+ return;
617
+ }
618
+
619
+ this.#isResetEnabled = true;
620
+ this.performUpdate();
621
+ this.resetButton?.focus();
622
+ if (this.profileDataGridTree) {
623
+ this.profileDataGridTree.focus((this.dataGrid.selectedNode as ProfileDataGridNode));
624
+ }
625
+ this.refresh();
626
+ this.refreshVisibleData();
627
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.CpuProfileNodeFocused);
628
+ }
629
+
630
+ excludeClicked(): void {
631
+ const selectedNode = this.dataGrid.selectedNode;
632
+
633
+ if (!selectedNode) {
634
+ return;
635
+ }
636
+
637
+ this.#isResetEnabled = true;
638
+ this.performUpdate();
639
+ this.resetButton?.focus();
640
+
641
+ selectedNode.deselect();
642
+
643
+ if (this.profileDataGridTree) {
644
+ this.profileDataGridTree.exclude((selectedNode as ProfileDataGridNode));
645
+ }
646
+ this.refresh();
647
+ this.refreshVisibleData();
648
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.CpuProfileNodeExcluded);
649
+ }
650
+
651
+ resetClicked(): void {
652
+ this.viewSelectComboBox?.focus();
653
+ this.#isResetEnabled = false;
654
+ this.performUpdate();
655
+ if (this.profileDataGridTree) {
656
+ this.profileDataGridTree.restore();
657
+ }
658
+ this.linkifierInternal.reset();
659
+ this.refresh();
660
+ this.refreshVisibleData();
661
+ }
662
+
663
+ sortProfile(): void {
664
+ if (!this.profileDataGridTree) {
665
+ return;
666
+ }
667
+ const sortAscending = this.dataGrid.isSortOrderAscending();
668
+ const sortColumnId = this.dataGrid.sortColumnId();
669
+ const sortProperty = sortColumnId === 'function' ? 'functionName' : sortColumnId || '';
670
+ this.profileDataGridTree.sort(ProfileDataGridTree.propertyComparator(sortProperty, sortAscending), false);
671
+
672
+ this.refresh();
673
+ }
674
+
675
+ override performUpdate(): void {
676
+ const currentViewType = this.viewType ? this.viewType.get() : null;
677
+ if (currentViewType && currentViewType !== this.#lastAppliedViewType) {
678
+ this.searchableViewInternal.closeSearch();
679
+
680
+ if (this.visibleView) {
681
+ this.visibleView.detach();
682
+ }
683
+
684
+ switch (currentViewType) {
685
+ case ViewTypes.FLAME:
686
+ this.ensureFlameChartCreated();
687
+ this.visibleView = this.flameChart;
688
+ this.searchableElement = this.flameChart;
689
+ break;
690
+ case ViewTypes.TREE:
691
+ this.profileDataGridTree = this.getTopDownProfileDataGridTree();
692
+ this.sortProfile();
693
+ this.visibleView = this.dataGrid.asWidget();
694
+ this.searchableElement = this.profileDataGridTree;
695
+ break;
696
+ case ViewTypes.HEAVY:
697
+ this.profileDataGridTree = this.getBottomUpProfileDataGridTree();
698
+ this.sortProfile();
699
+ this.visibleView = this.dataGrid.asWidget();
700
+ this.searchableElement = this.profileDataGridTree;
701
+ break;
702
+ }
703
+
704
+ if (this.visibleView) {
705
+ this.visibleView.show(this.searchableViewInternal.element);
706
+ }
707
+
708
+ this.#lastAppliedViewType = currentViewType;
709
+ }
710
+
711
+ const isFlame = currentViewType === ViewTypes.FLAME;
712
+ const isTreeOrHeavy = !isFlame;
713
+
714
+ this.focusButton?.setVisible(isTreeOrHeavy);
715
+ this.excludeButton?.setVisible(isTreeOrHeavy);
716
+ this.resetButton?.classList.toggle('hidden', !isTreeOrHeavy);
717
+
718
+ this.focusButton?.setEnabled(this.#isNodeSelected);
719
+ this.excludeButton?.setEnabled(this.#isNodeSelected);
720
+
721
+ if (this.resetButton) {
722
+ this.resetButton.disabled = !this.#isResetEnabled;
723
+ }
724
+
725
+ if (this.#selectedSize !== null && this.selectedSizeText) {
726
+ this.selectedSizeText.textContent =
727
+ i18nString(UIStrings.selectedSizeS, {PH1: i18n.ByteUtilities.bytesToString(this.#selectedSize)});
728
+ }
729
+
730
+ if (this.#minId !== null && this.#maxId !== null) {
731
+ const rangeChanged = !this.#lastAppliedRange || this.#lastAppliedRange.minId !== this.#minId ||
732
+ this.#lastAppliedRange.maxId !== this.#maxId;
733
+
734
+ if (rangeChanged) {
735
+ this.setSelectionRange(this.#minId, this.#maxId);
736
+ this.#lastAppliedRange = {minId: this.#minId, maxId: this.#maxId};
737
+ }
738
+ }
739
+
740
+ if (this.sizes.length > 0) {
741
+ const samples = ({
742
+ sizes: this.sizes,
743
+ max: this.max,
744
+ ids: this.ordinals,
745
+ timestamps: this.timestamps,
746
+ totalTime: this.totalTime,
747
+ } as Samples);
748
+
749
+ this.timelineOverview.setSamples(samples);
750
+ }
238
751
  }
239
752
  }
240
753
 
@@ -637,9 +1150,8 @@ export class HeapFlameChartDataProvider extends ProfileFlameChartDataProvider {
637
1150
  readonly profile: CPUProfile.ProfileTreeModel.ProfileTreeModel;
638
1151
  readonly heapProfilerModel: SDK.HeapProfilerModel.HeapProfilerModel|null;
639
1152
 
640
- constructor(
641
- profile: CPUProfile.ProfileTreeModel.ProfileTreeModel,
642
- heapProfilerModel: SDK.HeapProfilerModel.HeapProfilerModel|null) {
1153
+ constructor(profile: CPUProfile.ProfileTreeModel.ProfileTreeModel,
1154
+ heapProfilerModel: SDK.HeapProfilerModel.HeapProfilerModel|null) {
643
1155
  super();
644
1156
  this.profile = profile;
645
1157
  this.heapProfilerModel = heapProfilerModel;
@@ -714,12 +1226,12 @@ export class HeapFlameChartDataProvider extends ProfileFlameChartDataProvider {
714
1226
  pushRow(i18nString(UIStrings.selfSize), i18n.ByteUtilities.bytesToString(node.self));
715
1227
  pushRow(i18nString(UIStrings.totalSize), i18n.ByteUtilities.bytesToString(node.total));
716
1228
  const linkifier = new Components.Linkifier.Linkifier();
717
- const link = linkifier.maybeLinkifyConsoleCallFrame(
718
- this.heapProfilerModel ? this.heapProfilerModel.target() : null, node.callFrame);
1229
+ const link = linkifier.maybeLinkifyConsoleCallFrame(this.heapProfilerModel ? this.heapProfilerModel.target() : null,
1230
+ node.callFrame);
719
1231
  if (link) {
720
1232
  pushRow(i18nString(UIStrings.url), link.textContent);
721
1233
  }
722
1234
  linkifier.dispose();
723
- return ProfileView.buildPopoverTable(popoverInfo);
1235
+ return HeapProfileView.buildPopoverTable(popoverInfo);
724
1236
  }
725
1237
  }