chrome-devtools-frontend 1.0.1738725 → 1.0.1742811

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 (502) hide show
  1. package/.agents/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
  2. package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +44 -7
  3. package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +1 -1
  4. package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
  5. package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +1 -1
  6. package/.agents/skills/code-review/SKILL.md +23 -6
  7. package/.agents/skills/devtools-verification/SKILL.md +2 -1
  8. package/.agents/skills/migrate-chromium-test/SKILL.md +1 -0
  9. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -11
  10. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +41 -23
  11. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +12 -7
  12. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -0
  13. package/.agents/skills/ui-widgets/SKILL.md +22 -7
  14. package/.agents/skills/version-control/SKILL.md +10 -1
  15. package/.agents/skills/visual-regression-audit/SKILL.md +88 -0
  16. package/.gitallowed +2 -1
  17. package/.stylelintignore +1 -0
  18. package/.stylelintrc.json +5 -1
  19. package/AUTHORS +1 -0
  20. package/DIR_METADATA +2 -1
  21. package/PRESUBMIT_test.py +143 -0
  22. package/config/owner/INFRA_OWNERS +0 -1
  23. package/docs/contributing/infrastructure.md +2 -2
  24. package/docs/ui_engineering.md +14 -4
  25. package/eslint.config.mjs +119 -9
  26. package/front_end/application_tokens.css +0 -65
  27. package/front_end/core/host/AidaClient.ts +1 -1
  28. package/front_end/core/host/AidaClientTypes.ts +2 -0
  29. package/front_end/core/host/AidaErrors.ts +3 -3
  30. package/front_end/core/host/AidaGcaTranslation.ts +39 -0
  31. package/front_end/core/host/GcaClient.ts +32 -20
  32. package/front_end/core/host/GcaTypes.ts +4 -2
  33. package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
  34. package/front_end/core/i18n/DevToolsLocale.ts +0 -1
  35. package/front_end/core/sdk/DebuggerModel.ts +25 -13
  36. package/front_end/core/sdk/PreloadingModel.ts +2 -2
  37. package/front_end/core/sdk/RehydratingConnection.ts +59 -30
  38. package/front_end/core/sdk/SourceMap.ts +30 -3
  39. package/front_end/core/sdk/SourceMapRangeMappings.ts +57 -0
  40. package/front_end/core/sdk/StorageKeyManager.ts +0 -1
  41. package/front_end/core/sdk/Target.ts +6 -0
  42. package/front_end/core/sdk/TargetManager.ts +10 -4
  43. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +5 -9
  44. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +12 -2
  45. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +159 -52
  46. package/front_end/entrypoints/inspector_main/outermostTargetSelector.css +77 -25
  47. package/front_end/entrypoints/main/MainImpl.ts +32 -15
  48. package/front_end/models/ai_assistance/AiAgent2.ts +95 -46
  49. package/front_end/models/ai_assistance/AiConversation.ts +1 -1
  50. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
  51. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -2
  52. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
  53. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +1 -1
  54. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +5 -4
  55. package/front_end/models/ai_assistance/performance/AICallTree.ts +7 -9
  56. package/front_end/models/ai_assistance/performance/AIQueries.ts +4 -8
  57. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +11 -1
  58. package/front_end/models/ai_assistance/skills/lighthouse.md +1 -0
  59. package/front_end/models/ai_assistance/skills/network.md +3 -4
  60. package/front_end/models/ai_assistance/skills/sources.md +1 -2
  61. package/front_end/models/ai_assistance/skills/styling.md +3 -4
  62. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +11 -3
  63. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +84 -23
  64. package/front_end/models/ai_assistance/tools/ListSources.ts +41 -13
  65. package/front_end/models/badges/Badge.ts +0 -1
  66. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  67. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
  68. package/front_end/models/breakpoints/BreakpointManager.ts +2 -4
  69. package/front_end/models/breakpoints/RecurringPauseDetector.ts +140 -0
  70. package/front_end/models/breakpoints/breakpoints.ts +2 -1
  71. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +2 -2
  72. package/front_end/models/persistence/Automapping.ts +0 -1
  73. package/front_end/models/trace/Processor.ts +16 -7
  74. package/front_end/models/trace/README.md +17 -1
  75. package/front_end/models/trace/extras/ThirdParties.ts +4 -6
  76. package/front_end/models/trace/extras/TraceFilter.ts +16 -8
  77. package/front_end/models/trace/extras/TraceTree.ts +159 -125
  78. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -5
  79. package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
  80. package/front_end/models/trace/handlers/RendererHandler.ts +7 -6
  81. package/front_end/models/trace/handlers/SamplesHandler.ts +1 -1
  82. package/front_end/models/trace/handlers/types.ts +15 -0
  83. package/front_end/models/trace/helpers/Extensions.ts +1 -3
  84. package/front_end/models/trace/helpers/SamplesIntegrator.ts +155 -87
  85. package/front_end/models/trace/helpers/Trace.ts +19 -14
  86. package/front_end/models/trace/helpers/TreeHelpers.ts +38 -10
  87. package/front_end/models/trace/insights/SlowCSSSelector.ts +3 -3
  88. package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +19 -4
  89. package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -1
  90. package/front_end/models/web_mcp/WebMCPModel.ts +19 -9
  91. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +30 -3
  92. package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -4
  93. package/front_end/panels/ai_assistance/components/chatMessage.css +1 -22
  94. package/front_end/panels/ai_assistance/components/chatView.css +0 -180
  95. package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -19
  96. package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -1
  97. package/front_end/panels/ai_assistance/components/walkthroughView.css +0 -13
  98. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +3 -2
  99. package/front_end/panels/animation/AnimationTimeline.ts +5 -3
  100. package/front_end/panels/animation/animationTimeline.css +10 -8
  101. package/front_end/panels/application/ApplicationPanelSidebar.ts +14 -11
  102. package/front_end/panels/application/ApplicationPanelTreeElement.ts +66 -3
  103. package/front_end/panels/application/ReportingApiView.ts +0 -1
  104. package/front_end/panels/application/SubAppsView.ts +0 -1
  105. package/front_end/panels/application/WebMCPTreeElement.ts +3 -6
  106. package/front_end/panels/application/WebMCPView.ts +30 -0
  107. package/front_end/panels/application/components/ReportsGrid.ts +0 -1
  108. package/front_end/panels/application/components/backForwardCacheView.css +1 -8
  109. package/front_end/panels/application/components/permissionsPolicySection.css +2 -2
  110. package/front_end/panels/application/components/protocolHandlersView.css +46 -39
  111. package/front_end/panels/application/components/trustTokensView.css +0 -4
  112. package/front_end/panels/application/cookieItemsView.css +0 -7
  113. package/front_end/panels/application/indexedDBViews.css +0 -6
  114. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +0 -2
  115. package/front_end/panels/application/preloading/components/PreloadingString.ts +0 -1
  116. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -5
  117. package/front_end/panels/application/preloading/components/preloadingGrid.css +0 -9
  118. package/front_end/panels/application/resourcesPanel.css +0 -48
  119. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -9
  120. package/front_end/panels/application/serviceWorkersView.css +5 -4
  121. package/front_end/panels/application/storageView.css +0 -5
  122. package/front_end/panels/application/webMCPView.css +17 -0
  123. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +15 -20
  124. package/front_end/panels/changes/changesView.css +0 -5
  125. package/front_end/panels/common/ExtensionServer.ts +80 -10
  126. package/front_end/panels/console/ConsolePanel.ts +92 -18
  127. package/front_end/panels/console/consoleContextSelector.css +1 -8
  128. package/front_end/panels/console/consoleInsightTeaser.css +10 -17
  129. package/front_end/panels/console/consolePinPane.css +3 -1
  130. package/front_end/panels/console/consoleView.css +14 -18
  131. package/front_end/panels/coverage/coverageListView.css +0 -4
  132. package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -22
  133. package/front_end/panels/css_overview/cssOverviewStartView.css +0 -43
  134. package/front_end/panels/developer_resources/developerResourcesListView.css +0 -4
  135. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +52 -45
  136. package/front_end/panels/elements/LayoutPane.ts +1 -3
  137. package/front_end/panels/elements/PropertiesWidget.ts +26 -8
  138. package/front_end/panels/elements/PropertyRenderer.ts +45 -21
  139. package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -7
  140. package/front_end/panels/elements/StyleEditorWidget.ts +110 -63
  141. package/front_end/panels/elements/StylePropertiesSection.ts +18 -14
  142. package/front_end/panels/elements/StylePropertyTreeElement.ts +556 -527
  143. package/front_end/panels/elements/StylesContainer.ts +5 -6
  144. package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
  145. package/front_end/panels/elements/classesPaneWidget.css +3 -7
  146. package/front_end/panels/elements/components/CSSQuery.ts +6 -5
  147. package/front_end/panels/elements/components/CSSVariableValueView.ts +17 -4
  148. package/front_end/panels/elements/components/StylePropertyEditor.ts +178 -140
  149. package/front_end/panels/elements/components/cssQuery.css +1 -1
  150. package/front_end/panels/elements/components/stylePropertyEditor.css +60 -56
  151. package/front_end/panels/elements/layoutPane.css +2 -2
  152. package/front_end/panels/elements/metricsSidebarPane.css +7 -8
  153. package/front_end/panels/elements/platformFontsWidget.css +1 -1
  154. package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -12
  155. package/front_end/panels/elements/stylesSidebarPane.css +3 -5
  156. package/front_end/panels/emulation/deviceModeView.css +1 -1
  157. package/front_end/panels/event_listeners/EventListenersView.ts +9 -2
  158. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  159. package/front_end/panels/explain/components/consoleInsight.css +1 -7
  160. package/front_end/panels/issues/AffectedBlockedByResponseView.ts +88 -46
  161. package/front_end/panels/issues/AffectedHeavyAdView.ts +72 -43
  162. package/front_end/panels/issues/AffectedResourcesView.ts +81 -13
  163. package/front_end/panels/issues/GenericIssueDetailsView.ts +112 -32
  164. package/front_end/panels/issues/issues.ts +2 -0
  165. package/front_end/panels/issues/issuesTree.css +13 -43
  166. package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
  167. package/front_end/panels/layer_viewer/layerDetailsView.css +1 -1
  168. package/front_end/panels/layer_viewer/paintProfiler.css +4 -3
  169. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -6
  170. package/front_end/panels/lighthouse/lighthousePanel.css +0 -9
  171. package/front_end/panels/lighthouse/lighthouseStartView.css +5 -16
  172. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +0 -1
  173. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
  174. package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +2 -2
  175. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +2 -2
  176. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +1 -1
  177. package/front_end/panels/media/playerListView.css +1 -2
  178. package/front_end/panels/media/playerPropertiesView.css +1 -1
  179. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +4 -4
  180. package/front_end/panels/network/NetworkLogView.ts +603 -582
  181. package/front_end/panels/network/RequestCookiesView.ts +0 -1
  182. package/front_end/panels/network/RequestTimingView.ts +16 -2
  183. package/front_end/panels/network/networkConfigView.css +3 -4
  184. package/front_end/panels/network/networkLogView.css +363 -377
  185. package/front_end/panels/network/networkPanel.css +1 -7
  186. package/front_end/panels/network/networkTimingTable.css +12 -27
  187. package/front_end/panels/network/networkWaterfallColumn.css +1 -1
  188. package/front_end/panels/network/requestConditionsDrawer.css +0 -4
  189. package/front_end/panels/network/requestCookiesView.css +7 -1
  190. package/front_end/panels/network/requestPayloadTree.css +0 -4
  191. package/front_end/panels/profiler/HeapProfileView.ts +1 -3
  192. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -7
  193. package/front_end/panels/profiler/profilesPanel.css +0 -11
  194. package/front_end/panels/recorder/ControlButton.ts +1 -1
  195. package/front_end/panels/recorder/RecorderPanel.ts +1 -1
  196. package/front_end/panels/recorder/RecordingView.ts +32 -11
  197. package/front_end/panels/recorder/StepView.ts +31 -5
  198. package/front_end/panels/recorder/TimelineSection.ts +22 -6
  199. package/front_end/panels/recorder/controlButton.css +2 -9
  200. package/front_end/panels/recorder/createRecordingView.css +1 -1
  201. package/front_end/panels/recorder/recorderPanel.css +0 -9
  202. package/front_end/panels/recorder/recordingListView.css +4 -4
  203. package/front_end/panels/recorder/recordingView.css +44 -52
  204. package/front_end/panels/recorder/replaySection.css +2 -0
  205. package/front_end/panels/recorder/stepEditor.css +4 -4
  206. package/front_end/panels/recorder/stepView.css +47 -21
  207. package/front_end/panels/recorder/timelineSection.css +63 -83
  208. package/front_end/panels/screencast/ScreencastApp.ts +0 -1
  209. package/front_end/panels/search/searchView.css +1 -1
  210. package/front_end/panels/security/mainView.css +1 -1
  211. package/front_end/panels/security/originView.css +2 -2
  212. package/front_end/panels/sensors/SensorsView.ts +273 -361
  213. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +0 -1
  214. package/front_end/panels/settings/backendLinkingSettingsTab.css +7 -7
  215. package/front_end/panels/settings/components/syncSection.css +0 -1
  216. package/front_end/panels/settings/workspaceSettingsTab.css +0 -5
  217. package/front_end/panels/sources/CSSPlugin.ts +177 -98
  218. package/front_end/panels/sources/DebuggerPausedMessage.ts +100 -27
  219. package/front_end/panels/sources/NavigatorView.ts +926 -946
  220. package/front_end/panels/sources/SourcesPanel.ts +9 -2
  221. package/front_end/panels/sources/breakpointsView.css +6 -28
  222. package/front_end/panels/sources/components/HeadersView.css +2 -2
  223. package/front_end/panels/sources/debuggerPausedMessage.css +7 -0
  224. package/front_end/panels/sources/navigatorTree.css +7 -2
  225. package/front_end/panels/sources/sourcesNavigator.css +0 -9
  226. package/front_end/panels/sources/sourcesView.css +2 -1
  227. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -10
  228. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
  229. package/front_end/panels/timeline/EventsTimelineTreeView.ts +18 -5
  230. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +0 -10
  231. package/front_end/panels/timeline/ModificationsManager.ts +0 -1
  232. package/front_end/panels/timeline/ThreadAppender.ts +2 -6
  233. package/front_end/panels/timeline/TimelineController.ts +30 -26
  234. package/front_end/panels/timeline/TimelineDetailsView.ts +10 -9
  235. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +4 -16
  236. package/front_end/panels/timeline/TimelineMiniMap.ts +132 -54
  237. package/front_end/panels/timeline/TimelinePanel.ts +2 -2
  238. package/front_end/panels/timeline/TimelineTreeView.ts +63 -50
  239. package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
  240. package/front_end/panels/timeline/components/DetailsView.ts +7 -14
  241. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
  242. package/front_end/panels/timeline/components/NetworkTrackWidget.ts +5 -1
  243. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -6
  244. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -12
  245. package/front_end/panels/timeline/components/interactionBreakdown.css +1 -1
  246. package/front_end/panels/timeline/components/layoutShiftDetails.css +2 -9
  247. package/front_end/panels/timeline/components/liveMetricsView.css +0 -16
  248. package/front_end/panels/timeline/components/metricCard.css +1 -5
  249. package/front_end/panels/timeline/components/networkRequestDetails.css +3 -3
  250. package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
  251. package/front_end/panels/timeline/components/networkTrackWidget.css +1 -1
  252. package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
  253. package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
  254. package/front_end/panels/timeline/docs/profile_calls.md +7 -9
  255. package/front_end/panels/timeline/timelineDetailsView.css +1 -12
  256. package/front_end/panels/timeline/timelineFlamechartPopover.css +0 -4
  257. package/front_end/panels/timeline/timelineMiniMap.css +1 -4
  258. package/front_end/panels/timeline/timelinePanel.css +0 -4
  259. package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
  260. package/front_end/panels/timeline/timelineTreeView.css +0 -12
  261. package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
  262. package/front_end/panels/webauthn/webauthnPane.css +2 -8
  263. package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
  264. package/front_end/third_party/axe-core/README.chromium +2 -3
  265. package/front_end/third_party/chromium/README.chromium +1 -1
  266. package/front_end/third_party/puppeteer/README.chromium +2 -2
  267. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +328 -11
  268. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +907 -588
  269. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +119 -1
  270. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  272. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts +120 -1
  273. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
  274. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts +16 -1
  276. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js +5 -1
  278. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +26 -0
  280. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
  282. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +23 -3
  283. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  284. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +21 -14
  285. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  286. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts +5 -5
  287. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js +4 -4
  289. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts +6 -1
  291. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +158 -67
  293. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
  294. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js +1 -0
  296. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js.map +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
  298. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +3 -1
  299. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
  300. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.d.ts.map +1 -1
  301. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js +28 -5
  302. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js.map +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts +4 -0
  304. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  305. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.js +19 -11
  306. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.js.map +1 -1
  307. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts +2 -0
  308. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  309. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +17 -5
  310. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.d.ts.map +1 -1
  312. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.js +62 -4
  313. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.js.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.d.ts +29 -0
  315. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.d.ts.map +1 -0
  316. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.js +60 -0
  317. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.js.map +1 -0
  318. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +9 -1
  319. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  320. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +24 -9
  321. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  322. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.d.ts.map +1 -1
  323. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js +16 -7
  324. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js.map +1 -1
  325. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.d.ts +6 -0
  326. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.d.ts.map +1 -1
  327. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.js +37 -20
  328. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.js.map +1 -1
  329. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +2 -0
  330. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  331. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +10 -5
  332. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  333. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.d.ts.map +1 -1
  334. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.js +18 -1
  335. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.js.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.d.ts.map +1 -1
  337. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.js +24 -5
  338. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.js.map +1 -1
  339. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js +6 -4
  341. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  343. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.js +30 -6
  344. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  345. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts +2 -0
  346. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  347. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +3 -0
  348. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
  349. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts +5 -1
  350. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js +12 -2
  352. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js.map +1 -1
  353. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts +3 -0
  354. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
  355. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +40 -0
  356. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.d.ts +23 -1
  358. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.js +37 -0
  360. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.js.map +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts +2 -0
  362. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  363. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +74 -16
  364. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
  365. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +3 -2
  366. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  367. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +34 -23
  368. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  369. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.d.ts +10 -0
  370. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.d.ts.map +1 -0
  371. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.js +94 -0
  372. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.js.map +1 -0
  373. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts +2 -2
  374. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
  375. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js +29 -1
  376. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
  377. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
  378. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
  379. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
  380. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
  381. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.d.ts.map +1 -1
  382. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.js +6 -5
  383. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.js.map +1 -1
  384. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.d.ts +4 -0
  385. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  386. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.js.map +1 -1
  387. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts +4 -4
  388. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts.map +1 -1
  389. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +2 -2
  390. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
  391. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
  392. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +34 -15
  393. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
  394. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +3 -0
  395. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  396. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +11 -7
  397. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  398. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +10 -7
  399. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
  400. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  401. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  402. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/decorators.js.map +1 -1
  403. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  404. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  405. package/front_end/third_party/puppeteer/package/lib/types.d.ts +328 -11
  406. package/front_end/third_party/puppeteer/package/package.json +10 -8
  407. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +118 -0
  408. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +119 -0
  409. package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +25 -2
  410. package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +28 -0
  411. package/front_end/third_party/puppeteer/package/src/api/Page.ts +65 -38
  412. package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +27 -7
  413. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +43 -7
  414. package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +1 -0
  415. package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +5 -1
  416. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +38 -8
  417. package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +27 -12
  418. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +19 -6
  419. package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -5
  420. package/front_end/third_party/puppeteer/package/src/bidi/NetworkEvents.ts +82 -0
  421. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +37 -13
  422. package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +26 -14
  423. package/front_end/third_party/puppeteer/package/src/bidi/core/Browser.ts +43 -22
  424. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +13 -5
  425. package/front_end/third_party/puppeteer/package/src/bidi/core/Navigation.ts +21 -1
  426. package/front_end/third_party/puppeteer/package/src/bidi/core/Request.ts +27 -5
  427. package/front_end/third_party/puppeteer/package/src/cdp/Binding.ts +6 -4
  428. package/front_end/third_party/puppeteer/package/src/cdp/ExtensionTransport.ts +31 -6
  429. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +5 -0
  430. package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +18 -1
  431. package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +48 -0
  432. package/front_end/third_party/puppeteer/package/src/cdp/NetworkEventManager.ts +58 -5
  433. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +94 -14
  434. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +50 -28
  435. package/front_end/third_party/puppeteer/package/src/cdp/ResponseBodyStream.ts +106 -0
  436. package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +38 -3
  437. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  438. package/front_end/third_party/puppeteer/package/src/cdp/utils.ts +6 -5
  439. package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +5 -0
  440. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +17 -8
  441. package/front_end/third_party/puppeteer/package/src/common/util.ts +32 -15
  442. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +21 -13
  443. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +10 -10
  444. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  445. package/front_end/third_party/puppeteer/package/src/util/decorators.ts +1 -1
  446. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  447. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +2 -0
  448. package/front_end/ui/components/adorners/adorner.css +1 -1
  449. package/front_end/ui/components/buttons/button.css +0 -28
  450. package/front_end/ui/components/buttons/textButton.css +1 -45
  451. package/front_end/ui/components/diff_view/diffView.css +0 -2
  452. package/front_end/ui/components/input/checkbox.css +3 -3
  453. package/front_end/ui/components/issue_counter/issueLinkIcon.css +2 -2
  454. package/front_end/ui/components/menus/Menu.ts +14 -0
  455. package/front_end/ui/components/menus/menu.css +2 -14
  456. package/front_end/ui/components/menus/menuItem.css +0 -4
  457. package/front_end/ui/components/request_link_icon/requestLinkIcon.css +2 -2
  458. package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
  459. package/front_end/ui/components/survey_link/surveyLink.css +3 -3
  460. package/front_end/ui/components/switch/switch.css +3 -2
  461. package/front_end/ui/components/text_editor/theme.ts +1 -1
  462. package/front_end/ui/components/tooltips/Tooltip.ts +29 -0
  463. package/front_end/ui/components/tree_outline/treeOutline.css +1 -24
  464. package/front_end/ui/legacy/ContextMenu.ts +5 -5
  465. package/front_end/ui/legacy/SoftContextMenu.ts +24 -8
  466. package/front_end/ui/legacy/Toolbar.ts +1 -1
  467. package/front_end/ui/legacy/Treeoutline.ts +31 -78
  468. package/front_end/ui/legacy/UIUtils.ts +9 -17
  469. package/front_end/ui/legacy/checkboxTextLabel.css +2 -44
  470. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +39 -27
  471. package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -10
  472. package/front_end/ui/legacy/components/data_grid/dataGrid.css +2 -6
  473. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +34 -26
  474. package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
  475. package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +1 -1
  476. package/front_end/ui/legacy/components/inline_editor/swatchPopover.css +1 -1
  477. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +83 -21
  478. package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
  479. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +41 -14
  480. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -9
  481. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
  482. package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +2 -1
  483. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +0 -5
  484. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +6 -3
  485. package/front_end/ui/legacy/components/source_frame/JSONView.ts +95 -1
  486. package/front_end/ui/legacy/components/source_frame/imageView.css +2 -2
  487. package/front_end/ui/legacy/filter.css +7 -3
  488. package/front_end/ui/legacy/inspectorCommon.css +7 -81
  489. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
  490. package/front_end/ui/legacy/listWidget.css +2 -2
  491. package/front_end/ui/legacy/progressIndicator.css +1 -1
  492. package/front_end/ui/legacy/tabbedPane.css +6 -10
  493. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  494. package/front_end/ui/visual_logging/LoggingDriver.ts +4 -0
  495. package/front_end/ui/visual_logging/visual_logging.ts +1 -1
  496. package/inspector_overlay/common.ts +0 -3
  497. package/inspector_overlay/main.ts +1 -3
  498. package/inspector_overlay/tool_highlight.css +0 -7
  499. package/inspector_overlay/tool_highlight.ts +0 -1
  500. package/inspector_overlay/tool_source_order.css +0 -4
  501. package/package.json +1 -1
  502. package/front_end/generated/SupportedCSSProperties.ts +0 -9689
