chrome-devtools-frontend 1.0.1664496 → 1.0.1665921

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 (407) hide show
  1. package/.agents/skills/devtools-testing-guidance/SKILL.md +48 -0
  2. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +3 -3
  3. package/.agents/skills/repro-flaky-tests/SKILL.md +2 -2
  4. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +7 -1
  5. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +2 -0
  6. package/.agents/skills/version-control/SKILL.md +4 -3
  7. package/docs/ui_engineering.md +89 -0
  8. package/eslint.config.mjs +9 -2
  9. package/front_end/Images/rollup.config.mjs +1 -1
  10. package/front_end/Tests.js +15 -16
  11. package/front_end/core/common/Gzip.ts +2 -2
  12. package/front_end/core/common/Settings.ts +4 -20
  13. package/front_end/core/common/Srcset.ts +1 -1
  14. package/front_end/core/common/VersionController.ts +1 -1
  15. package/front_end/core/host/AidaClient.ts +19 -4
  16. package/front_end/core/host/AidaGcaTranslation.ts +2 -2
  17. package/front_end/core/host/GcaClient.ts +2 -2
  18. package/front_end/core/host/GdpClient.ts +3 -3
  19. package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
  20. package/front_end/core/host/ResourceLoader.ts +15 -15
  21. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +2 -2
  22. package/front_end/core/protocol_client/InspectorBackend.ts +1 -1
  23. package/front_end/core/root/Runtime.ts +0 -1
  24. package/front_end/core/sdk/CSSMatchedStyles.ts +78 -3
  25. package/front_end/core/sdk/CSSMetadata.ts +17 -12
  26. package/front_end/core/sdk/CSSProperty.ts +1 -1
  27. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -2
  28. package/front_end/core/sdk/CSSRule.ts +3 -3
  29. package/front_end/core/sdk/CSSStyleSheetHeader.ts +3 -3
  30. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
  31. package/front_end/core/sdk/Connections.ts +1 -1
  32. package/front_end/core/sdk/DebuggerModel.ts +13 -13
  33. package/front_end/core/sdk/NetworkManager.ts +19 -19
  34. package/front_end/core/sdk/NetworkRequest.ts +57 -57
  35. package/front_end/core/sdk/OverlayModel.ts +1 -1
  36. package/front_end/core/sdk/PageResourceLoader.ts +2 -2
  37. package/front_end/core/sdk/RehydratingConnection.ts +5 -5
  38. package/front_end/core/sdk/ScreenCaptureModel.ts +1 -1
  39. package/front_end/core/sdk/Script.ts +2 -2
  40. package/front_end/core/sdk/ServerTiming.ts +7 -7
  41. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +1 -1
  42. package/front_end/core/sdk/ServiceWorkerManager.ts +11 -11
  43. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +2 -2
  44. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  45. package/front_end/core/sdk/StorageKeyManager.ts +1 -1
  46. package/front_end/core/sdk/sdk-meta.ts +98 -98
  47. package/front_end/devtools_compatibility.js +15 -13
  48. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +4 -8
  49. package/front_end/entrypoints/main/MainImpl.ts +2 -3
  50. package/front_end/entrypoints/main/main-meta.ts +1 -16
  51. package/front_end/entrypoints/shell/shell.ts +1 -0
  52. package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
  53. package/front_end/foundation/README.md +1 -1
  54. package/front_end/foundation/Universe.test.api.ts +73 -0
  55. package/front_end/foundation/Universe.ts +22 -0
  56. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  57. package/front_end/generated/SupportedCSSProperties.js +1 -1
  58. package/front_end/generated/protocol.ts +19 -0
  59. package/front_end/models/ai_assistance/AiAgent2.ts +1 -1
  60. package/front_end/models/ai_assistance/AiConversation.ts +1 -1
  61. package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
  62. package/front_end/models/ai_assistance/ChangeManager.ts +0 -70
  63. package/front_end/models/ai_assistance/ExtensionScope.ts +2 -36
  64. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -9
  65. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -2
  66. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +4 -4
  67. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +1 -1
  68. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +21 -21
  69. package/front_end/models/ai_assistance/agents/StorageAgent.ts +4 -4
  70. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  71. package/front_end/models/ai_assistance/ai_assistance.ts +0 -5
  72. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +11 -4
  73. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +8 -2
  74. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +14 -11
  75. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +2 -2
  76. package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -2
  77. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
  78. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -2
  79. package/front_end/models/ai_assistance/tools/GetStyles.ts +4 -4
  80. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -5
  81. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -2
  82. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -2
  83. package/front_end/models/badges/badges-meta.ts +27 -0
  84. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -3
  85. package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
  86. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +6 -7
  87. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +5 -4
  88. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +72 -29
  89. package/front_end/models/bindings/ResourceMapping.ts +38 -32
  90. package/front_end/models/bindings/ResourceScriptMapping.ts +5 -7
  91. package/front_end/models/breakpoints/BreakpointManager.ts +2 -1
  92. package/front_end/models/har/Writer.ts +2 -2
  93. package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +1 -1
  94. package/front_end/models/issues_manager/GenericIssue.ts +1 -1
  95. package/front_end/models/issues_manager/IssuesManager.ts +14 -5
  96. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +1 -1
  97. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
  98. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +13 -2
  99. package/front_end/models/issues_manager/issues_manager.ts +0 -2
  100. package/front_end/models/live-metrics/LiveMetrics.ts +22 -5
  101. package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +1 -1
  102. package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +10 -4
  103. package/front_end/models/logs/logs-meta.ts +23 -16
  104. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
  105. package/front_end/models/persistence/IsolatedFileSystem.ts +1 -1
  106. package/front_end/models/persistence/IsolatedFileSystemManager.ts +1 -1
  107. package/front_end/models/source_map_scopes/NamesResolver.ts +104 -86
  108. package/front_end/models/source_map_scopes/ScopeChainModel.ts +6 -2
  109. package/front_end/models/stack_trace/StackTraceModel.ts +1 -1
  110. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -1
  111. package/front_end/models/trace/handlers/UserTimingsHandler.ts +17 -6
  112. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
  113. package/front_end/models/trace/helpers/Timing.ts +1 -1
  114. package/front_end/models/trace/insights/Common.ts +1 -1
  115. package/front_end/models/trace/insights/DocumentLatency.ts +3 -3
  116. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
  117. package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
  118. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +2 -2
  119. package/front_end/models/workspace_diff/WorkspaceDiff.ts +14 -9
  120. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -15
  121. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -2
  122. package/front_end/panels/ai_assistance/components/ChatInput.ts +23 -19
  123. package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -18
  124. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -35
  125. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +1 -1
  126. package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
  127. package/front_end/panels/ai_assistance/components/ImageResize.ts +74 -0
  128. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +2 -2
  129. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +28 -29
  130. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  131. package/front_end/panels/animation/animationTimeline.css +0 -2
  132. package/front_end/panels/application/AppManifestView.ts +1 -1
  133. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -1
  134. package/front_end/panels/application/CookieItemsView.ts +1 -1
  135. package/front_end/panels/application/CrashReportContextView.ts +3 -3
  136. package/front_end/panels/application/DeviceBoundSessionsModel.ts +1 -1
  137. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +1 -1
  138. package/front_end/panels/application/DeviceBoundSessionsView.ts +1 -1
  139. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  140. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -1
  141. package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
  142. package/front_end/panels/application/ServiceWorkersView.ts +6 -6
  143. package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
  144. package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
  145. package/front_end/panels/application/WebMCPView.ts +7 -5
  146. package/front_end/panels/application/components/AdsView.ts +21 -6
  147. package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
  148. package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
  149. package/front_end/panels/application/components/StorageMetadataView.ts +1 -1
  150. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
  151. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
  152. package/front_end/panels/application/preloading/components/PreloadingString.ts +3 -3
  153. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -1
  154. package/front_end/panels/autofill/AutofillView.ts +1 -1
  155. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
  156. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +2 -2
  157. package/front_end/panels/changes/ChangesSidebar.ts +2 -2
  158. package/front_end/panels/changes/ChangesView.ts +4 -5
  159. package/front_end/panels/changes/CombinedDiffView.ts +3 -3
  160. package/front_end/panels/changes/changes-meta.ts +2 -2
  161. package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
  162. package/front_end/panels/common/AiCodeGenerationTeaser.ts +3 -3
  163. package/front_end/panels/common/BadgeNotification.ts +8 -8
  164. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  165. package/front_end/panels/common/GdpSignUpDialog.ts +2 -2
  166. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
  167. package/front_end/panels/common/aiCodeCompletionDisclaimer.css +0 -1
  168. package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
  169. package/front_end/panels/console/ConsolePinPane.ts +3 -3
  170. package/front_end/panels/console/ConsolePrompt.ts +6 -4
  171. package/front_end/panels/console/ConsoleSidebar.ts +8 -10
  172. package/front_end/panels/console_counters/WarningErrorCounter.ts +10 -11
  173. package/front_end/panels/coverage/CoverageView.ts +2 -2
  174. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  175. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
  176. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  177. package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
  178. package/front_end/panels/elements/ComputedStyleWidget.ts +3 -2
  179. package/front_end/panels/elements/ElementsTreeElement.ts +3 -3
  180. package/front_end/panels/elements/EventListenersWidget.ts +1 -3
  181. package/front_end/panels/elements/LayoutPane.ts +23 -13
  182. package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -7
  183. package/front_end/panels/elements/StylePropertiesSection.ts +33 -5
  184. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -5
  185. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +6 -6
  186. package/front_end/panels/elements/StylesSidebarPane.ts +4 -3
  187. package/front_end/panels/elements/elements-meta.ts +18 -2
  188. package/front_end/panels/emulation/DeviceModeToolbar.ts +100 -40
  189. package/front_end/panels/emulation/DeviceModeView.ts +5 -4
  190. package/front_end/panels/emulation/MediaQueryInspector.ts +35 -19
  191. package/front_end/panels/event_listeners/EventListenersView.ts +4 -4
  192. package/front_end/panels/explain/components/ConsoleInsight.ts +8 -9
  193. package/front_end/panels/explain/explain-meta.ts +3 -3
  194. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +135 -167
  195. package/front_end/panels/layer_viewer/Layers3DView.ts +10 -23
  196. package/front_end/panels/layer_viewer/layer_viewer-meta.ts +27 -0
  197. package/front_end/panels/lighthouse/LighthouseController.ts +44 -55
  198. package/front_end/panels/lighthouse/LighthousePanel.ts +9 -9
  199. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +2 -2
  200. package/front_end/panels/lighthouse/LighthouseStartView.ts +9 -12
  201. package/front_end/panels/lighthouse/LighthouseStatusView.ts +33 -33
  202. package/front_end/panels/lighthouse/RadioSetting.ts +1 -1
  203. package/front_end/panels/lighthouse/lighthouse-meta.ts +131 -1
  204. package/front_end/panels/media/EventDisplayTable.ts +67 -94
  205. package/front_end/panels/media/PlayerListView.ts +1 -1
  206. package/front_end/panels/media/eventDisplayTable.css +9 -4
  207. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +5 -5
  208. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
  209. package/front_end/panels/network/EventSourceMessagesView.ts +98 -107
  210. package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
  211. package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -1
  212. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  213. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  214. package/front_end/panels/network/RequestHeadersView.ts +5 -5
  215. package/front_end/panels/network/RequestPayloadView.ts +4 -4
  216. package/front_end/panels/network/RequestTimingView.ts +2 -2
  217. package/front_end/panels/network/components/DirectSocketConnectionView.ts +1 -1
  218. package/front_end/panels/network/eventSourceMessagesView.css +12 -3
  219. package/front_end/panels/network/networkTimingTable.css +2 -2
  220. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  221. package/front_end/panels/profiler/BottomUpProfileDataGrid.ts +25 -29
  222. package/front_end/panels/profiler/HeapProfileView.ts +308 -247
  223. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +13 -3
  224. package/front_end/panels/profiler/HeapSnapshotView.ts +30 -10
  225. package/front_end/panels/profiler/HeapTimelineOverview.ts +5 -2
  226. package/front_end/panels/profiler/ProfileDataGrid.ts +128 -157
  227. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +17 -5
  228. package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
  229. package/front_end/panels/profiler/TopDownProfileDataGrid.ts +17 -21
  230. package/front_end/panels/profiler/profilesPanel.css +9 -13
  231. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
  232. package/front_end/panels/recorder/CreateRecordingView.ts +4 -4
  233. package/front_end/panels/recorder/RecorderPanel.ts +6 -6
  234. package/front_end/panels/recorder/RecordingView.ts +1 -1
  235. package/front_end/panels/recorder/ReplaySection.ts +1 -1
  236. package/front_end/panels/recorder/StepView.ts +1 -1
  237. package/front_end/panels/recorder/injected/rollup.config.mjs +1 -1
  238. package/front_end/panels/search/SearchView.ts +1 -1
  239. package/front_end/panels/security/SecurityPanel.ts +54 -41
  240. package/front_end/panels/sensors/LocationsSettingsTab.ts +246 -233
  241. package/front_end/panels/sensors/SensorsView.ts +1 -1
  242. package/front_end/panels/settings/AISettingsTab.ts +11 -10
  243. package/front_end/panels/settings/SettingsScreen.ts +29 -24
  244. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  245. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +5 -5
  246. package/front_end/panels/sources/BreakpointEditDialog.ts +2 -2
  247. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  248. package/front_end/panels/sources/CallStackSidebarPane.ts +2 -2
  249. package/front_end/panels/sources/DebuggerPausedMessage.ts +2 -2
  250. package/front_end/panels/sources/DebuggerPlugin.ts +25 -22
  251. package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -1
  252. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -5
  253. package/front_end/panels/sources/sources-meta.ts +1 -1
  254. package/front_end/panels/timeline/CountersGraph.ts +1 -2
  255. package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
  256. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  257. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -2
  258. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -4
  259. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +1 -1
  260. package/front_end/panels/timeline/TimelinePanel.ts +53 -81
  261. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +10 -3
  262. package/front_end/panels/timeline/TimelineUIUtils.ts +18 -4
  263. package/front_end/panels/timeline/TrackConfigBanner.ts +1 -1
  264. package/front_end/panels/timeline/components/ExportTraceOptions.ts +1 -1
  265. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +8 -9
  266. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
  267. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +1 -1
  268. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
  269. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +1 -1
  270. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +1 -1
  271. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  272. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +5 -0
  273. package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +13 -8
  274. package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +1 -0
  275. package/front_end/panels/timeline/timeline-meta.ts +169 -0
  276. package/front_end/panels/timeline/timelineFlameChartView.css +5 -0
  277. package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
  278. package/front_end/panels/whats_new/ReleaseNoteText.ts +9 -9
  279. package/front_end/panels/whats_new/resources/WNDT.md +7 -8
  280. package/front_end/third_party/chromium/README.chromium +1 -1
  281. package/front_end/third_party/web-vitals/README.chromium +2 -2
  282. package/front_end/third_party/web-vitals/package/README.md +120 -19
  283. package/front_end/third_party/web-vitals/package/attribution.d.ts +16 -0
  284. package/front_end/third_party/web-vitals/package/attribution.js +18 -0
  285. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +1 -1
  286. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +1 -7
  287. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +53 -32
  288. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +2 -2
  289. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +43 -12
  290. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +1 -1
  291. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +21 -3
  292. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +1 -1
  293. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +30 -24
  294. package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.d.ts +3 -0
  295. package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.js +18 -0
  296. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +2 -1
  297. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +18 -2
  298. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +1 -0
  299. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.js +1 -0
  300. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.d.ts +1 -1
  301. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  302. package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.d.ts +1 -1
  303. package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.js +7 -7
  304. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +1 -1
  305. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -1
  306. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +4 -1
  307. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +7 -3
  308. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +20 -11
  309. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.js +8 -3
  310. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.d.ts +3 -1
  311. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +19 -4
  312. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +1 -1
  313. package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.d.ts +3 -0
  314. package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.js +38 -0
  315. package/front_end/third_party/web-vitals/package/dist/modules/lib/whenIdleOrHidden.js +5 -1
  316. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.d.ts +1 -1
  317. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +30 -11
  318. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.d.ts +1 -1
  319. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +36 -4
  320. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +1 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +42 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.d.ts +1 -1
  323. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +109 -30
  324. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.d.ts +1 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +25 -7
  326. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +24 -1
  327. package/front_end/third_party/web-vitals/package/dist/modules/types/fcp.d.ts +1 -1
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +14 -6
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +1 -1
  330. package/front_end/third_party/web-vitals/package/dist/modules/types/ttfb.d.ts +2 -2
  331. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +26 -4
  332. package/front_end/third_party/web-vitals/package/package.json +21 -22
  333. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +1 -1
  334. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +62 -39
  335. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +52 -15
  336. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +25 -7
  337. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +43 -37
  338. package/front_end/third_party/web-vitals/package/src/lib/{polyfills/getFirstHiddenTimePolyfill.ts → FCPEntryManager.ts} +4 -14
  339. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +22 -2
  340. package/front_end/third_party/web-vitals/package/src/lib/LCPEntryManager.ts +1 -0
  341. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  342. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  343. package/front_end/third_party/web-vitals/package/src/lib/getLoadState.ts +11 -12
  344. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +1 -1
  345. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +4 -1
  346. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +24 -11
  347. package/front_end/third_party/web-vitals/package/src/lib/initUnique.ts +12 -4
  348. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +26 -5
  349. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +1 -1
  350. package/front_end/third_party/web-vitals/package/src/lib/softNavs.ts +48 -0
  351. package/front_end/third_party/web-vitals/package/src/lib/whenIdleOrHidden.ts +12 -4
  352. package/front_end/third_party/web-vitals/package/src/onCLS.ts +75 -18
  353. package/front_end/third_party/web-vitals/package/src/onFCP.ts +66 -7
  354. package/front_end/third_party/web-vitals/package/src/onINP.ts +100 -39
  355. package/front_end/third_party/web-vitals/package/src/onLCP.ts +169 -34
  356. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +50 -13
  357. package/front_end/third_party/web-vitals/package/src/types/base.ts +31 -10
  358. package/front_end/third_party/web-vitals/package/src/types/fcp.ts +1 -1
  359. package/front_end/third_party/web-vitals/package/src/types/inp.ts +14 -6
  360. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +1 -1
  361. package/front_end/third_party/web-vitals/package/src/types/ttfb.ts +2 -2
  362. package/front_end/third_party/web-vitals/package/src/types.ts +32 -9
  363. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +11 -11
  364. package/front_end/third_party/web-vitals/rebuild.sh +2 -2
  365. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +2 -0
  366. package/front_end/ui/components/buttons/Button.ts +16 -0
  367. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  368. package/front_end/ui/components/highlighting/HighlightManager.ts +6 -1
  369. package/front_end/ui/components/highlighting/highlighting.ts +1 -1
  370. package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
  371. package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
  372. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
  373. package/front_end/ui/components/settings/SettingCheckbox.ts +12 -7
  374. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +2 -2
  375. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +6 -6
  376. package/front_end/ui/components/text_editor/javascript.ts +3 -1
  377. package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
  378. package/front_end/ui/legacy/ContextMenu.ts +12 -2
  379. package/front_end/ui/legacy/ListControl.ts +1 -1
  380. package/front_end/ui/legacy/SelectMenu.docs.ts +17 -19
  381. package/front_end/ui/legacy/Toolbar.ts +4 -1
  382. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  383. package/front_end/ui/legacy/components/color_picker/spectrum.css +1 -2
  384. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  385. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +50 -4
  386. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +3 -1
  387. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +4 -4
  388. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +8 -7
  389. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +14 -11
  390. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +1 -1
  391. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +15 -5
  392. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -4
  393. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -1
  394. package/front_end/ui/lit/render.ts +1 -1
  395. package/front_end/ui/settings/SettingUIRegistration.ts +8 -3
  396. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  397. package/front_end/ui/visual_logging/LoggingEvents.ts +1 -1
  398. package/inspector_overlay/main.ts +1 -1
  399. package/mcp/mcp.ts +5 -4
  400. package/package.json +13 -13
  401. package/front_end/models/ai_assistance/AgentProject.ts +0 -261
  402. package/front_end/models/ai_assistance/agents/PatchAgent.ts +0 -306
  403. package/front_end/models/issues_manager/CheckFormsIssuesTrigger.ts +0 -45
  404. package/front_end/models/text_utils/text_utils.ts +0 -5
  405. package/front_end/panels/ai_assistance/PatchWidget.ts +0 -867
  406. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +0 -368
  407. package/front_end/panels/ai_assistance/selectWorkspaceDialog.css +0 -92
