chrome-devtools-frontend 1.0.1526630 → 1.0.1529186

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 (339) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/i18nImpl.ts +6 -1
  5. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  6. package/front_end/core/root/Runtime.ts +38 -4
  7. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  8. package/front_end/core/sdk/CSSRule.ts +35 -6
  9. package/front_end/core/sdk/Connections.ts +2 -1
  10. package/front_end/core/sdk/DOMModel.ts +4 -0
  11. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  12. package/front_end/core/sdk/NetworkManager.ts +267 -34
  13. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  14. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  15. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  16. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  17. package/front_end/core/sdk/SourceMap.ts +41 -11
  18. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  19. package/front_end/core/sdk/SourceMapScopesInfo.ts +49 -2
  20. package/front_end/core/sdk/TargetManager.ts +0 -22
  21. package/front_end/core/sdk/TraceObject.ts +8 -7
  22. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  23. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  24. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  25. package/front_end/entrypoints/main/MainImpl.ts +42 -28
  26. package/front_end/generated/InspectorBackendCommands.js +3 -2
  27. package/front_end/generated/SupportedCSSProperties.js +2 -0
  28. package/front_end/generated/protocol.ts +17 -3
  29. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  30. package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
  31. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  34. package/front_end/models/extensions/ExtensionView.ts +3 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +31 -27
  36. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  37. package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
  38. package/front_end/models/persistence/PersistenceImpl.ts +0 -5
  39. package/front_end/models/persistence/persistence-meta.ts +0 -31
  40. package/front_end/models/persistence/persistence.ts +0 -6
  41. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  42. package/front_end/models/stack_trace/Trie.ts +9 -0
  43. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  44. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  45. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  46. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  47. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  48. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  50. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  51. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  52. package/front_end/panels/application/CookieItemsView.ts +1 -0
  53. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  54. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  56. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  57. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  58. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  59. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  60. package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
  61. package/front_end/panels/common/common.ts +1 -0
  62. package/front_end/panels/console/ConsoleInsightTeaser.ts +369 -0
  63. package/front_end/panels/console/ConsolePanel.ts +2 -0
  64. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  65. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +12 -0
  67. package/front_end/panels/console/ConsoleViewMessage.ts +44 -0
  68. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  69. package/front_end/panels/console/console-meta.ts +14 -0
  70. package/front_end/panels/console/console.ts +6 -0
  71. package/front_end/panels/console/consoleInsightTeaser.css +83 -0
  72. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  73. package/front_end/panels/coverage/CoverageView.ts +292 -284
  74. package/front_end/panels/coverage/coverageView.css +17 -0
  75. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  76. package/front_end/panels/elements/LayoutPane.ts +1 -0
  77. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  79. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  80. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  81. package/front_end/panels/explain/ActionDelegate.ts +4 -2
  82. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  83. package/front_end/panels/explain/explain-meta.ts +7 -0
  84. package/front_end/panels/explain/explain.ts +0 -1
  85. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  86. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  87. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  88. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  89. package/front_end/panels/media/MainView.ts +1 -0
  90. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  91. package/front_end/panels/network/BlockedURLsPane.ts +237 -108
  92. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  93. package/front_end/panels/network/NetworkItemView.ts +1 -0
  94. package/front_end/panels/network/NetworkLogView.ts +9 -7
  95. package/front_end/panels/network/NetworkOverview.ts +1 -0
  96. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  97. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  98. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  99. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  100. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  101. package/front_end/panels/network/RequestResponseView.ts +1 -0
  102. package/front_end/panels/network/RequestTimingView.ts +2 -0
  103. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  104. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  105. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  106. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  107. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  108. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  109. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  110. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  111. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  112. package/front_end/panels/profiler/ProfileView.ts +1 -0
  113. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  114. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  115. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  116. package/front_end/panels/search/SearchView.ts +1 -0
  117. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  118. package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +3 -6
  119. package/front_end/panels/settings/WorkspaceSettingsTab.ts +4 -1
  120. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  121. package/front_end/panels/settings/settings.ts +2 -0
  122. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  123. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  124. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  125. package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
  126. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
  127. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  128. package/front_end/panels/sources/sources-meta.ts +15 -0
  129. package/front_end/panels/sources/sources.ts +2 -0
  130. package/front_end/panels/timeline/README.md +2 -2
  131. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  132. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  133. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  134. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  135. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  136. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  137. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  138. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  139. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  141. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  142. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  143. package/front_end/panels/utils/utils.ts +2 -1
  144. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/diff/diff_match_patch.js +1 -1
  147. package/front_end/third_party/lighthouse/README.chromium +2 -2
  148. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  149. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  150. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  151. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  156. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  158. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  159. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  160. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  161. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  163. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  164. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  167. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  169. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  172. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  174. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  176. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  178. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  179. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  180. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  181. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  182. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  183. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  184. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  185. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  186. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  187. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  188. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  189. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  190. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  191. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  192. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  193. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  194. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  195. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  196. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  197. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  198. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  199. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  200. package/front_end/third_party/web-vitals/README.chromium +5 -8
  201. package/front_end/third_party/web-vitals/package/README.md +191 -152
  202. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  203. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  204. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  205. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  206. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  207. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  208. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  209. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  210. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  211. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  212. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  215. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  219. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  220. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  221. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  222. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  223. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  224. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  225. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  226. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  227. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  228. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  229. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  230. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  231. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  232. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  233. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  234. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  235. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  236. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  237. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  238. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  239. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  240. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  241. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  242. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  243. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  244. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  245. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  246. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  247. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  248. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  249. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  250. package/front_end/third_party/web-vitals/package/package.json +4 -10
  251. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  252. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  253. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  254. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  255. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  256. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  257. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  258. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  259. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  260. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  261. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  262. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  263. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  264. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  265. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  266. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  267. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  268. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  269. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  270. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  271. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  272. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  273. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  274. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  275. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  276. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  277. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  278. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  279. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  280. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  281. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  282. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  283. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  284. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  285. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  286. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  287. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  288. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  289. package/front_end/ui/legacy/InspectorView.ts +2 -0
  290. package/front_end/ui/legacy/ListWidget.ts +2 -2
  291. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  292. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  293. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  294. package/front_end/ui/legacy/UIUtils.ts +8 -19
  295. package/front_end/ui/legacy/ViewManager.ts +1 -0
  296. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  297. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  298. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  299. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  300. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  301. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  302. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  303. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  304. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  305. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  306. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  307. package/front_end/ui/visual_logging/KnownContextValues.ts +25 -0
  308. package/mcp/README.md +7 -0
  309. package/mcp/mcp.ts +8 -0
  310. package/package.json +1 -1
  311. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  312. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  313. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  314. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  315. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  316. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  317. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  318. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  319. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  320. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  323. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  324. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  326. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  327. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  330. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  331. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  332. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  333. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  334. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  335. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  336. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  337. package/front_end/ui/legacy/inlineButton.css +0 -22
  338. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
  339. /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