@@ -7,7 +7,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
7
7
  import * as Platform from '../../../core/platform/platform.js';
8
8
  import * as Root from '../../../core/root/root.js';
9
9
  import type {FunctionHandlerOptions} from '../agents/AiAgent.js';
10
- import {JavascriptExecutor} from '../agents/ExecuteJavascript.js';
10
+ import {JavascriptExecutor, MAX_OBSERVATION_BYTE_LENGTH} from '../agents/ExecuteJavascript.js';
11
11
 
12
12
  import {
13
13
  type BaseToolCapability,
@@ -25,7 +25,12 @@ import {
25
25
  const lockedString = i18n.i18n.lockedString;
26
26
 
27
27
  const MAX_LINES = 40;
28
- const MAX_LINE_LENGTH = 120;
28
+ // Deliberately higher than the 120-character soft target in
29
+ // `parameters.properties.code.description`: the prompt keeps the model aiming
30
+ // for <= 120 characters/line for readability, while this 160-character hard stop
31
+ // absorbs minor counting overshoots (`describeSizeLimitViolations()` reports 160
32
+ // when exceeded).
33
+ const MAX_LINE_LENGTH = 160;
29
34
  const MAX_TOTAL_CHARACTERS = 2500;
30
35
  const MAX_LONG_LINES_REPORTED = 3;
31
36
  const LONG_LINE_PREVIEW_LENGTH = 60;
@@ -127,6 +132,8 @@ export class ExecuteJavaScriptTool implements
127
132
  description: '',
128
133
  nullable: false,
129
134
  properties: {
135
+ // The `description` below purposefully states `max 120 characters per line`
136
+ // as a soft target, while `MAX_LINE_LENGTH` enforces 160 as the hard stop.
130
137
  code: {
131
138
  type: Host.AidaClient.ParametersTypes.STRING,
132
139
  description:
@@ -134,7 +141,8 @@ export class ExecuteJavaScriptTool implements
134
141
 
135
142
  # Instructions
136
143
 
137
- * To return data, define a top-level \`data\` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to \`data\`.
144
+ * To return data, define a top-level \`data\` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to \`data\`, and serialized output must not exceed ${
145
+ MAX_OBSERVATION_BYTE_LENGTH} bytes (return targeted properties or slices rather than full DOM subtrees).
138
146
  * $0 refers to the currently selected DOM node (or document body if none selected).
139
147
  * **CRITICAL** Do not call \`console\` methods (e.g., \`console.log\`, \`console.warn\`, \`console.error\`) by default when returning data via \`data\`.
140
148
  * **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.
@@ -2,9 +2,11 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as Common from '../../../core/common/common.js';
5
6
  import * as Host from '../../../core/host/host.js';
6
7
  import * as i18n from '../../../core/i18n/i18n.js';
7
- import type * as SDK from '../../../core/sdk/sdk.js';
8
+ import * as Platform from '../../../core/platform/platform.js';
9
+ import * as SDK from '../../../core/sdk/sdk.js';
8
10
  import * as Logs from '../../logs/logs.js';
9
11
  import {formatBytesToKb, seconds} from '../data_formatters/UnitFormatters.js';
10
12
 
@@ -25,24 +27,82 @@ const UIStringsNotTranslate = {
25
27
 
26
28
  const lockedString = i18n.i18n.lockedString;
27
29
 
28
- interface NetworkRequestSummary {
29
- id: string;
30
- url: string;
31
- statusCode: number;
32
- duration: string;
33
- transferSize: string;
30
+ /**
31
+ * Imported HAR sessions lock to a synthetic imported-har:// origin, so the real
32
+ * web origin must be extracted from the first request's documentURL.
33
+ */
34
+ function resolveBaseOrigin(establishedOrigin: SDK.SecurityOrigin.SecurityOrigin,
35
+ requestsToShow: SDK.NetworkRequest.NetworkRequest[]): string {
36
+ if (establishedOrigin.isFile()) {
37
+ return '';
38
+ }
39
+ for (const prefix of SDK.SecurityOrigin.IMPORTED_ORIGIN_PREFIXES) {
40
+ if (establishedOrigin.siteId().startsWith(prefix)) {
41
+ return Common.ParsedURL.ParsedURL.extractOrigin(requestsToShow[0].documentURL).toLowerCase();
42
+ }
43
+ }
44
+ return establishedOrigin.siteId();
45
+ }
46
+
47
+ /**
48
+ * Formats and shortens a request URL for a single row in the compact network table:
49
+ * 1. Strips newlines (`\r`, `\n`) so the URL stays on a single table line.
50
+ * 2. Truncates `data:` URLs over 80 chars, keeping the `<mediatype>,` header if under 60 chars.
51
+ * 3. Strips `baseOrigin` from same-origin URLs (when followed by `/`, `?`, `#`, or end-of-string).
52
+ * 4. Caps paths over 300 chars (dropping the query/hash) and `?query`/`#hash` suffixes over 100 chars.
53
+ */
54
+ function formatRequestUrl(rawUrl: string, baseOrigin: string): string {
55
+ // Semicolons remain unescaped because the trailing status;duration;size fields have fixed shapes.
56
+ let cleanUrl = rawUrl.replace(/[\r\n]+/g, '');
57
+ if (/^data:/i.test(cleanUrl)) {
58
+ if (cleanUrl.length <= 80) {
59
+ return cleanUrl;
60
+ }
61
+ const commaIndex = cleanUrl.indexOf(',');
62
+ let truncated: string;
63
+ if (commaIndex !== -1 && commaIndex < 60) {
64
+ truncated = cleanUrl.slice(0, commaIndex + 1);
65
+ } else {
66
+ truncated = Platform.StringUtilities.truncateToCodeUnitLength(cleanUrl, 60);
67
+ }
68
+ return truncated + '...<truncated>';
69
+ }
70
+
71
+ if (baseOrigin !== '' && cleanUrl.slice(0, baseOrigin.length).toLowerCase() === baseOrigin) {
72
+ const nextChar = cleanUrl[baseOrigin.length];
73
+ // Verifying a path/query/hash boundary prevents stripping the base origin
74
+ // from cross-origin hosts like https://example.com.evil.com/x or https://example.com:8443/x.
75
+ if (nextChar === undefined) {
76
+ cleanUrl = '/';
77
+ } else if (nextChar === '/') {
78
+ cleanUrl = cleanUrl.slice(baseOrigin.length);
79
+ } else if (nextChar === '?' || nextChar === '#') {
80
+ cleanUrl = '/' + cleanUrl.slice(baseOrigin.length);
81
+ }
82
+ }
83
+
84
+ const queryOrFragmentIndex = cleanUrl.search(/[?#]/);
85
+ const pathPart = queryOrFragmentIndex === -1 ? cleanUrl : cleanUrl.slice(0, queryOrFragmentIndex);
86
+ const suffixPart = queryOrFragmentIndex === -1 ? '' : cleanUrl.slice(queryOrFragmentIndex);
87
+ if (pathPart.length > 300) {
88
+ return Platform.StringUtilities.truncateToCodeUnitLength(pathPart, 300) + '...<truncated>';
89
+ }
90
+ if (suffixPart.length > 100) {
91
+ return pathPart + Platform.StringUtilities.truncateToCodeUnitLength(suffixPart, 100) + '...<truncated>';
92
+ }
93
+ return cleanUrl;
34
94
  }
35
95
 
36
96
  /**
37
97
  * A tool that lists all network requests recorded by DevTools.
38
- * Filters the list by the conversation's established origin to prevent cross-origin data exposure.
98
+ * Returns a compact semicolon-delimited table of requests initiated by the conversation's established origin.
39
99
  */
40
100
  export class ListNetworkRequestsTool implements
41
- DataTool<Record<string, never>, unknown, BaseToolCapability&OriginLockCapability> {
101
+ DataTool<Record<string, never>, string, BaseToolCapability&OriginLockCapability> {
42
102
  readonly name: ToolName = ToolName.LIST_NETWORK_REQUESTS;
43
103
  readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
44
104
  readonly description: string =
45
- 'Lists recorded network requests for the active origin, including request ID, URL, HTTP status code, duration, and transfer size.';
105
+ 'Returns a compact semicolon-delimited table of requests initiated by the conversation\'s established origin, including request ID, URL, HTTP status code, duration, and transfer size.';
46
106
 
47
107
  readonly #networkLog?: Logs.NetworkLog.NetworkLog;
48
108
 
@@ -70,13 +130,12 @@ export class ListNetworkRequestsTool implements
70
130
 
71
131
  /**
72
132
  * Handles the request to list network requests.
73
- * Returns requests matching the conversation's established origin, if set.
133
+ * Returns a compact semicolon-delimited table of requests initiated by the conversation's established origin.
74
134
  */
75
135
  async handler(
76
136
  _params: Record<string, never>,
77
137
  context: BaseToolCapability&OriginLockCapability,
78
- ): Promise<DataHandlerResult<unknown>> {
79
- const requests: NetworkRequestSummary[] = [];
138
+ ): Promise<DataHandlerResult<string>> {
80
139
  // A conversation is locked to an origin once the first query is made.
81
140
  // We only allow inspecting requests matching the conversation's established origin.
82
141
  const originLock = context.getOriginLock();
@@ -96,18 +155,10 @@ export class ListNetworkRequestsTool implements
96
155
  hasCrossOriginRequest = true;
97
156
  continue;
98
157
  }
99
-
100
- requests.push({
101
- id: request.requestId(),
102
- url: request.url(),
103
- statusCode: request.statusCode,
104
- duration: seconds(request.duration),
105
- transferSize: formatBytesToKb(request.transferSize),
106
- });
107
158
  requestsToShow.push(request);
108
159
  }
109
160
 
110
- if (requests.length === 0) {
161
+ if (requestsToShow.length === 0) {
111
162
  if (hasCrossOriginRequest) {
112
163
  return {
113
164
  error: `No requests showing with origin ${establishedOrigin.siteId()}. Tell the user to start a new chat`,
@@ -119,8 +170,18 @@ export class ListNetworkRequestsTool implements
119
170
  };
120
171
  }
121
172
 
173
+ const baseOrigin = resolveBaseOrigin(establishedOrigin, requestsToShow);
174
+ const HEADER = 'id;url;status;duration;size';
175
+ const lines = baseOrigin ? [`origin: ${baseOrigin} (omitted from same-origin /... URLs)`, HEADER] : [HEADER];
176
+ for (const request of requestsToShow) {
177
+ const id = request.requestId().replace(/[\r\n]+/g, '');
178
+ const url = formatRequestUrl(request.url(), baseOrigin);
179
+ lines.push(
180
+ `${id};${url};${request.statusCode};${seconds(request.duration)};${formatBytesToKb(request.transferSize)}`);
181
+ }
182
+
122
183
  return {
123
- result: JSON.stringify(requests),
184
+ result: lines.join('\n'),
124
185
  widgets: [{
125
186
  name: 'NETWORK_REQUESTS_LIST',
126
187
  data: {
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Host from '../../../core/host/host.js';
6
6
  import * as i18n from '../../../core/i18n/i18n.js';
7
+ import type * as SDK from '../../../core/sdk/sdk.js';
7
8
  import * as Workspace from '../../workspace/workspace.js';
8
9
 
9
10
  import {
@@ -24,17 +25,13 @@ const UIStringsNotTranslate = {
24
25
 
25
26
  const lockedString = i18n.i18n.lockedString;
26
27
 
27
- interface SourceSummary {
28
- id: number;
29
- name: string;
30
- }
31
-
32
28
  /**
33
29
  * A tool that lists all network source files in the workspace.
34
30
  * Each file is returned with its displayName and a unique session-based numeric ID.
31
+ * The output is a semicolon-delimited list with an `id;name` header.
35
32
  */
36
33
  export class ListSourcesTool implements
37
- DataTool<Record<string, never>, {files: SourceSummary[]}, BaseToolCapability&OriginLockCapability> {
34
+ DataTool<Record<string, never>, string, BaseToolCapability&OriginLockCapability> {
38
35
  readonly name: ToolName = ToolName.LIST_SOURCES;
39
36
  readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
40
37
  readonly description: string =
@@ -129,7 +126,7 @@ export class ListSourcesTool implements
129
126
  async handler(
130
127
  _params: Record<string, never>,
131
128
  context: BaseToolCapability&OriginLockCapability,
132
- ): Promise<DataHandlerResult<{files: SourceSummary[]}>> {
129
+ ): Promise<DataHandlerResult<string>> {
133
130
  const originLock = context.getOriginLock();
134
131
  const originResult = resolveOriginFromLock(originLock);
135
132
  if ('error' in originResult) {
@@ -138,13 +135,44 @@ export class ListSourcesTool implements
138
135
 
139
136
  const files = ListSourcesTool.getUISourceCodes(originLock);
140
137
 
138
+ if (files.length === 0) {
139
+ return {
140
+ result: 'No source files found for the current origin.',
141
+ };
142
+ }
143
+
144
+ const establishedOrigin = originResult.origin;
145
+
146
+ const rows = files.map(file => {
147
+ const id = ListSourcesTool.uiSourceCodeId.get(file) ?? 0;
148
+ const name = formatSourceName(file, establishedOrigin);
149
+ return `${id};${name}`;
150
+ });
151
+
141
152
  return {
142
- result: {
143
- files: files.map(file => ({
144
- id: ListSourcesTool.uiSourceCodeId.get(file) ?? 0,
145
- name: file.fullDisplayName(),
146
- })),
147
- },
153
+ result: ['id;name', ...rows].join('\n'),
148
154
  };
149
155
  }
150
156
  }
157
+
158
+ /**
159
+ * Formats a source file name for the `listSources` output.
160
+ *
161
+ * `fullDisplayName()` already strips `https?://` for network files while keeping the host,
162
+ * and decodes URI sequences (`%0D`, `%0A`) into raw `\r` and `\n`. Re-encode carriage returns
163
+ * and newlines so filenames cannot break the line-delimited `id;name` output.
164
+ */
165
+ function formatSourceName(
166
+ file: Workspace.UISourceCode.UISourceCode,
167
+ establishedOrigin: SDK.SecurityOrigin.SecurityOrigin,
168
+ ): string {
169
+ const fullName = file.fullDisplayName().replace(/\r/g, '%0D').replace(/\n/g, '%0A');
170
+ const siteId = establishedOrigin.siteId();
171
+ if (/^https?:\/\//.test(siteId) && file.origin().toLowerCase() === siteId) {
172
+ const hostPrefix = siteId.replace(/^https?:\/\//, '');
173
+ if (fullName.slice(0, hostPrefix.length).toLowerCase() === hostPrefix && fullName[hostPrefix.length] === '/') {
174
+ return fullName.slice(hostPrefix.length);
175
+ }
176
+ }
177
+ return fullName;
178
+ }
@@ -11,7 +11,6 @@ export enum BadgeAction {
11
11
  DOM_ELEMENT_OR_ATTRIBUTE_EDITED = 'dom-element-or-attribute-edited',
12
12
  MODERN_DOM_BADGE_CLICKED = 'modern-dom-badge-clicked',
13
13
  STARTED_AI_CONVERSATION = 'started-ai-conversation',
14
- // TODO(ergunsh): Instrument performance insight clicks.
15
14
  PERFORMANCE_INSIGHT_CLICKED = 'performance-insight-clicked',
16
15
  DEBUGGER_PAUSED = 'debugger-paused',
17
16
  BREAKPOINT_ADDED = 'breakpoint-added',
@@ -342,7 +342,7 @@ export class ResourceMapping implements SDK.TargetManager.SDKModelObserver<SDK.R
342
342
  endPosition.columnNumber += script.columnOffset;
343
343
  }
344
344
 
345
- const name = ''; // TODO(crbug.com/452333154): update ScopeVariableAnalysis to include function name.
345
+ const name = result.name ?? '';
346
346
  const range = new TextUtils.TextRange.TextRange(
347
347
  startPosition.lineNumber, startPosition.columnNumber, endPosition.lineNumber, endPosition.columnNumber);
348
348
  return new Workspace.UISourceCode.UIFunctionBounds(uiSourceCode, range, name);
@@ -218,7 +218,7 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
218
218
  const startPosition = scopeTreeAndText.text.positionFromOffset(result.start);
219
219
  const endPosition = scopeTreeAndText.text.positionFromOffset(result.end);
220
220
 
221
- const name = ''; // TODO(crbug.com/452333154): update ScopeVariableAnalysis to include function name.
221
+ const name = result.name ?? '';
222
222
  const range = new TextUtils.TextRange.TextRange(
223
223
  startPosition.lineNumber, startPosition.columnNumber, endPosition.lineNumber, endPosition.columnNumber);
224
224
  return new Workspace.UISourceCode.UIFunctionBounds(uiSourceCode, range, name);
@@ -1077,10 +1077,8 @@ export class ModelBreakpoint {
1077
1077
  const maybeRescheduleUpdate =
1078
1078
  serverError && this.#debuggerModel.debuggerEnabled() && !this.#debuggerModel.isReadyToPause();
1079
1079
  if (!breakpointIds.length && maybeRescheduleUpdate) {
1080
- // TODO(crbug.com/1229541): This is a quickfix to prevent #breakpoints from
1081
- // disappearing if the Debugger is actually not enabled
1082
- // yet. This quickfix should be removed as soon as we have a solution
1083
- // to correctly synchronize the front-end with the inspector back-end.
1080
+ // Prevent #breakpoints from disappearing if the Debugger is not
1081
+ // ready to pause yet.
1084
1082
  return DebuggerUpdateResult.PENDING;
1085
1083
  }
1086
1084
 
@@ -0,0 +1,140 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import type * as Common from '../../core/common/common.js';
6
+ import * as SDK from '../../core/sdk/sdk.js';
7
+ import * as Protocol from '../../generated/protocol.js';
8
+ import type * as Bindings from '../bindings/bindings.js';
9
+
10
+ import {type BreakpointManager, BreakpointOrigin, NEVER_PAUSE_HERE_CONDITION} from './BreakpointManager.js';
11
+
12
+ export const RECURRING_PAUSE_WINDOW_MS = 10_000;
13
+ const RECURRING_PAUSE_THRESHOLD = 2;
14
+
15
+ const NON_RECURRING_PAUSE_REASONS = new Set<Protocol.Debugger.PausedEventReason>([
16
+ Protocol.Debugger.PausedEventReason.Step,
17
+ Protocol.Debugger.PausedEventReason.OOM,
18
+ ]);
19
+
20
+ const NEVER_PAUSE_HERE_REASONS = new Set<Protocol.Debugger.PausedEventReason>([
21
+ Protocol.Debugger.PausedEventReason.Ambiguous,
22
+ Protocol.Debugger.PausedEventReason.DebugCommand,
23
+ Protocol.Debugger.PausedEventReason.Exception,
24
+ Protocol.Debugger.PausedEventReason.Other,
25
+ Protocol.Debugger.PausedEventReason.PromiseRejection,
26
+ ]);
27
+
28
+ export interface RecurringPauseActions {
29
+ disableBreakpoint?: () => Promise<void>;
30
+ neverPauseHere?: () => Promise<void>;
31
+ deactivateBreakpointsAndResume?: () => void;
32
+ }
33
+
34
+ export class RecurringPauseDetector {
35
+ readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
36
+ readonly #breakpointManager: BreakpointManager;
37
+ readonly #breakpointsActiveSetting: Common.Settings.Setting<boolean>;
38
+ #lastPausedDetails: SDK.DebuggerModel.DebuggerPausedDetails|null = null;
39
+ #lastPauseLocationKey: string|null = null;
40
+ #lastPauseTimestamp = -Infinity;
41
+ #recurringPauseCount = 0;
42
+
43
+ constructor(
44
+ debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding,
45
+ breakpointManager: BreakpointManager,
46
+ settings: Common.Settings.Settings,
47
+ ) {
48
+ this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
49
+ this.#breakpointManager = breakpointManager;
50
+ this.#breakpointsActiveSetting = settings.resolve(SDK.SDKSettings.breakpointsActiveSettingDescriptor);
51
+ }
52
+
53
+ async onPaused(details: SDK.DebuggerModel.DebuggerPausedDetails|null): Promise<RecurringPauseActions> {
54
+ if (!details) {
55
+ this.#lastPausedDetails = null;
56
+ return {};
57
+ }
58
+
59
+ const locationKey = RecurringPauseDetector.#computeLocationKey(details);
60
+ if (details !== this.#lastPausedDetails) {
61
+ this.#lastPausedDetails = details;
62
+ const now = Date.now();
63
+ if (locationKey !== null && locationKey === this.#lastPauseLocationKey &&
64
+ now - this.#lastPauseTimestamp <= RECURRING_PAUSE_WINDOW_MS) {
65
+ this.#recurringPauseCount++;
66
+ } else {
67
+ this.#lastPauseLocationKey = locationKey;
68
+ this.#recurringPauseCount = locationKey !== null ? 1 : 0;
69
+ }
70
+ this.#lastPauseTimestamp = now;
71
+ }
72
+
73
+ if (this.#recurringPauseCount < RECURRING_PAUSE_THRESHOLD) {
74
+ return {};
75
+ }
76
+
77
+ const rawLocation = details.callFrames[0]?.location() ?? null;
78
+ const uiLocation = rawLocation ? await this.#debuggerWorkspaceBinding.rawLocationToUILocation(rawLocation) : null;
79
+ if (details !== this.#lastPausedDetails) {
80
+ return {};
81
+ }
82
+
83
+ const actions: RecurringPauseActions = {};
84
+ const existingBreakpoint = uiLocation ? this.#breakpointManager.findBreakpoint(uiLocation)?.breakpoint : null;
85
+ if (existingBreakpoint?.enabled()) {
86
+ actions.disableBreakpoint = async () => {
87
+ if (!details.debuggerModel.isPaused()) {
88
+ return;
89
+ }
90
+ existingBreakpoint.setEnabled(false);
91
+ await existingBreakpoint.updateBreakpoint();
92
+ if (details.debuggerModel.isPaused()) {
93
+ details.debuggerModel.resume();
94
+ }
95
+ };
96
+ } else if (!existingBreakpoint && uiLocation && NEVER_PAUSE_HERE_REASONS.has(details.reason) &&
97
+ this.#breakpointManager.supportsConditionalBreakpoints(uiLocation.uiSourceCode)) {
98
+ actions.neverPauseHere = async () => {
99
+ if (!details.debuggerModel.isPaused()) {
100
+ return;
101
+ }
102
+ this.#breakpointsActiveSetting.set(true);
103
+ if (!this.#breakpointManager.findBreakpoint(uiLocation)) {
104
+ const breakpoint = await this.#breakpointManager.setBreakpoint(
105
+ uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, NEVER_PAUSE_HERE_CONDITION,
106
+ /* enabled */ true, /* isLogpoint */ false, BreakpointOrigin.USER_ACTION);
107
+ await breakpoint?.updateBreakpoint();
108
+ }
109
+ if (details.debuggerModel.isPaused()) {
110
+ details.debuggerModel.resume();
111
+ }
112
+ };
113
+ }
114
+
115
+ if (this.#breakpointsActiveSetting.get()) {
116
+ actions.deactivateBreakpointsAndResume = () => {
117
+ this.#breakpointsActiveSetting.set(false);
118
+ if (details.debuggerModel.isPaused()) {
119
+ details.debuggerModel.resume();
120
+ }
121
+ };
122
+ }
123
+
124
+ return actions;
125
+ }
126
+
127
+ static #computeLocationKey(details: SDK.DebuggerModel.DebuggerPausedDetails): string|null {
128
+ if (NON_RECURRING_PAUSE_REASONS.has(details.reason)) {
129
+ return null;
130
+ }
131
+ const targetId = details.debuggerModel.target()?.id() ?? '';
132
+ const rawLocation = details.callFrames[0]?.location();
133
+ if (rawLocation) {
134
+ return `${targetId}:${rawLocation.scriptId}:${rawLocation.lineNumber}:${rawLocation.columnNumber}`;
135
+ }
136
+ const auxDiscriminator =
137
+ String(details.auxData?.['url'] ?? details.auxData?.['eventName'] ?? details.auxData?.['violationType'] ?? '');
138
+ return `${targetId}:${details.reason}:${auxDiscriminator}`;
139
+ }
140
+ }
@@ -3,5 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as BreakpointManager from './BreakpointManager.js';
6
+ import * as RecurringPauseDetector from './RecurringPauseDetector.js';
6
7
 
7
- export {BreakpointManager};
8
+ export {BreakpointManager, RecurringPauseDetector};
@@ -419,8 +419,8 @@ export interface ScriptWithoutScopes {
419
419
  }
420
420
 
421
421
  export interface HeapQueryOptions {
422
- className?: string;
423
- propertyName?: string;
422
+ className?: string|RegExp;
423
+ propertyName?: string|RegExp;
424
424
  nodeType?: string;
425
425
  minRetainedSize?: number;
426
426
  maxRetainedSize?: number;
@@ -265,7 +265,6 @@ export class Automapping {
265
265
  this.#sourceCodeToProcessingPromiseMap.delete(networkSourceCode);
266
266
  return;
267
267
  }
268
- // TODO(lushnikov): remove this check once there's a single uiSourceCode per url. @see crbug.com/670180
269
268
  if (this.#sourceCodeToAutoMappingStatusMap.has(status.network) ||
270
269
  this.#sourceCodeToAutoMappingStatusMap.has(status.fileSystem)) {
271
270
  this.#sourceCodeToProcessingPromiseMap.delete(networkSourceCode);
@@ -137,16 +137,20 @@ export class TraceProcessor extends EventTarget {
137
137
  throw new Error('Trace processor can\'t reset while parsing.');
138
138
  }
139
139
 
140
- const handlers = Object.values(this.#traceHandlers);
141
- for (const handler of handlers) {
142
- handler.reset();
143
- }
140
+ this.#resetHandlers();
141
+ Lantern.Simulation.Simulator.allNodeTimings.clear();
144
142
 
145
143
  this.#data = null;
146
144
  this.#insights = null;
147
145
  this.#status = Status.IDLE;
148
146
  }
149
147
 
148
+ #resetHandlers(): void {
149
+ for (const handler of Object.values(this.#traceHandlers)) {
150
+ handler.reset();
151
+ }
152
+ }
153
+
150
154
  async parse(traceEvents: readonly Types.Events.Event[], options: Types.Configuration.ParseOptions): Promise<void> {
151
155
  if (this.#status !== Status.IDLE) {
152
156
  throw new Error(`Trace processor can't start parsing when not idle. Current state: ${this.#status}`);
@@ -172,6 +176,13 @@ export class TraceProcessor extends EventTarget {
172
176
  this.#status = Status.ERRORED_WHILE_PARSING;
173
177
  throw e;
174
178
  } finally {
179
+ // Handler state is module-level, so it is a second reference to the trace.
180
+ // Resetting here releases it, including after a failed parse. `#data`
181
+ // keeps the trace intact because every handler's reset() assigns new
182
+ // containers. Lantern simulation timings are also module-level and are
183
+ // cleared here to avoid retaining the dependency graph.
184
+ this.#resetHandlers();
185
+ Lantern.Simulation.Simulator.allNodeTimings.clear();
175
186
  options.logger?.end('total');
176
187
  }
177
188
  }
@@ -194,9 +205,7 @@ export class TraceProcessor extends EventTarget {
194
205
  const sortedHandlers = [...sortHandlers(this.#traceHandlers).entries()];
195
206
 
196
207
  // Reset.
197
- for (const [, handler] of sortedHandlers) {
198
- handler.reset();
199
- }
208
+ this.#resetHandlers();
200
209
 
201
210
  options.logger?.start('parse:handleEvent');
202
211
 
@@ -39,7 +39,7 @@ This folder contains the new trace engine that was first implemented for the Per
39
39
 
40
40
  All the processing is done by the `Processor`. The processor contains a series of *Handlers*, each of which is responsible for parsing events of a particular category.
41
41
 
42
- The trace processor loops over every event in the trace and calls each handler in turn (done this way so we only loop over the trace file once, rather than doing it once-per-handler). A Handler is a file that exposes a set of methods, most importantly `handleEvent()` and `data()`. The `handleEvent` function will be called for each event in the trace, and it is up to an individual handler to do something with that event if it needs to. The `data` method should return the final data that has been parsed and generated by the handler.
42
+ The trace processor loops over every event in the trace and calls each handler in turn (done this way so we only loop over the trace file once, rather than doing it once-per-handler). A Handler is a file that exposes a set of methods, most importantly `handleEvent()` and `data()`. The `handleEvent` function will be called for each event in the trace, and it is up to an individual handler to do something with that event if it needs to. The `data` method should return the final data that has been parsed and generated by the handler. The processor reads `data()` once, after every handler has finalized.
43
43
 
44
44
  Once processing is done (read on for more details on how to track this), you can use the `parsedTrace()` method to fetch the result of parsing a given trace.
45
45
 
@@ -99,6 +99,22 @@ The object returned from `parsedTrace()` is an object of key-value pairs where e
99
99
  }
100
100
  ```
101
101
 
102
+ ## Handler state after a parse
103
+
104
+ Handlers keep state in module-level variables, and every processor shares that state. The processor resets every handler before a parse and again when `parse()` finishes, including when the parse throws. After `parse()`, only the parsed trace holds the data.
105
+
106
+ Consumers must read `Model#parsedTrace()` (or `TraceProcessor#data`), never `Handlers.ModelHandlers.X.data()`.
107
+
108
+ Rules for handler authors: `reset()` assigns new containers; `finalize()` may release only intermediate state that is not exported.
109
+ Correct `reset()`:
110
+ ```ts
111
+ processes = new Map();
112
+ ```
113
+ Incorrect `reset()` (empties exported containers in place):
114
+ ```ts
115
+ processes.clear();
116
+ ```
117
+
102
118
  ## Pairing begin & end events
103
119
 
104
120
  Note: this detail is not useful if you are using the Trace Engine, but it is if you are working on it.
@@ -98,7 +98,7 @@ function summarizeBottomUpByEntity(
98
98
  // the bottom up tree. The mapper will give us all related events.
99
99
  const summary: EntitySummary = {
100
100
  transferSize: node.transferSize,
101
- mainThreadTime: Types.Timing.Milli(node.selfTime),
101
+ mainThreadTime: Helpers.Timing.microToMilli(node.selfTime),
102
102
  entity,
103
103
  relatedEvents: data.Renderer.entityMappings.eventsByEntity.get(entity) ?? [],
104
104
  };
@@ -132,7 +132,7 @@ function summarizeBottomUpByURL(root: TraceTree.BottomUpRootNode, data: Handlers
132
132
  url,
133
133
  entity,
134
134
  transferSize: node.transferSize,
135
- mainThreadTime: Types.Timing.Milli(node.selfTime),
135
+ mainThreadTime: Helpers.Timing.microToMilli(node.selfTime),
136
136
  };
137
137
  summaries.push(summary);
138
138
  }
@@ -149,13 +149,11 @@ function getBottomUpTree(
149
149
  mainThreadEvents: Types.Events.Event[], tracebounds: Types.Timing.TraceWindowMicro,
150
150
  groupingFunction: ((arg0: Types.Events.Event) => string)|null): TraceTree.BottomUpRootNode {
151
151
  // The bottom up root node handles all the "in Tracebounds" checks we need for the insight.
152
- const startTime = Helpers.Timing.microToMilli(tracebounds.min);
153
- const endTime = Helpers.Timing.microToMilli(tracebounds.max);
154
152
  return new TraceTree.BottomUpRootNode(mainThreadEvents, {
155
153
  textFilter: exclusiveNameFilter,
156
154
  filters: [visibleEventsFilter],
157
- startTime,
158
- endTime,
155
+ startTime: tracebounds.min,
156
+ endTime: tracebounds.max,
159
157
  eventGroupIdCallback: groupingFunction,
160
158
  calculateTransferSize: true,
161
159
  // Ensure we group by 3P alongside eventID for correct 3P grouping.
@@ -10,6 +10,9 @@ export abstract class TraceFilter {
10
10
  }
11
11
 
12
12
  export class VisibleEventsFilter extends TraceFilter {
13
+ // Real traces contain ~15 distinct category strings; memoizing the substring
14
+ // checks avoids scanning event.cat on every event in hot tree-build loops.
15
+ static #categoryToEventName = new Map<string, Types.Events.Name|null>();
13
16
  private readonly visibleTypes: Set<string>;
14
17
  constructor(visibleTypes: string[]) {
15
18
  super();
@@ -24,15 +27,20 @@ export class VisibleEventsFilter extends TraceFilter {
24
27
  }
25
28
 
26
29
  static eventType(event: Types.Events.Event): Types.Events.Name {
27
- // Any blink.console category events are treated as ConsoleTime events
28
- if (event.cat.includes('blink.console')) {
29
- return Types.Events.Name.CONSOLE_TIME;
30
+ let type = VisibleEventsFilter.#categoryToEventName.get(event.cat);
31
+ if (type === undefined) {
32
+ if (event.cat.includes('blink.console')) {
33
+ type = Types.Events.Name.CONSOLE_TIME;
34
+ } else if (event.cat.includes('blink.user_timing')) {
35
+ type = Types.Events.Name.USER_TIMING;
36
+ } else {
37
+ type = null;
38
+ }
39
+ if (VisibleEventsFilter.#categoryToEventName.size < 256) {
40
+ VisibleEventsFilter.#categoryToEventName.set(event.cat, type);
41
+ }
30
42
  }
31
- // Any blink.user_timing egory events are treated as UserTiming events
32
- if (event.cat.includes('blink.user_timing')) {
33
- return Types.Events.Name.USER_TIMING;
34
- }
35
- return event.name as Types.Events.Name;
43
+ return type ?? (event.name as Types.Events.Name);
36
44
  }
37
45
  }
38
46