@@ -329,6 +329,9 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
329
329
  const inpEvent: InpValue = {
330
330
  value: webVitalsEvent.value,
331
331
  subparts: webVitalsEvent.subparts,
332
+ // Use our own "interactionId" rather than the Chrome/web-vitals
333
+ // provided one, so we can group events with same start time
334
+ // (e.g. `pointerup` and `click` are one interaction log entry)
332
335
  interactionId: `interaction-${webVitalsEvent.entryGroupId}-${webVitalsEvent.startTime}`,
333
336
  };
334
337
  this.#inpValue = inpEvent;
@@ -339,13 +342,17 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
339
342
  Platform.MapUtilities.getWithDefault(this.#interactionsByGroupId, webVitalsEvent.entryGroupId, () => []);
340
343
 
341
344
  // `nextPaintTime` uses the event duration which is rounded to the nearest 8ms. The best we can do
342
- // is check if the `nextPaintTime`s are within 8ms.
345
+ // is check if the `nextPaintTime`s are within 8ms. Exclude undefined/null/0 nextPaintTimes.
343
346
  // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration#event
344
- let interaction = groupInteractions.find(
345
- interaction => Math.abs(interaction.nextPaintTime - webVitalsEvent.nextPaintTime) < 8);
347
+ let interaction =
348
+ groupInteractions.find(interaction => interaction.nextPaintTime && webVitalsEvent.nextPaintTime &&
349
+ Math.abs(interaction.nextPaintTime - webVitalsEvent.nextPaintTime) < 8);
346
350
 
347
351
  if (!interaction) {
348
352
  interaction = {
353
+ // Use our own "interactionId" rather than the Chrome/web-vitals
354
+ // provided one, so we can group events with same start time
355
+ // (e.g. `pointerup` and `click` are one interaction log entry)
349
356
  interactionId: `interaction-${webVitalsEvent.entryGroupId}-${webVitalsEvent.startTime}`,
350
357
  interactionType: webVitalsEvent.interactionType,
351
358
  duration: webVitalsEvent.duration,
@@ -625,6 +632,9 @@ export const enum Events {
625
632
  STATUS = 'status',
626
633
  }
627
634
 
635
+ // Use our own "interactionId" rather than the Chrome/web-vitals
636
+ // provided one, so we can group events with same start time
637
+ // (e.g. `pointerup` and `click` are one interaction log entry)
628
638
  export type InteractionId = `interaction-${number}-${number}`;
629
639
 
630
640
  export interface MetricValue {
@@ -652,13 +662,20 @@ export interface LayoutShift {
652
662
  affectedNodeRefs: SDK.DOMModel.DOMNode[];
653
663
  }
654
664
 
665
+ /*
666
+ * Note web-vitals can emit "fake" INP events without an interactionType nor a
667
+ * nextPaintTime for small interactions after soft navs or bfcache restores.
668
+ * For hardNavs these would have a FID event, but for soft navs or bfcache
669
+ * restores there is no FID equivalent (it's only emitted once per page)
670
+ * so dummy events without full details are used.
671
+ */
655
672
  export interface Interaction {
656
673
  interactionId: InteractionId;
657
- interactionType: Spec.InteractionEntryEvent['interactionType'];
674
+ interactionType?: Spec.InteractionEntryEvent['interactionType'];
658
675
  eventNames: string[];
659
676
  duration: number;
660
677
  startTime: number;
661
- nextPaintTime: number;
678
+ nextPaintTime?: number;
662
679
  subparts: Spec.InpSubparts;
663
680
  longAnimationFrameTimings: Spec.PerformanceLongAnimationFrameTimingJSON[];
664
681
  nodeRef?: SDK.DOMModel.DOMNode;
@@ -16,5 +16,5 @@ function isEnvVarTrue(envVar) {
16
16
  export default {
17
17
  treeshake: true,
18
18
  output: [{format: 'iife'}],
19
- plugins: isEnvVarTrue(process.env.DEBUG_INJECTED) ? [] : [terser()]
19
+ plugins: isEnvVarTrue(process.env.DEBUG_INJECTED) ? [] : [terser()],
20
20
  };
@@ -84,16 +84,22 @@ export interface PerformanceLongAnimationFrameTimingJSON {
84
84
  }
85
85
 
86
86
  /**
87
- * This event is not 1:1 with the interactions that the user sees in the interactions log.
88
- * It is 1:1 with a `PerformanceEventTiming` entry.
87
+ * This event is not 1:1 with the interactions that the user sees in the
88
+ * interactions log. It is 1:1 with a web-vitals entry.
89
+ *
90
+ * Note web-vitals can emit "fake" INP events without an interactionType nor a
91
+ * nextPaintTime for small interactions after soft navs or bfcache restores.
92
+ * For hardNavs these would have a FID event, but for soft navs or bfcache
93
+ * restores there is no FID equivalent (it's only emitted once per page)
94
+ * so dummy events without full details are used.
89
95
  */
90
96
  export interface InteractionEntryEvent {
91
97
  name: 'InteractionEntry';
92
- interactionType: INPAttribution['interactionType'];
98
+ interactionType?: INPAttribution['interactionType'];
93
99
  eventName: string;
94
100
  entryGroupId: InteractionEntryGroupId;
95
101
  startTime: number;
96
- nextPaintTime: number;
102
+ nextPaintTime?: number;
97
103
  duration: Trace.Types.Timing.Milli;
98
104
  subparts: InpSubparts;
99
105
  nodeIndex?: number;
@@ -7,37 +7,43 @@ import * as i18n from '../../core/i18n/i18n.js';
7
7
 
8
8
  const UIStrings = {
9
9
  /**
10
- * @description Text to preserve the log after refreshing
10
+ * @description Text to keep the log after refreshing.
11
11
  */
12
- preserveLog: 'Keep log',
12
+ keepLog: 'Keep log',
13
13
  /**
14
14
  * @description A term that can be used to search in the command menu, and will find the search
15
- * result 'Preserve log on page reload / navigation'. This is an additional search term to help
16
- * user find the setting even when they don't know the exact name of it.
15
+ * result 'Keep log on page reload / navigation'. This is an additional search term to help
16
+ * the user find the setting even when they don't know the exact name of it.
17
+ */
18
+ keep: 'keep',
19
+ /**
20
+ * @description A term that can be used to search in the command menu, and will find the search
21
+ * result 'Keep log on page reload / navigation'. This is an additional search term to help
22
+ * the user find the setting even when they don't know the exact name of it.
17
23
  */
18
24
  preserve: 'preserve',
19
25
  /**
20
26
  * @description A term that can be used to search in the command menu, and will find the search
21
- * result 'Preserve log on page reload / navigation'. This is an additional search term to help
22
- * user find the setting even when they don't know the exact name of it.
27
+ * result 'Keep log on page reload / navigation'. This is an additional search term to help
28
+ * the user find the setting even when they don't know the exact name of it.
23
29
  */
24
30
  clear: 'clear',
25
31
  /**
26
32
  * @description A term that can be used to search in the command menu, and will find the search
27
- * result 'Preserve log on page reload / navigation'. This is an additional search term to help
28
- * user find the setting even when they don't know the exact name of it.
33
+ * result 'Keep log on page reload / navigation'. This is an additional search term to help
34
+ * the user find the setting even when they don't know the exact name of it.
29
35
  */
30
36
  reset: 'reset',
31
37
  /**
32
- * @description Title of a setting under the Network category that can be invoked through the Command Menu
38
+ * @description Title of a setting under the Network category that can be invoked through the Command Menu.
33
39
  */
34
- preserveLogOnPageReload: 'Keep log on page reload / navigation',
40
+ keepLogOnPageReload: 'Keep log on page reload / navigation',
35
41
  /**
36
- * @description Title of a setting under the Network category that can be invoked through the Command Menu
42
+ * @description Title of a setting under the Network category that can be invoked through the Command Menu.
37
43
  */
38
- doNotPreserveLogOnPageReload: 'Don’t keep log on page reload / navigation',
44
+ doNotKeepLogOnPageReload: 'Don’t keep log on page reload / navigation',
39
45
  /**
40
- * @description Title of an action in the network tool to toggle recording
46
+ * @description Title of an action in the network tool to toggle recording.
41
47
  */
42
48
  recordNetworkLog: 'Record network log',
43
49
  } as const;
@@ -46,11 +52,12 @@ const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined
46
52
 
47
53
  Common.Settings.registerSettingExtension({
48
54
  category: Common.Settings.SettingCategory.NETWORK,
49
- title: i18nLazyString(UIStrings.preserveLog),
55
+ title: i18nLazyString(UIStrings.keepLog),
50
56
  settingName: 'network-log.preserve-log',
51
57
  settingType: Common.Settings.SettingType.BOOLEAN,
52
58
  defaultValue: false,
53
59
  tags: [
60
+ i18nLazyString(UIStrings.keep),
54
61
  i18nLazyString(UIStrings.preserve),
55
62
  i18nLazyString(UIStrings.clear),
56
63
  i18nLazyString(UIStrings.reset),
@@ -58,11 +65,11 @@ Common.Settings.registerSettingExtension({
58
65
  options: [
59
66
  {
60
67
  value: true,
61
- title: i18nLazyString(UIStrings.preserveLogOnPageReload),
68
+ title: i18nLazyString(UIStrings.keepLogOnPageReload),
62
69
  },
63
70
  {
64
71
  value: false,
65
- title: i18nLazyString(UIStrings.doNotPreserveLogOnPageReload),
72
+ title: i18nLazyString(UIStrings.doNotKeepLogOnPageReload),
66
73
  },
67
74
  ],
68
75
  });
@@ -13,11 +13,11 @@ import * as Workspace from '../workspace/workspace.js';
13
13
  import {
14
14
  type AutomaticFileSystem,
15
15
  type AutomaticFileSystemManager,
16
- Events as AutomaticFileSystemManagerEvents
16
+ Events as AutomaticFileSystemManagerEvents,
17
17
  } from './AutomaticFileSystemManager.js';
18
18
  import {
19
19
  Events as IsolatedFileSystemManagerEvents,
20
- type IsolatedFileSystemManager
20
+ type IsolatedFileSystemManager,
21
21
  } from './IsolatedFileSystemManager.js';
22
22
 
23
23
  /**
@@ -42,7 +42,7 @@ const UIStrings = {
42
42
  * @description Error message shown when devtools failed to create a file system directory.
43
43
  * @example {path/} PH1
44
44
  */
45
- createDirFailed: 'Overrides: Failed to create directory {PH1}. Are the workspace or overrides configured correctly?'
45
+ createDirFailed: 'Overrides: Failed to create directory {PH1}. Are the workspace or overrides configured correctly?',
46
46
  } as const;
47
47
  const str_ = i18n.i18n.registerUIStrings('models/persistence/IsolatedFileSystem.ts', UIStrings);
48
48
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -13,7 +13,7 @@ import {IsolatedFileSystem} from './IsolatedFileSystem.js';
13
13
  import {
14
14
  Events as PlatformFileSystemEvents,
15
15
  type PlatformFileSystem,
16
- PlatformFileSystemType
16
+ PlatformFileSystemType,
17
17
  } from './PlatformFileSystem.js';
18
18
 
19
19
  const UIStrings = {
@@ -5,7 +5,7 @@
5
5
  import * as SDK from '../../core/sdk/sdk.js';
6
6
  import * as TextUtils from '../../core/text_utils/text_utils.js';
7
7
  import * as Protocol from '../../generated/protocol.js';
8
- import * as Bindings from '../bindings/bindings.js';
8
+ import type * as Bindings from '../bindings/bindings.js';
9
9
  import * as Formatter from '../formatter/formatter.js';
10
10
 
11
11
  interface CachedScopeMap {
@@ -187,7 +187,9 @@ const enum Punctuation {
187
187
  EQUALS = 'equals',
188
188
  }
189
189
 
190
- const resolveDebuggerScope = async(scope: SDK.DebuggerModel.ScopeChainEntry):
190
+ const resolveDebuggerScope = async(
191
+ scope: SDK.DebuggerModel.ScopeChainEntry,
192
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
191
193
  Promise<{variableMapping: Map<string, string>, thisMapping: string | null}> => {
192
194
  if (!scope.callFrame()
193
195
  .debuggerModel.target()
@@ -198,10 +200,11 @@ const resolveDebuggerScope = async(scope: SDK.DebuggerModel.ScopeChainEntry):
198
200
  }
199
201
  const script = scope.callFrame().script;
200
202
  const scopeChain = await findScopeChainForDebuggerScope(scope);
201
- return await resolveScope(script, scopeChain);
203
+ return await resolveScope(script, scopeChain, debuggerWorkspaceBinding);
202
204
  };
203
205
 
204
- const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.FormatterWorkerPool.ScopeTreeNode[]):
206
+ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.FormatterWorkerPool.ScopeTreeNode[],
207
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
205
208
  Promise<{variableMapping: Map<string, string>, thisMapping: string | null}> => {
206
209
  const parsedScope = scopeChain[scopeChain.length - 1];
207
210
  if (!parsedScope) {
@@ -242,7 +245,8 @@ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.Form
242
245
  // mappings agree. However, that can be expensive for identifiers with many uses,
243
246
  // so we iterate sequentially, stopping at the first non-empty mapping.
244
247
  for (const position of id.positions) {
245
- const sourceName = await resolveSourceName(script, sourceMap, id.name, position);
248
+ const sourceName =
249
+ await resolveSourceName(script, sourceMap, id.name, position, debuggerWorkspaceBinding);
246
250
  if (sourceName) {
247
251
  handler(sourceName);
248
252
  return;
@@ -282,8 +286,7 @@ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.Form
282
286
  async function resolveSourceName(
283
287
  script: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap, name: string,
284
288
  position: {lineNumber: number, columnNumber: number},
285
- debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
286
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<string|null> {
289
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding): Promise<string|null> {
287
290
  const ranges = sourceMap.findEntryRanges(position.lineNumber, position.columnNumber);
288
291
  if (!ranges) {
289
292
  return null;
@@ -368,8 +371,7 @@ const resolveScope = async(script: SDK.Script.Script, scopeChain: Formatter.Form
368
371
 
369
372
  export const resolveScopeChain =
370
373
  async function(callFrame: SDK.DebuggerModel.CallFrame,
371
- debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
372
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()):
374
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
373
375
  Promise<SDK.DebuggerModel.ScopeChainEntry[]> {
374
376
  const {pluginManager} = debuggerWorkspaceBinding;
375
377
  const scopeChain: SDK.DebuggerModel.ScopeChainEntry[]|null|undefined =
@@ -385,96 +387,104 @@ export const resolveScopeChain =
385
387
  if (callFrame.script.isWasm()) {
386
388
  return callFrame.scopeChain();
387
389
  }
388
- const thisObject = await resolveThisObject(callFrame);
389
- return callFrame.scopeChain().map(scope => new ScopeWithSourceMappedVariables(scope, thisObject));
390
+ const thisObject = await resolveThisObject(callFrame, debuggerWorkspaceBinding);
391
+ return callFrame.scopeChain().map(
392
+ scope => new ScopeWithSourceMappedVariables(scope, thisObject, debuggerWorkspaceBinding));
390
393
  };
391
394
 
392
395
  /**
393
396
  * @returns A mapping from original name -> compiled name. If the orignal name is unavailable (e.g. because the compiled name was
394
397
  * shadowed) we set it to `null`.
395
398
  */
396
- export const allVariablesInCallFrame =
397
- async(callFrame: SDK.DebuggerModel.CallFrame): Promise<Map<string, string|null>> => {
398
- if (!callFrame.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
399
- return new Map<string, string|null>();
400
- }
401
- const cachedMap = cachedMapByCallFrame.get(callFrame);
402
- if (cachedMap) {
403
- return cachedMap;
404
- }
405
-
406
- const scopeChain = callFrame.scopeChain();
407
- const nameMappings = await Promise.all(scopeChain.map(resolveDebuggerScope));
408
- const reverseMapping = new Map<string, string|null>();
409
- const compiledNames = new Set<string>();
410
- for (const {variableMapping} of nameMappings) {
411
- for (const [compiledName, originalName] of variableMapping) {
412
- if (!originalName) {
413
- continue;
399
+ export const allVariablesInCallFrame = async(
400
+ callFrame: SDK.DebuggerModel.CallFrame,
401
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
402
+ Promise<Map<string, string|null>> => {
403
+ if (!callFrame.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
404
+ return new Map<string, string|null>();
414
405
  }
415
- if (!reverseMapping.has(originalName)) {
416
- // An inner scope might have shadowed {compiledName}. Mark it as "unavailable" in that case.
417
- const compiledNameOrNull = compiledNames.has(compiledName) ? null : compiledName;
418
- reverseMapping.set(originalName, compiledNameOrNull);
406
+ const cachedMap = cachedMapByCallFrame.get(callFrame);
407
+ if (cachedMap) {
408
+ return cachedMap;
419
409
  }
420
- compiledNames.add(compiledName);
421
- }
422
- }
423
- cachedMapByCallFrame.set(callFrame, reverseMapping);
424
- return reverseMapping;
425
- };
410
+
411
+ const scopeChain = callFrame.scopeChain();
412
+ const nameMappings =
413
+ await Promise.all(scopeChain.map(scope => resolveDebuggerScope(scope, debuggerWorkspaceBinding)));
414
+ const reverseMapping = new Map<string, string|null>();
415
+ const compiledNames = new Set<string>();
416
+ for (const {variableMapping} of nameMappings) {
417
+ for (const [compiledName, originalName] of variableMapping) {
418
+ if (!originalName) {
419
+ continue;
420
+ }
421
+ if (!reverseMapping.has(originalName)) {
422
+ // An inner scope might have shadowed {compiledName}. Mark it as "unavailable" in that case.
423
+ const compiledNameOrNull = compiledNames.has(compiledName) ? null : compiledName;
424
+ reverseMapping.set(originalName, compiledNameOrNull);
425
+ }
426
+ compiledNames.add(compiledName);
427
+ }
428
+ }
429
+ cachedMapByCallFrame.set(callFrame, reverseMapping);
430
+ return reverseMapping;
431
+ };
426
432
 
427
433
  /**
428
434
  * @returns A mapping from original name -> compiled name. If the orignal name is unavailable (e.g. because the compiled name was
429
435
  * shadowed) we set it to `null`.
430
436
  */
431
437
  export const allVariablesAtPosition =
432
- async(location: SDK.DebuggerModel.Location): Promise<Map<string, string|null>> => {
433
- const reverseMapping = new Map<string, string|null>();
434
- const script = location.script();
435
- if (!script) {
436
- return reverseMapping;
437
- }
438
- if (!script.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
439
- return reverseMapping;
440
- }
438
+ async(location: SDK.DebuggerModel.Location,
439
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding):
440
+ Promise<Map<string, string|null>> => {
441
+ const reverseMapping = new Map<string, string|null>();
442
+ const script = location.script();
443
+ if (!script) {
444
+ return reverseMapping;
445
+ }
446
+ if (!script.debuggerModel.target().targetManager().settings.moduleSetting('js-source-maps-enabled').get()) {
447
+ return reverseMapping;
448
+ }
441
449
 
442
- const scopeTreeAndText = await computeScopeTree(script);
443
- if (!scopeTreeAndText) {
444
- return reverseMapping;
445
- }
450
+ const scopeTreeAndText = await computeScopeTree(script);
451
+ if (!scopeTreeAndText) {
452
+ return reverseMapping;
453
+ }
446
454
 
447
- const {scopeTree, text} = scopeTreeAndText;
448
- const locationOffset = text.offsetFromPosition(location.lineNumber, location.columnNumber);
449
- const scopeChain = findScopeChain(scopeTree, {start: locationOffset, end: locationOffset});
450
- const compiledNames = new Set<string>();
451
-
452
- while (scopeChain.length > 0) {
453
- const {variableMapping} = await resolveScope(script, scopeChain);
454
- for (const [compiledName, originalName] of variableMapping) {
455
- if (!originalName) {
456
- continue;
457
- }
458
- if (!reverseMapping.has(originalName)) {
459
- // An inner scope might have shadowed {compiledName}. Mark it as "unavailable" in that case.
460
- const compiledNameOrNull = compiledNames.has(compiledName) ? null : compiledName;
461
- reverseMapping.set(originalName, compiledNameOrNull);
462
- }
463
- compiledNames.add(compiledName);
464
- }
465
- scopeChain.pop();
466
- }
467
- return reverseMapping;
468
- };
455
+ const {scopeTree, text} = scopeTreeAndText;
456
+ const locationOffset = text.offsetFromPosition(location.lineNumber, location.columnNumber);
457
+ const scopeChain = findScopeChain(scopeTree, {start: locationOffset, end: locationOffset});
458
+ const compiledNames = new Set<string>();
459
+
460
+ while (scopeChain.length > 0) {
461
+ const {variableMapping} = await resolveScope(script, scopeChain, debuggerWorkspaceBinding);
462
+ for (const [compiledName, originalName] of variableMapping) {
463
+ if (!originalName) {
464
+ continue;
465
+ }
466
+ if (!reverseMapping.has(originalName)) {
467
+ // An inner scope might have shadowed {compiledName}. Mark it as "unavailable" in that case.
468
+ const compiledNameOrNull = compiledNames.has(compiledName) ? null : compiledName;
469
+ reverseMapping.set(originalName, compiledNameOrNull);
470
+ }
471
+ compiledNames.add(compiledName);
472
+ }
473
+ scopeChain.pop();
474
+ }
475
+ return reverseMapping;
476
+ };
469
477
 
470
- export const resolveThisObject =
471
- async(callFrame: SDK.DebuggerModel.CallFrame): Promise<SDK.RemoteObject.RemoteObject|null> => {
478
+ export const resolveThisObject = async(
479
+ callFrame: SDK.DebuggerModel.CallFrame,
480
+ debuggerWorkspaceBinding:
481
+ Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding): Promise<SDK.RemoteObject.RemoteObject|null> => {
472
482
  const scopeChain = callFrame.scopeChain();
473
483
  if (scopeChain.length === 0) {
474
484
  return callFrame.thisObject();
475
485
  }
476
486
 
477
- const {thisMapping} = await resolveDebuggerScope(scopeChain[0]);
487
+ const {thisMapping} = await resolveDebuggerScope(scopeChain[0], debuggerWorkspaceBinding);
478
488
  if (!thisMapping) {
479
489
  return callFrame.thisObject();
480
490
  }
@@ -493,7 +503,9 @@ export const resolveThisObject =
493
503
  return null;
494
504
  };
495
505
 
496
- export const resolveScopeInObject = function(scope: SDK.DebuggerModel.ScopeChainEntry): SDK.RemoteObject.RemoteObject {
506
+ export const resolveScopeInObject = function(scope: SDK.DebuggerModel.ScopeChainEntry,
507
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding
508
+ .DebuggerWorkspaceBinding): SDK.RemoteObject.RemoteObject {
497
509
  const endLocation = scope.range()?.end;
498
510
  const startLocationScript = scope.range()?.start.script() ?? null;
499
511
 
@@ -502,7 +514,7 @@ export const resolveScopeInObject = function(scope: SDK.DebuggerModel.ScopeChain
502
514
  return scope.object();
503
515
  }
504
516
 
505
- return new RemoteObject(scope);
517
+ return new RemoteObject(scope, debuggerWorkspaceBinding);
506
518
  };
507
519
 
508
520
  /**
@@ -516,10 +528,13 @@ class ScopeWithSourceMappedVariables implements SDK.DebuggerModel.ScopeChainEntr
516
528
  readonly #debuggerScope: SDK.DebuggerModel.ScopeChainEntry;
517
529
  /** The resolved `this` of the current call frame */
518
530
  readonly #thisObject: SDK.RemoteObject.RemoteObject|null;
531
+ readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
519
532
 
520
- constructor(scope: SDK.DebuggerModel.ScopeChainEntry, thisObject: SDK.RemoteObject.RemoteObject|null) {
533
+ constructor(scope: SDK.DebuggerModel.ScopeChainEntry, thisObject: SDK.RemoteObject.RemoteObject|null,
534
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding) {
521
535
  this.#debuggerScope = scope;
522
536
  this.#thisObject = thisObject;
537
+ this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
523
538
  }
524
539
 
525
540
  callFrame(): SDK.DebuggerModel.CallFrame {
@@ -543,7 +558,7 @@ class ScopeWithSourceMappedVariables implements SDK.DebuggerModel.ScopeChainEntr
543
558
  }
544
559
 
545
560
  object(): SDK.RemoteObject.RemoteObject {
546
- return resolveScopeInObject(this.#debuggerScope);
561
+ return resolveScopeInObject(this.#debuggerScope, this.#debuggerWorkspaceBinding);
547
562
  }
548
563
 
549
564
  description(): string {
@@ -567,10 +582,14 @@ class ScopeWithSourceMappedVariables implements SDK.DebuggerModel.ScopeChainEntr
567
582
  export class RemoteObject extends SDK.RemoteObject.RemoteObject {
568
583
  private readonly scope: SDK.DebuggerModel.ScopeChainEntry;
569
584
  private readonly object: SDK.RemoteObject.RemoteObject;
570
- constructor(scope: SDK.DebuggerModel.ScopeChainEntry) {
585
+ readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
586
+
587
+ constructor(scope: SDK.DebuggerModel.ScopeChainEntry,
588
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding) {
571
589
  super();
572
590
  this.scope = scope;
573
591
  this.object = scope.object();
592
+ this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
574
593
  }
575
594
 
576
595
  override customPreview(): Protocol.Runtime.CustomPreview|null {
@@ -616,7 +635,7 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
616
635
  override async getAllProperties(accessorPropertiesOnly: boolean, generatePreview: boolean):
617
636
  Promise<SDK.RemoteObject.GetPropertiesResult> {
618
637
  const allProperties = await this.object.getAllProperties(accessorPropertiesOnly, generatePreview);
619
- const {variableMapping} = await resolveDebuggerScope(this.scope);
638
+ const {variableMapping} = await resolveDebuggerScope(this.scope, this.#debuggerWorkspaceBinding);
620
639
 
621
640
  const properties = allProperties.properties;
622
641
  const internalProperties = allProperties.internalProperties;
@@ -629,7 +648,7 @@ export class RemoteObject extends SDK.RemoteObject.RemoteObject {
629
648
 
630
649
  override async setPropertyValue(argumentName: string|Protocol.Runtime.CallArgument, value: string):
631
650
  Promise<string|undefined> {
632
- const {variableMapping} = await resolveDebuggerScope(this.scope);
651
+ const {variableMapping} = await resolveDebuggerScope(this.scope, this.#debuggerWorkspaceBinding);
633
652
 
634
653
  let name;
635
654
  if (typeof argumentName === 'string') {
@@ -735,8 +754,7 @@ export async function resolveDebuggerFrameFunctionName(frame: SDK.DebuggerModel.
735
754
 
736
755
  export async function resolveProfileFrameFunctionName(
737
756
  {scriptId, lineNumber, columnNumber}: Partial<Protocol.Runtime.CallFrame>, target: SDK.Target.Target|null,
738
- debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding =
739
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()): Promise<string|null> {
757
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding): Promise<string|null> {
740
758
  if (!target || lineNumber === undefined || columnNumber === undefined || scriptId === undefined) {
741
759
  return null;
742
760
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as SDK from '../../core/sdk/sdk.js';
7
+ import type * as Bindings from '../bindings/bindings.js';
7
8
 
8
9
  import {resolveScopeChain} from './NamesResolver.js';
9
10
 
@@ -21,14 +22,17 @@ import {resolveScopeChain} from './NamesResolver.js';
21
22
  */
22
23
  export class ScopeChainModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
23
24
  readonly #callFrame: SDK.DebuggerModel.CallFrame;
25
+ readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
24
26
 
25
27
  /** We use the `Throttler` here to make sure that `#boundUpdate` is not run multiple times simultanously */
26
28
  readonly #throttler = new Common.Throttler.Throttler(5);
27
29
  readonly #boundUpdate = this.#update.bind(this);
28
30
 
29
- constructor(callFrame: SDK.DebuggerModel.CallFrame) {
31
+ constructor(callFrame: SDK.DebuggerModel.CallFrame,
32
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding) {
30
33
  super();
31
34
  this.#callFrame = callFrame;
35
+ this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
32
36
  this.#callFrame.debuggerModel.addEventListener(
33
37
  SDK.DebuggerModel.Events.DebugInfoAttached, this.#debugInfoAttached, this);
34
38
  this.#callFrame.debuggerModel.sourceMapManager().addEventListener(
@@ -46,7 +50,7 @@ export class ScopeChainModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
46
50
  }
47
51
 
48
52
  async #update(): Promise<void> {
49
- const scopeChain = await resolveScopeChain(this.#callFrame);
53
+ const scopeChain = await resolveScopeChain(this.#callFrame, this.#debuggerWorkspaceBinding);
50
54
  this.dispatchEventToListeners(Events.SCOPE_CHAIN_UPDATED, new ScopeChain(scopeChain));
51
55
  }
52
56
 
@@ -17,7 +17,7 @@ import {
17
17
  FragmentImpl,
18
18
  FrameImpl,
19
19
  ParsedErrorStackFragmentImpl,
20
- StackTraceImpl
20
+ StackTraceImpl,
21
21
  } from './StackTraceImpl.js';
22
22
  import {EvalOrigin, type FrameNode, type RawFrame, Trie} from './Trie.js';
23
23
 
@@ -135,7 +135,7 @@ export function extractConsoleAPIExtensionEntries(): void {
135
135
  ph: Types.Events.Phase.COMPLETE,
136
136
  ts: entryStartTime,
137
137
  dur: Types.Timing.Micro(entryEndTime - entryStartTime),
138
- rawSourceEvent: currentTimeStamp
138
+ rawSourceEvent: currentTimeStamp,
139
139
  };
140
140
  const syntheticTimeStamp =
141
141
  Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticConsoleTimeStamp>(
@@ -171,7 +171,7 @@ function getEventTrack(event: Types.Events.SyntheticEventPair|Types.Events.Conso
171
171
  *
172
172
  */
173
173
  export function userTimingComparator<T extends Types.Events.SyntheticEventPair|Types.Events.ConsoleTimeStamp>(
174
- a: T, b: T, originalArray: readonly T[]): number {
174
+ a: T, b: T, originalIndex: ReadonlyMap<T, number>): number {
175
175
  const {start: aStart, end: aEnd} = getEventTimings(a);
176
176
  const {start: bStart, end: bEnd} = getEventTimings(b);
177
177
  const timeDifference = Helpers.Trace.compareBeginAndEnd(aStart, bStart, aEnd, bEnd);
@@ -186,9 +186,13 @@ export function userTimingComparator<T extends Types.Events.SyntheticEventPair|T
186
186
  return 0; // Preserve current positions.
187
187
  }
188
188
 
189
- // Prefer the event located in a further position in the original array.
190
- const aIndex = originalArray.indexOf(a);
191
- const bIndex = originalArray.indexOf(b);
189
+ // When events share the same timestamp, use their original array position
190
+ // to determine stacking order: children are appended after their parents,
191
+ // so reversing by index ensures children render on top.
192
+ // Uses a pre-computed index map for O(1) lookups instead of indexOf
193
+ // to keep the overall sort at O(N log N).
194
+ const aIndex = originalIndex.get(a) ?? -1;
195
+ const bIndex = originalIndex.get(b) ?? -1;
192
196
  return bIndex - aIndex;
193
197
  }
194
198
 
@@ -217,8 +221,15 @@ export function handleEvent(event: Types.Events.Event): void {
217
221
  export async function finalize(): Promise<void> {
218
222
  const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];
219
223
  syntheticEvents = Helpers.Trace.createMatchedSortedSyntheticEvents(asyncEvents);
220
- syntheticEvents = syntheticEvents.sort((a, b) => userTimingComparator(a, b, [...syntheticEvents]));
221
- timestampEvents = timestampEvents.sort((a, b) => userTimingComparator(a, b, [...timestampEvents]));
224
+
225
+ // Pre-compute event→index maps before sorting so the comparator can
226
+ // resolve original positions in O(1). This keeps the sort O(N log N)
227
+ // rather than O(N² log N) which would occur if the index were looked
228
+ // up via indexOf or if the array were re-spread per comparison.
229
+ const syntheticIndex = new Map(syntheticEvents.map((e, i) => [e, i] as const));
230
+ syntheticEvents = syntheticEvents.sort((a, b) => userTimingComparator(a, b, syntheticIndex));
231
+ const timestampIndex = new Map(timestampEvents.map((e, i) => [e, i] as const));
232
+ timestampEvents = timestampEvents.sort((a, b) => userTimingComparator(a, b, timestampIndex));
222
233
  }
223
234
 
224
235
  export function data(): UserTimingsData {
@@ -531,7 +531,7 @@ export class SamplesIntegrator {
531
531
  traceEvents: [cpuProfileEvent],
532
532
  metadata: {
533
533
  dataOrigin: Types.File.DataOrigin.CPU_PROFILE,
534
- }
534
+ },
535
535
  };
536
536
  }
537
537