@@ -9,6 +9,8 @@ import * as Platform from '../platform/platform.js';
9
9
  import * as Root from '../root/root.js';
10
10
 
11
11
  import type {CallFrame, ScopeChainEntry} from './DebuggerModel.js';
12
+ import {scopeTreeForScript} from './ScopeTreeCache.js';
13
+ import type {Script} from './Script.js';
12
14
  import {buildOriginalScopes, decodePastaRanges, type NamedFunctionRange} from './SourceMapFunctionRanges.js';
13
15
  import {SourceMapScopesInfo} from './SourceMapScopesInfo.js';
14
16
 
@@ -131,18 +133,22 @@ export class SourceMap {
131
133
  readonly #sourceInfos: SourceInfo[] = [];
132
134
  readonly #sourceInfoByURL = new Map<Platform.DevToolsPath.UrlString, SourceInfo>();
133
135
 
136
+ readonly #script?: Script;
134
137
  #scopesInfo: SourceMapScopesInfo|null = null;
135
138
 
136
139
  readonly #debugId?: DebugId;
137
140
 
141
+ scopesFallbackPromiseForTest?: Promise<unknown>;
142
+
138
143
  /**
139
144
  * Implements Source Map V3 model. See https://github.com/google/closure-compiler/wiki/Source-Maps
140
145
  * for format description.
141
146
  */
142
147
  constructor(
143
148
  compiledURL: Platform.DevToolsPath.UrlString, sourceMappingURL: Platform.DevToolsPath.UrlString,
144
- payload: SourceMapV3) {
149
+ payload: SourceMapV3, script?: Script) {
145
150
  this.#json = payload;
151
+ this.#script = script;
146
152
  this.#compiledURL = compiledURL;
147
153
  this.#sourceMappingURL = sourceMappingURL;
148
154
  this.#baseURL = (Common.ParsedURL.schemeIs(sourceMappingURL, 'data:')) ? compiledURL : sourceMappingURL;
@@ -163,7 +169,7 @@ export class SourceMap {
163
169
  }
164
170
 
165
171
  augmentWithScopes(scriptUrl: Platform.DevToolsPath.UrlString, ranges: NamedFunctionRange[]): void {
166
- this.#ensureMappingsProcessed();
172
+ this.#ensureSourceMapProcessed();
167
173
  if (this.#json && this.#json.version > 3) {
168
174
  throw new Error('Only support augmenting source maps up to version 3.');
169
175
  }
@@ -199,6 +205,10 @@ export class SourceMap {
199
205
  return this.#debugId ?? null;
200
206
  }
201
207
 
208
+ sourceURLForSourceIndex(index: number): Platform.DevToolsPath.UrlString|undefined {
209
+ return this.#sourceInfos[index]?.sourceURL;
210
+ }
211
+
202
212
  sourceURLs(): Platform.DevToolsPath.UrlString[] {
203
213
  return [...this.#sourceInfoByURL.keys()];
204
214
  }
@@ -212,12 +222,12 @@ export class SourceMap {
212
222
  }
213
223
 
214
224
  hasScopeInfo(): boolean {
215
- this.#ensureMappingsProcessed();
216
- return this.#scopesInfo !== null;
225
+ this.#ensureSourceMapProcessed();
226
+ return this.#scopesInfo !== null && !this.#scopesInfo.isEmpty();
217
227
  }
218
228
 
219
229
  findEntry(lineNumber: number, columnNumber: number, inlineFrameIndex?: number): SourceMapEntry|null {
220
- this.#ensureMappingsProcessed();
230
+ this.#ensureSourceMapProcessed();
221
231
  if (inlineFrameIndex && this.#scopesInfo !== null) {
222
232
  // For inlineFrameIndex != 0 we use the callsite info for the corresponding inlining site.
223
233
  // Note that the callsite for "inlineFrameIndex" is actually in the previous frame.
@@ -372,20 +382,40 @@ export class SourceMap {
372
382
  }
373
383
 
374
384
  mappings(): SourceMapEntry[] {
375
- this.#ensureMappingsProcessed();
385
+ this.#ensureSourceMapProcessed();
376
386
  return this.#mappings ?? [];
377
387
  }
378
388
 
389
+ /**
390
+ * If the source map does not contain scope information by itself (e.g. "scopes proposal"
391
+ * or "pasta" scopes), then we'll use this getter to calculate basic function name information from
392
+ * the AST and mappings.
393
+ */
394
+ async #buildScopesFallback(): Promise<SourceMapScopesInfo|null> {
395
+ const scopeTreeAndText = this.#script ? await scopeTreeForScript(this.#script) : null;
396
+ if (!scopeTreeAndText) {
397
+ return null;
398
+ }
399
+
400
+ const {scopeTree, text} = scopeTreeAndText;
401
+ return SourceMapScopesInfo.createFromAst(this, scopeTree, text);
402
+ }
403
+
379
404
  private reversedMappings(sourceURL: Platform.DevToolsPath.UrlString): number[] {
380
- this.#ensureMappingsProcessed();
405
+ this.#ensureSourceMapProcessed();
381
406
  return this.#sourceInfoByURL.get(sourceURL)?.reverseMappings ?? [];
382
407
  }
383
408
 
384
- #ensureMappingsProcessed(): void {
409
+ #ensureSourceMapProcessed(): void {
385
410
  if (this.#mappings === null) {
386
411
  this.#mappings = [];
387
412
  try {
388
413
  this.eachSection(this.parseMap.bind(this));
414
+ if (!this.hasScopeInfo()) {
415
+ this.scopesFallbackPromiseForTest = this.#buildScopesFallback().then(info => {
416
+ this.#scopesInfo = info;
417
+ });
418
+ }
389
419
  } catch (e) {
390
420
  console.error('Failed to parse source map', e);
391
421
  this.#mappings = [];
@@ -728,7 +758,7 @@ export class SourceMap {
728
758
  }
729
759
 
730
760
  expandCallFrame(frame: CallFrame): CallFrame[] {
731
- this.#ensureMappingsProcessed();
761
+ this.#ensureSourceMapProcessed();
732
762
  if (this.#scopesInfo === null) {
733
763
  return [frame];
734
764
  }
@@ -737,7 +767,7 @@ export class SourceMap {
737
767
  }
738
768
 
739
769
  resolveScopeChain(frame: CallFrame): ScopeChainEntry[]|null {
740
- this.#ensureMappingsProcessed();
770
+ this.#ensureSourceMapProcessed();
741
771
  if (this.#scopesInfo === null) {
742
772
  return null;
743
773
  }
@@ -746,7 +776,7 @@ export class SourceMap {
746
776
  }
747
777
 
748
778
  findOriginalFunctionName(position: ScopesCodec.Position): string|null {
749
- this.#ensureMappingsProcessed();
779
+ this.#ensureSourceMapProcessed();
750
780
  return this.#scopesInfo?.findOriginalFunctionName(position) ?? null;
751
781
  }
752
782
  }
@@ -11,17 +11,24 @@ import {type DebugId, parseSourceMap, SourceMap, type SourceMapV3} from './Sourc
11
11
  import {SourceMapCache} from './SourceMapCache.js';
12
12
  import {type Target, Type} from './Target.js';
13
13
 
14
+ export type SourceMapFactory<T> =
15
+ (compiledURL: Platform.DevToolsPath.UrlString, sourceMappingURL: Platform.DevToolsPath.UrlString,
16
+ payload: SourceMapV3, client: T) => SourceMap;
17
+
14
18
  export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWrapper.ObjectWrapper<EventTypes<T>> {
15
19
  readonly #target: Target;
20
+ readonly #factory: SourceMapFactory<T>;
16
21
  #isEnabled = true;
17
22
  readonly #clientData = new Map<T, ClientData>();
18
23
  readonly #sourceMaps = new Map<SourceMap, T>();
19
24
  #attachingClient: T|null = null;
20
25
 
21
- constructor(target: Target) {
26
+ constructor(target: Target, factory?: SourceMapFactory<T>) {
22
27
  super();
23
28
 
24
29
  this.#target = target;
30
+ this.#factory =
31
+ factory ?? ((compiledURL, sourceMappingURL, payload) => new SourceMap(compiledURL, sourceMappingURL, payload));
25
32
  }
26
33
 
27
34
  setEnabled(isEnabled: boolean): void {
@@ -109,7 +116,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
109
116
  loadSourceMap(sourceMapURL, client.debugId(), initiator)
110
117
  .then(
111
118
  payload => {
112
- const sourceMap = new SourceMap(sourceURL, sourceMapURL, payload);
119
+ const sourceMap = this.#factory(sourceURL, sourceMapURL, payload, client);
113
120
  if (this.#clientData.get(client) === clientData) {
114
121
  clientData.sourceMap = sourceMap;
115
122
  this.#sourceMaps.set(sourceMap, client);
@@ -167,6 +174,10 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
167
174
  this.dispatchEventToListeners(Events.SourceMapFailedToAttach, {client});
168
175
  }
169
176
  }
177
+
178
+ waitForSourceMapsProcessedForTest(): Promise<unknown> {
179
+ return Promise.all(this.#sourceMaps.keys().map(sourceMap => sourceMap.scopesFallbackPromiseForTest));
180
+ }
170
181
  }
171
182
 
172
183
  export async function loadSourceMap(
@@ -6,6 +6,7 @@ import * as Protocol from '../../generated/protocol.js';
6
6
  import * as Formatter from '../../models/formatter/formatter.js';
7
7
  import type * as TextUtils from '../../models/text_utils/text_utils.js';
8
8
  import type * as ScopesCodec from '../../third_party/source-map-scopes-codec/source-map-scopes-codec.js';
9
+ import type * as Platform from '../platform/platform.js';
9
10
 
10
11
  import type {CallFrame, ScopeChainEntry} from './DebuggerModel.js';
11
12
  import type {SourceMap} from './SourceMap.js';
@@ -95,6 +96,10 @@ export class SourceMapScopesInfo {
95
96
  return Boolean(this.#originalScopes[sourceIdx]);
96
97
  }
97
98
 
99
+ isEmpty(): boolean {
100
+ return !this.#originalScopes.length && !this.#generatedRanges.length;
101
+ }
102
+
98
103
  addOriginalScopesAtIndex(sourceIdx: number, scope: ScopesCodec.OriginalScope): void {
99
104
  if (!this.#originalScopes[sourceIdx]) {
100
105
  this.#originalScopes[sourceIdx] = scope;
@@ -103,6 +108,37 @@ export class SourceMapScopesInfo {
103
108
  }
104
109
  }
105
110
 
111
+ /**
112
+ * @returns true, iff the function surrounding the provided position is marked as "hidden".
113
+ */
114
+ isOutlinedFrame(generatedLine: number, generatedColumn: number): boolean {
115
+ const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
116
+ for (let i = rangeChain.length - 1; i >= 0; --i) {
117
+ if (rangeChain[i].isStackFrame) {
118
+ return rangeChain[i].isHidden;
119
+ }
120
+ }
121
+ return false;
122
+ }
123
+
124
+ /**
125
+ * @returns true, iff the range surrounding the provided position contains multiple
126
+ * inlined original functions.
127
+ */
128
+ hasInlinedFrames(generatedLine: number, generatedColumn: number): boolean {
129
+ const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
130
+ for (let i = rangeChain.length - 1; i >= 0; --i) {
131
+ if (rangeChain[i].isStackFrame) {
132
+ // We stop looking for inlined original functions once we reach the current frame.
133
+ return false;
134
+ }
135
+ if (rangeChain[i].callSite) {
136
+ return true;
137
+ }
138
+ }
139
+ return false;
140
+ }
141
+
106
142
  /**
107
143
  * Given a generated position, returns the original name of the surrounding function as well as
108
144
  * all the original function names that got inlined into the surrounding generated function and their
@@ -125,7 +161,10 @@ export class SourceMapScopesInfo {
125
161
 
126
162
  if (range.callSite) {
127
163
  // Record the name and call-site if the range corresponds to an inlined function.
128
- result.inlinedFunctions.push({name: range.originalScope?.name ?? '', callsite: range.callSite});
164
+ result.inlinedFunctions.push({
165
+ name: range.originalScope?.name ?? '',
166
+ callsite: {...range.callSite, sourceURL: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex)}
167
+ });
129
168
  }
130
169
  if (range.isStackFrame) {
131
170
  // We arrived at an actual generated JS function, don't go further.
@@ -377,7 +416,15 @@ export class SourceMapScopesInfo {
377
416
  * The inlined functions are sorted from inner to outer (or top to bottom on the stack).
378
417
  */
379
418
  export interface InlineInfo {
380
- inlinedFunctions: Array<{name: string, callsite: ScopesCodec.OriginalPosition}>;
419
+ inlinedFunctions: Array<{
420
+ name: string,
421
+ callsite: {
422
+ line: number,
423
+ column: number,
424
+ sourceIndex: number,
425
+ sourceURL?: Platform.DevToolsPath.UrlString,
426
+ },
427
+ }>;
381
428
  originalFunctionName: string;
382
429
  }
383
430
 
@@ -10,8 +10,6 @@ import {assertNotNullOrUndefined} from '../platform/platform.js';
10
10
  import type * as ProtocolClient from '../protocol_client/protocol_client.js';
11
11
  import * as Root from '../root/root.js';
12
12
 
13
- import {StubConnection} from './Connections.js';
14
- import {RehydratingConnection} from './RehydratingConnection.js';
15
13
  import {SDKModel} from './SDKModel.js';
16
14
  import {Target, Type as TargetType} from './Target.js';
17
15
 
@@ -312,26 +310,6 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
312
310
  return this.#browserTarget;
313
311
  }
314
312
 
315
- /**
316
- * If this returns true, the target is not connected to a legit CDP server.
317
- * However, it's not exhaustive, so some `false` responses may be misleading.
318
- * (eg., tab URL of `devtools://devtools/bundled/devtools_app.html` uses a MainConnection but has no CDP server behind it).
319
- */
320
- hasFakeConnection(): boolean {
321
- // Rehydrated DevTools always has a fake connection, so we shortcut and avoid the race.
322
- if (Root.Runtime.getPathName().includes('rehydrated_devtools_app')) {
323
- return true;
324
- }
325
- // There _may_ be a race condition hiding here on the router/connection creation.
326
- // So we play it safe and consider "no connection yet" as "not fake".
327
- const connection = this.primaryPageTarget()?.router()?.connection();
328
- if (!connection) {
329
- return false;
330
- }
331
- const isFakeConnection = (connection instanceof StubConnection) || (connection instanceof RehydratingConnection);
332
- return isFakeConnection;
333
- }
334
-
335
313
  async maybeAttachInitialTarget(): Promise<boolean> {
336
314
  if (!Boolean(Root.Runtime.Runtime.queryParam('browserConnection'))) {
337
315
  return false;
@@ -14,13 +14,14 @@ import type {SourceMapV3} from './SourceMap.js';
14
14
  export class TraceObject {
15
15
  readonly traceEvents: Protocol.Tracing.DataCollectedEvent['value'];
16
16
  readonly metadata: {sourceMaps?: Array<{sourceMapUrl: string, sourceMap: SourceMapV3, url: string}>};
17
- constructor(payload: Protocol.Tracing.DataCollectedEvent['value']|TraceObject, meta: Object = {}) {
18
- // Handle the typical traceEvent array juggling here.
19
- const events = Array.isArray(payload) ? payload : payload.traceEvents;
20
- const metadata = meta ?? (!Array.isArray(payload) && payload.metadata) ?? {};
21
-
22
- this.traceEvents = events;
23
- this.metadata = metadata;
17
+ constructor(payload: Protocol.Tracing.DataCollectedEvent['value']|TraceObject, meta?: Object) {
18
+ if (Array.isArray(payload)) {
19
+ this.traceEvents = payload;
20
+ this.metadata = meta ?? {};
21
+ } else {
22
+ this.traceEvents = payload.traceEvents;
23
+ this.metadata = payload.metadata;
24
+ }
24
25
  }
25
26
  }
26
27
 
@@ -1403,6 +1403,71 @@ export abstract class HeapSnapshot {
1403
1403
  }
1404
1404
  return getBit;
1405
1405
  }
1406
+ case 'objectsRetainedByEventHandlers': {
1407
+ // This filter is based on the assumption that event handler functions are contained
1408
+ // (directly or indirectly) by V8EventListener nodes. In particular, the callback_object_
1409
+ // field of V8EventListener points to either the function used as the event handler,
1410
+ // or to a framework-specific wrapper object that in turn contains the actual handler.
1411
+ //
1412
+ // The filter works in two steps:
1413
+ // 1. Identify all event handler functions and mark them in a bitmap.
1414
+ // 2. Traverse the graph, avoiding paths that pass through any of the event handlers
1415
+ const node = this.createNode(0);
1416
+ const nodeFieldCount = this.nodeFieldCount;
1417
+
1418
+ // First, identify which nodes are event handlers
1419
+ const eventHandlerBitmap = Platform.TypedArrayUtilities.createBitVector(this.nodeCount);
1420
+
1421
+ // Iterate all nodes looking for V8EventListener objects
1422
+ for (let i = 0; i < this.nodeCount; ++i) {
1423
+ node.nodeIndex = i * nodeFieldCount;
1424
+
1425
+ // Check if this node is a V8EventListener
1426
+ if (node.rawName() === 'V8EventListener') {
1427
+ // Get the callback_object_ (edge "1")
1428
+ const callbackNode = this.getEdgeTarget(node, '1');
1429
+ if (!callbackNode) {
1430
+ continue;
1431
+ }
1432
+
1433
+ const callbackOrdinal = callbackNode.nodeIndex / nodeFieldCount;
1434
+
1435
+ // Check if callback has a "code" edge (direct function handler)
1436
+ if (this.getEdgeTarget(callbackNode, 'code')) {
1437
+ eventHandlerBitmap.setBit(callbackOrdinal);
1438
+ continue;
1439
+ }
1440
+
1441
+ // Check if any child has a "code" edge (framework wrapper)
1442
+ let foundChildWithCode = false;
1443
+ for (let childEdgeIt = callbackNode.edges(); childEdgeIt.hasNext(); childEdgeIt.next()) {
1444
+ const childNode = childEdgeIt.item().node();
1445
+ if (this.getEdgeTarget(childNode, 'code')) {
1446
+ eventHandlerBitmap.setBit(childNode.nodeIndex / nodeFieldCount);
1447
+ foundChildWithCode = true;
1448
+ break;
1449
+ }
1450
+ }
1451
+
1452
+ // Fallback to marking the callback node itself
1453
+ if (!foundChildWithCode) {
1454
+ eventHandlerBitmap.setBit(callbackOrdinal);
1455
+ }
1456
+ }
1457
+ }
1458
+
1459
+ // Traverse the graph, avoiding paths that pass through event handlers
1460
+ traverse((currentNode: HeapSnapshotNode, edge: HeapSnapshotEdge) => {
1461
+ const targetNode = edge.node();
1462
+ const targetOrdinal = targetNode.nodeIndex / nodeFieldCount;
1463
+ // Return false (don't traverse) if the target node is an event handler
1464
+ return !eventHandlerBitmap.getBit(targetOrdinal);
1465
+ });
1466
+
1467
+ markUnreachableNodes();
1468
+
1469
+ return (node: HeapSnapshotNode) => !getBit(node);
1470
+ }
1406
1471
  }
1407
1472
  throw new Error('Invalid filter name');
1408
1473
  }
@@ -2394,6 +2459,22 @@ export abstract class HeapSnapshot {
2394
2459
  return this.strings.length - 1;
2395
2460
  }
2396
2461
 
2462
+ /**
2463
+ * Gets the target node of an edge with the specified name.
2464
+ * @param node The source node to search from
2465
+ * @param edgeName The name of the edge to find
2466
+ * @returns The target node if found, null otherwise
2467
+ */
2468
+ private getEdgeTarget(node: HeapSnapshotNode, edgeName: string): HeapSnapshotNode|null {
2469
+ for (let edgeIt = node.edges(); edgeIt.hasNext(); edgeIt.next()) {
2470
+ const edge = edgeIt.item();
2471
+ if (edge.name() === edgeName) {
2472
+ return edge.node();
2473
+ }
2474
+ }
2475
+ return null;
2476
+ }
2477
+
2397
2478
  /**
2398
2479
  * The phase propagates whether a node is attached or detached through the
2399
2480
  * graph and adjusts the low-level representation of nodes.
@@ -65,7 +65,9 @@ export class InspectorMainImpl implements Common.Runnable.Runnable {
65
65
  await SDK.Connections.initMainConnection(async () => {
66
66
  const type = Root.Runtime.Runtime.queryParam('v8only') ?
67
67
  SDK.Target.Type.NODE :
68
- (Root.Runtime.Runtime.queryParam('targetType') === 'tab' ? SDK.Target.Type.TAB : SDK.Target.Type.FRAME);
68
+ (Root.Runtime.Runtime.queryParam('targetType') === 'tab' || Root.Runtime.Runtime.isTraceApp() ?
69
+ SDK.Target.Type.TAB :
70
+ SDK.Target.Type.FRAME);
69
71
  // TODO(crbug.com/1348385): support waiting for debugger with tab target.
70
72
  const waitForDebuggerInPage =
71
73
  type === SDK.Target.Type.FRAME && Root.Runtime.Runtime.queryParam('panel') === 'sources';
@@ -82,6 +82,7 @@ export class GlobalAiButton extends UI.Widget.Widget {
82
82
  }
83
83
 
84
84
  override willHide(): void {
85
+ super.willHide();
85
86
  this.#removeHoverEventListeners();
86
87
 
87
88
  if (this.#returnToDefaultStateTimeout) {
@@ -54,7 +54,7 @@ import * as Logs from '../../models/logs/logs.js';
54
54
  import * as Persistence from '../../models/persistence/persistence.js';
55
55
  import * as ProjectSettings from '../../models/project_settings/project_settings.js';
56
56
  import * as Workspace from '../../models/workspace/workspace.js';
57
- import type * as PanelCommon from '../../panels/common/common.js';
57
+ import * as PanelCommon from '../../panels/common/common.js';
58
58
  import * as Snippets from '../../panels/snippets/snippets.js';
59
59
  import * as Buttons from '../../ui/components/buttons/buttons.js';
60
60
  import * as Snackbar from '../../ui/components/snackbars/snackbars.js';
@@ -120,6 +120,10 @@ const UIStrings = {
120
120
  * @description Text describing how to navigate the dock side menu
121
121
  */
122
122
  dockSideNavigation: 'Use left and right arrow keys to navigate the options',
123
+ /**
124
+ * @description Notification shown to the user whenever DevTools receives an external request.
125
+ */
126
+ externalRequestReceived: '`DevTools` received an external request',
123
127
  } as const;
124
128
  const str_ = i18n.i18n.registerUIStrings('entrypoints/main/MainImpl.ts', UIStrings);
125
129
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -476,11 +480,13 @@ export class MainImpl {
476
480
  isolatedFileSystemManager.addPlatformFileSystem(
477
481
  'snippet://' as Platform.DevToolsPath.UrlString, new Snippets.ScriptSnippetFileSystem.SnippetFileSystem());
478
482
 
479
- Persistence.Persistence.PersistenceImpl.instance({
483
+ const persistenceImpl = Persistence.Persistence.PersistenceImpl.instance({
480
484
  forceNew: true,
481
485
  workspace: Workspace.Workspace.WorkspaceImpl.instance(),
482
486
  breakpointManager: Breakpoints.BreakpointManager.BreakpointManager.instance(),
483
487
  });
488
+ const linkDecorator = new PanelCommon.PersistenceUtils.LinkDecorator(persistenceImpl);
489
+ Components.Linkifier.Linkifier.setLinkDecorator(linkDecorator);
484
490
  Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance(
485
491
  {forceNew: true, workspace: Workspace.Workspace.WorkspaceImpl.instance()});
486
492
 
@@ -510,6 +516,8 @@ export class MainImpl {
510
516
  LiveMetrics.LiveMetrics.instance();
511
517
  CrUXManager.CrUXManager.instance();
512
518
 
519
+ void AiAssistanceModel.BuiltInAi.BuiltInAi.instance();
520
+
513
521
  new PauseListener();
514
522
 
515
523
  const actionRegistryInstance = UI.ActionRegistry.ActionRegistry.instance({forceNew: true});
@@ -539,6 +547,14 @@ export class MainImpl {
539
547
  });
540
548
  }
541
549
 
550
+ const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
551
+ conversationHandler.addEventListener(
552
+ AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED,
553
+ () => Snackbar.Snackbar.Snackbar.show({message: i18nString(UIStrings.externalRequestReceived)}));
554
+ conversationHandler.addEventListener(
555
+ AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED,
556
+ event => void VisualLogging.logFunctionCall(`start-conversation-${event.data}`, 'external'));
557
+
542
558
  MainImpl.timeEnd('Main._createAppUI');
543
559
 
544
560
  const appProvider = Common.AppProvider.getRegisteredAppProviders()[0];
@@ -568,17 +584,14 @@ export class MainImpl {
568
584
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
569
585
  Host.InspectorFrontendHostAPI.Events.RevealSourceLine, this.#revealSourceLine, this);
570
586
 
571
- await UI.InspectorView.InspectorView.instance().createToolbars();
587
+ const inspectorView = UI.InspectorView.InspectorView.instance();
588
+ Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance().addEventListener(
589
+ Persistence.NetworkPersistenceManager.Events.LOCAL_OVERRIDES_REQUESTED, event => {
590
+ inspectorView.displaySelectOverrideFolderInfobar(event.data);
591
+ });
592
+ await inspectorView.createToolbars();
572
593
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.loadCompleted();
573
594
 
574
- const value = Root.Runtime.Runtime.queryParam('loadTimelineFromURL');
575
- if (value !== null) {
576
- // Only import Timeline if needed. If this was a static import, every load of devtools
577
- // would request and evaluate the Timeline panel dep tree, slowing down the UI's load.
578
- const Timeline = await import('../../panels/timeline/timeline.js');
579
- Timeline.TimelinePanel.LoadTimelineHandler.instance().handleQueryParam(value);
580
- }
581
-
582
595
  // Initialize elements for the live announcer functionality for a11y.
583
596
  UI.ARIAUtils.LiveAnnouncer.initializeAnnouncerElements();
584
597
  UI.DockController.DockController.instance().announceDockLocation();
@@ -1072,15 +1085,16 @@ type ExternalRequestInput = {
1072
1085
  export async function handleExternalRequest(input: ExternalRequestInput):
1073
1086
  Promise<{response: string, devToolsLogs: object[]}> {
1074
1087
  const generator = await handleExternalRequestGenerator(input);
1075
- let result: IteratorResult<AiAssistanceModel.ExternalRequestResponse, AiAssistanceModel.ExternalRequestResponse>;
1088
+ let result: IteratorResult<
1089
+ AiAssistanceModel.AiAgent.ExternalRequestResponse, AiAssistanceModel.AiAgent.ExternalRequestResponse>;
1076
1090
  do {
1077
1091
  result = await generator.next();
1078
1092
  } while (!result.done);
1079
1093
  const response = result.value;
1080
- if (response.type === AiAssistanceModel.ExternalRequestResponseType.ERROR) {
1094
+ if (response.type === AiAssistanceModel.AiAgent.ExternalRequestResponseType.ERROR) {
1081
1095
  throw new Error(response.message);
1082
1096
  }
1083
- if (response.type === AiAssistanceModel.ExternalRequestResponseType.ANSWER) {
1097
+ if (response.type === AiAssistanceModel.AiAgent.ExternalRequestResponseType.ANSWER) {
1084
1098
  return {
1085
1099
  response: response.message,
1086
1100
  devToolsLogs: response.devToolsLogs,
@@ -1092,8 +1106,8 @@ export async function handleExternalRequest(input: ExternalRequestInput):
1092
1106
  // @ts-expect-error
1093
1107
  globalThis.handleExternalRequest = handleExternalRequest;
1094
1108
 
1095
- export async function handleExternalRequestGenerator(input: ExternalRequestInput):
1096
- Promise<AsyncGenerator<AiAssistanceModel.ExternalRequestResponse, AiAssistanceModel.ExternalRequestResponse>> {
1109
+ export async function handleExternalRequestGenerator(input: ExternalRequestInput): Promise<AsyncGenerator<
1110
+ AiAssistanceModel.AiAgent.ExternalRequestResponse, AiAssistanceModel.AiAgent.ExternalRequestResponse>> {
1097
1111
  switch (input.kind) {
1098
1112
  case 'PERFORMANCE_RELOAD_GATHER_INSIGHTS': {
1099
1113
  const TimelinePanel = await import('../../panels/timeline/timeline.js');
@@ -1105,32 +1119,32 @@ export async function handleExternalRequestGenerator(input: ExternalRequestInput
1105
1119
  }
1106
1120
  case 'NETWORK_DEBUGGER': {
1107
1121
  const AiAssistanceModel = await import('../../models/ai_assistance/ai_assistance.js');
1108
- const conversationHandler = await AiAssistanceModel.ConversationHandler.instance();
1122
+ const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
1109
1123
  return await conversationHandler.handleExternalRequest({
1110
- conversationType: AiAssistanceModel.ConversationType.NETWORK,
1124
+ conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType.NETWORK,
1111
1125
  prompt: input.args.prompt,
1112
1126
  requestUrl: input.args.requestUrl,
1113
1127
  });
1114
1128
  }
1115
1129
  case 'LIVE_STYLE_DEBUGGER': {
1116
1130
  const AiAssistanceModel = await import('../../models/ai_assistance/ai_assistance.js');
1117
- const conversationHandler = AiAssistanceModel.ConversationHandler.instance();
1131
+ const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
1118
1132
  return await conversationHandler.handleExternalRequest({
1119
- conversationType: AiAssistanceModel.ConversationType.STYLING,
1133
+ conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING,
1120
1134
  prompt: input.args.prompt,
1121
1135
  selector: input.args.selector,
1122
1136
  });
1123
1137
  }
1124
1138
  }
1125
1139
  // eslint-disable-next-line require-yield
1126
- return (async function*
1127
- (): AsyncGenerator<AiAssistanceModel.ExternalRequestResponse, AiAssistanceModel.ExternalRequestResponse> {
1128
- return {
1129
- type: AiAssistanceModel.ExternalRequestResponseType.ERROR,
1130
- // @ts-expect-error
1131
- message: `Debugging with an agent of type '${input.kind}' is not implemented yet.`,
1132
- };
1133
- })();
1140
+ return (async function*(): AsyncGenerator<
1141
+ AiAssistanceModel.AiAgent.ExternalRequestResponse, AiAssistanceModel.AiAgent.ExternalRequestResponse> {
1142
+ return {
1143
+ type: AiAssistanceModel.AiAgent.ExternalRequestResponseType.ERROR,
1144
+ // @ts-expect-error
1145
+ message: `Debugging with an agent of type '${input.kind}' is not implemented yet.`,
1146
+ };
1147
+ })();
1134
1148
  }
1135
1149
 
1136
1150
  // @ts-expect-error