chrome-devtools-frontend 1.0.1717196 → 1.0.1721762

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 (381) hide show
  1. package/.agents/rules/models-and-core/core-ai-agent-context-and-prompt-discipline.md +29 -0
  2. package/.agents/rules/models-and-core/core-cdp-and-extension-error-handling.md +34 -0
  3. package/.agents/rules/models-and-core/core-gn-build-and-module-layering.md +23 -0
  4. package/.agents/rules/models-and-core/core-runtime-neutrality-and-platform-utils.md +28 -0
  5. package/.agents/rules/models-and-core/core-sdk-model-and-target-lifecycle.md +35 -0
  6. package/.agents/rules/models-and-core/core-security-origin-and-capability-guards.md +33 -0
  7. package/.agents/rules/models-and-core/core-settings-and-storage-migration.md +31 -0
  8. package/.agents/rules/models-and-core/core-sourcemap-and-workspace-mapping.md +28 -0
  9. package/.agents/rules/models-and-core/core-trace-engine-handler-invariants.md +32 -0
  10. package/.agents/rules/models-and-core/core-trace-insight-models-and-timing-types.md +28 -0
  11. package/.agents/rules/tests/test-cleanup-mutated-globals-and-widgets.md +40 -0
  12. package/.agents/rules/tests/test-deterministic-async-synchronization.md +30 -0
  13. package/.agents/rules/tests/test-modular-hooks-and-test-universe.md +38 -0
  14. package/.agents/rules/tests/test-public-api-and-encapsulation.md +30 -0
  15. package/.agents/rules/tests/test-shared-fixture-and-helper-reuse.md +29 -0
  16. package/.agents/rules/tests/test-single-responsibility-and-conciseness.md +37 -0
  17. package/.agents/rules/tests/test-strict-assertions-and-literal-expectations.md +31 -0
  18. package/.agents/rules/tests/test-type-safe-mocks-and-events.md +30 -0
  19. package/.agents/rules/tests/test-view-and-presenter-isolation.md +32 -0
  20. package/.agents/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +32 -0
  21. package/.agents/rules/ui-and-widgets/ui-await-update-complete-post-render.md +30 -0
  22. package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +27 -0
  23. package/.agents/rules/ui-and-widgets/ui-declarative-child-widget-composition.md +29 -0
  24. package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +33 -0
  25. package/.agents/rules/ui-and-widgets/ui-localization-and-uistrings-hygiene.md +36 -0
  26. package/.agents/rules/ui-and-widgets/ui-modern-component-and-encapsulation-standards.md +32 -0
  27. package/.agents/rules/ui-and-widgets/ui-panel-and-meta-registration.md +35 -0
  28. package/.agents/rules/ui-and-widgets/ui-performance-and-flamechart-rendering.md +34 -0
  29. package/.agents/rules/ui-and-widgets/ui-pure-view-and-presenter-separation.md +31 -0
  30. package/.agents/rules/ui-and-widgets/ui-reactive-widget-update-lifecycle.md +34 -0
  31. package/.agents/rules/ui-and-widgets/ui-security-and-output-sanitization.md +28 -0
  32. package/.agents/rules/ui-and-widgets/ui-type-safety-and-exhaustiveness.md +37 -0
  33. package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +35 -0
  34. package/.agents/rules/ui-and-widgets/ui-visual-logging-instrumentation.md +29 -0
  35. package/.agents/rules/ui-and-widgets/ui-weak-dom-references-and-observer-cleanup.md +29 -0
  36. package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +38 -0
  37. package/.agents/skills/code-review/SKILL.md +3 -0
  38. package/.agents/skills/devtools-testing-guidance/SKILL.md +5 -2
  39. package/.agents/skills/review-models-core/SKILL.md +73 -0
  40. package/.agents/skills/review-tests/SKILL.md +67 -0
  41. package/.agents/skills/review-ui-widgets/SKILL.md +115 -0
  42. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +73 -9
  43. package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +27 -3
  44. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +32 -2
  45. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +37 -7
  46. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +6 -5
  47. package/.agents/skills/ui-widgets/SKILL.md +11 -9
  48. package/AUTHORS +3 -0
  49. package/DIR_METADATA +51 -1
  50. package/docs/ui_engineering.md +34 -0
  51. package/eslint.config.mjs +63 -21
  52. package/front_end/core/common/Settings.ts +5 -0
  53. package/front_end/core/host/UserMetricsEnums.ts +1 -0
  54. package/front_end/core/platform/api/HostRuntime.ts +1 -0
  55. package/front_end/core/platform/browser/HostRuntime.ts +10 -0
  56. package/front_end/core/platform/node/HostRuntime.ts +1 -0
  57. package/front_end/core/sdk/CSSMatchedStyles.ts +60 -20
  58. package/front_end/core/sdk/CSSModel.ts +21 -0
  59. package/front_end/core/sdk/CSSProperty.ts +2 -2
  60. package/front_end/core/sdk/CSSPropertyParser.ts +11 -2
  61. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +28 -9
  62. package/front_end/core/sdk/DOMModel.ts +1 -1
  63. package/front_end/core/sdk/DebuggerModel.ts +3 -0
  64. package/front_end/core/sdk/EmulationModel.ts +40 -39
  65. package/front_end/core/sdk/NetworkManager.ts +10 -3
  66. package/front_end/core/sdk/NetworkRequest.ts +21 -0
  67. package/front_end/core/sdk/OverlayModel.ts +2 -8
  68. package/front_end/core/sdk/PrivateVerificationTokensModel.ts +79 -0
  69. package/front_end/core/sdk/RuntimeModel.ts +8 -3
  70. package/front_end/core/sdk/SecurityOrigin.ts +1 -1
  71. package/front_end/core/sdk/SourceMapCache.ts +20 -15
  72. package/front_end/core/sdk/SourceMapManager.ts +28 -9
  73. package/front_end/core/sdk/TargetManager.ts +7 -4
  74. package/front_end/core/sdk/WebAuthnModel.ts +11 -2
  75. package/front_end/core/sdk/sdk.ts +2 -0
  76. package/front_end/devtools_compatibility.js +1 -0
  77. package/front_end/entrypoints/inspector_main/InspectorMain.ts +0 -2
  78. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +10 -0
  79. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -1
  80. package/front_end/entrypoints/main/MainImpl.ts +5 -2
  81. package/front_end/foundation/Universe.ts +1 -1
  82. package/front_end/generated/Deprecation.ts +4 -7
  83. package/front_end/generated/InspectorBackendCommands.ts +4 -4
  84. package/front_end/generated/SupportedCSSProperties.ts +89 -17
  85. package/front_end/generated/protocol-mapping.d.ts +1 -0
  86. package/front_end/generated/protocol-proxy-api.d.ts +1 -0
  87. package/front_end/generated/protocol.ts +6 -3
  88. package/front_end/models/{ai_assistance → ai-utils}/AiHistoryStorage.ts +6 -5
  89. package/front_end/models/{ai_assistance → ai-utils}/AiUtils.ts +14 -2
  90. package/front_end/models/{ai_assistance → ai-utils}/BuiltInAi.ts +1 -1
  91. package/front_end/models/ai-utils/ai-utils.ts +17 -0
  92. package/front_end/models/ai_assistance/AiAgent2.ts +14 -6
  93. package/front_end/models/ai_assistance/AiConversation.ts +37 -24
  94. package/front_end/models/ai_assistance/AlwaysAllowedTools.ts +107 -0
  95. package/front_end/models/ai_assistance/ConversationSummary.ts +2 -1
  96. package/front_end/models/ai_assistance/PerformanceAnnotations.ts +3 -1
  97. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +12 -5
  98. package/front_end/models/ai_assistance/agents/AiAgent.ts +261 -127
  99. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +12 -6
  100. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -1
  101. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
  102. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -1
  103. package/front_end/models/ai_assistance/ai_assistance.ts +9 -10
  104. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +27 -6
  105. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +2 -9
  106. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +3 -3
  107. package/front_end/models/ai_assistance/skills/sources.md +3 -1
  108. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -0
  109. package/front_end/models/ai_assistance/tools/GetCookieValues.ts +1 -0
  110. package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +3 -1
  111. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +46 -4
  112. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +1 -0
  113. package/front_end/models/ai_assistance/tools/RunLighthouse.ts +6 -3
  114. package/front_end/models/ai_assistance/tools/Tool.ts +11 -1
  115. package/front_end/models/bindings/CompilerScriptMapping.ts +40 -8
  116. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
  117. package/front_end/models/breakpoints/BreakpointManager.ts +0 -4
  118. package/front_end/models/change_tracker/ChangeTracker.ts +2 -0
  119. package/front_end/models/comment_manager/CommentManager.ts +12 -0
  120. package/front_end/models/comment_manager/CommentThread.ts +34 -1
  121. package/front_end/models/computed_style/ComputedStyleModel.ts +1 -0
  122. package/front_end/models/elements/ChangeTrackingUtils.ts +37 -0
  123. package/front_end/models/elements/DOMChanges.ts +24 -36
  124. package/front_end/models/elements/StyleChanges.ts +97 -0
  125. package/front_end/models/elements/elements.ts +4 -0
  126. package/front_end/models/emulation/DeviceModeModel.ts +19 -0
  127. package/front_end/models/issues_manager/GenericIssue.ts +18 -0
  128. package/front_end/models/issues_manager/descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
  129. package/front_end/models/javascript_metadata/NativeFunctions.ts +11 -5
  130. package/front_end/models/lighthouse/RunTypes.ts +16 -0
  131. package/front_end/models/stack_trace/StackTraceModel.ts +24 -3
  132. package/front_end/models/trace/EventsSerializer.ts +35 -2
  133. package/front_end/models/trace/extras/TraceTree.ts +2 -7
  134. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +17 -21
  135. package/front_end/models/trace/helpers/SyntheticEvents.ts +4 -2
  136. package/front_end/models/trace/helpers/Timing.ts +11 -22
  137. package/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +12 -8
  138. package/front_end/models/trace/types/File.ts +20 -3
  139. package/front_end/models/trace/types/TraceEvents.ts +8 -3
  140. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +37 -2
  141. package/front_end/panels/ai_assistance/README.md +4 -2
  142. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +1 -1
  143. package/front_end/panels/ai_assistance/ai_assistance.ts +2 -0
  144. package/front_end/panels/ai_assistance/components/ChatInput.ts +5 -43
  145. package/front_end/panels/ai_assistance/components/ChatMessage.ts +52 -147
  146. package/front_end/panels/ai_assistance/components/ChatView.ts +28 -3
  147. package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +151 -0
  148. package/front_end/panels/ai_assistance/components/RelevantDataDisclaimer.ts +73 -0
  149. package/front_end/panels/ai_assistance/components/chatInput.css +0 -59
  150. package/front_end/panels/ai_assistance/components/chatMessage.css +0 -47
  151. package/front_end/panels/ai_assistance/components/chatView.css +5 -30
  152. package/front_end/panels/ai_assistance/components/permissionPrompt.css +55 -0
  153. package/front_end/panels/ai_assistance/components/relevantDataDisclaimer.css +35 -0
  154. package/front_end/panels/application/AppManifestView.ts +1 -4
  155. package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -7
  156. package/front_end/panels/application/BackgroundServiceView.ts +8 -8
  157. package/front_end/panels/application/IndexedDBViews.ts +102 -73
  158. package/front_end/panels/application/OpenedWindowDetailsView.ts +167 -130
  159. package/front_end/panels/application/ServiceWorkerCacheViews.ts +288 -346
  160. package/front_end/panels/application/StorageBucketsTreeElement.ts +22 -27
  161. package/front_end/panels/application/StorageItemsToolbar.ts +2 -2
  162. package/front_end/panels/application/components/StorageMetadataView.ts +207 -160
  163. package/front_end/panels/application/openedWindowDetailsView.css +7 -30
  164. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  165. package/front_end/panels/changes/changesView.css +0 -6
  166. package/front_end/panels/comments/CommentsPane.ts +7 -3
  167. package/front_end/panels/comments/comments-meta.ts +1 -1
  168. package/front_end/panels/common/CommentThreadWidget.ts +67 -25
  169. package/front_end/panels/common/CommentsOverlayWidget.ts +13 -0
  170. package/front_end/panels/console/ConsoleInsightTeaser.ts +5 -1
  171. package/front_end/panels/console/ConsolePinPane.ts +1 -1
  172. package/front_end/panels/console/ConsoleView.ts +1 -0
  173. package/front_end/panels/elements/CSSValueTraceView.ts +5 -5
  174. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +14 -6
  175. package/front_end/panels/elements/ComputedStyleWidget.ts +14 -5
  176. package/front_end/panels/elements/DOMTreeElementWidget.ts +2 -2
  177. package/front_end/panels/elements/DOMTreeWidget.ts +7 -3
  178. package/front_end/panels/elements/EventListenersWidget.ts +1 -1
  179. package/front_end/panels/elements/LayersWidget.ts +1 -1
  180. package/front_end/panels/elements/PropertyRenderer.ts +178 -10
  181. package/front_end/panels/elements/StandaloneStylesContainer.ts +33 -6
  182. package/front_end/panels/elements/StylePropertiesSection.ts +1 -0
  183. package/front_end/panels/elements/StylePropertyTreeElement.ts +295 -116
  184. package/front_end/panels/elements/StylesContainer.ts +2 -0
  185. package/front_end/panels/elements/StylesSidebarPane.ts +34 -16
  186. package/front_end/panels/elements/components/QueryContainer.ts +1 -1
  187. package/front_end/panels/elements/elementStatePaneWidget.css +1 -1
  188. package/front_end/panels/elements/stylePropertiesTreeOutline.css +7 -2
  189. package/front_end/panels/elements/stylesSidebarPane.css +4 -0
  190. package/front_end/panels/emulation/DeviceModeToolbar.ts +57 -25
  191. package/front_end/panels/emulation/DeviceModeView.ts +27 -1
  192. package/front_end/panels/emulation/InspectedPagePlaceholder.ts +6 -0
  193. package/front_end/panels/emulation/MediaQueryInspector.ts +14 -4
  194. package/front_end/panels/emulation/deviceModeView.css +3 -3
  195. package/front_end/panels/explain/components/ConsoleInsight.ts +2 -3
  196. package/front_end/panels/explain/explain-meta.ts +1 -1
  197. package/front_end/panels/issues/AffectedMetadataAllowedSitesView.ts +67 -34
  198. package/front_end/panels/issues/issues.ts +2 -0
  199. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +7 -3
  200. package/front_end/panels/lighthouse/LighthouseController.ts +29 -22
  201. package/front_end/panels/lighthouse/LighthousePanel.ts +5 -6
  202. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +24 -16
  203. package/front_end/panels/media/PlayerMessagesView.ts +1 -1
  204. package/front_end/panels/mobile_throttling/CPUThrottlingSelector.ts +1 -1
  205. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +45 -15
  206. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +3 -3
  207. package/front_end/panels/network/BinaryResourceView.ts +54 -50
  208. package/front_end/panels/network/RequestHeadersView.ts +6 -2
  209. package/front_end/panels/network/RequestPreviewView.ts +28 -5
  210. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  211. package/front_end/panels/network/components/EditableSpan.ts +11 -30
  212. package/front_end/panels/network/components/HeaderSectionRow.ts +2 -2
  213. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +10 -6
  214. package/front_end/panels/profiler/HeapDetachedElementsView.ts +112 -22
  215. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  216. package/front_end/panels/profiler/HeapSnapshotView.ts +12 -2
  217. package/front_end/panels/profiler/HeapTimelineOverview.ts +16 -2
  218. package/front_end/panels/profiler/profiler.ts +0 -2
  219. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  220. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -1
  221. package/front_end/panels/recorder/CreateRecordingView.ts +1 -1
  222. package/front_end/panels/recorder/RecordingView.ts +3 -3
  223. package/front_end/panels/recorder/ReplaySection.ts +1 -1
  224. package/front_end/panels/screencast/ScreencastApp.ts +83 -57
  225. package/front_end/panels/screencast/ScreencastView.ts +76 -45
  226. package/front_end/panels/screencast/screencastView.css +1 -1
  227. package/front_end/panels/settings/AISettingsTab.ts +107 -4
  228. package/front_end/panels/settings/aiSettingsTab.css +53 -0
  229. package/front_end/panels/settings/settings-meta.ts +1 -1
  230. package/front_end/panels/settings/settingsScreen.css +0 -4
  231. package/front_end/panels/sources/BreakpointEditDialog.ts +3 -6
  232. package/front_end/panels/sources/BreakpointsView.ts +2 -2
  233. package/front_end/panels/sources/DebuggerPlugin.ts +7 -0
  234. package/front_end/panels/sources/NavigatorView.ts +61 -18
  235. package/front_end/panels/sources/SourcesNavigator.ts +22 -7
  236. package/front_end/panels/sources/SourcesPanel.ts +1 -0
  237. package/front_end/panels/timeline/CountersGraph.ts +1 -1
  238. package/front_end/panels/timeline/README.md +12 -0
  239. package/front_end/panels/timeline/StatusDialog.ts +1 -1
  240. package/front_end/panels/timeline/ThirdPartyTreeView.ts +1 -3
  241. package/front_end/panels/timeline/TimelineCommentController.ts +346 -0
  242. package/front_end/panels/timeline/TimelineDetailsView.ts +24 -1
  243. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +34 -30
  244. package/front_end/panels/timeline/TimelineFlameChartView.ts +24 -10
  245. package/front_end/panels/timeline/TimelinePanel.ts +12 -5
  246. package/front_end/panels/timeline/TimelineTreeView.ts +28 -6
  247. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  248. package/front_end/panels/timeline/components/fieldSettingsDialog.css +2 -2
  249. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +1 -1
  250. package/front_end/panels/timeline/overlays/components/entriesLinkOverlay.css +2 -2
  251. package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +9 -9
  252. package/front_end/panels/timeline/timeline-meta.ts +2 -2
  253. package/front_end/panels/timeline/timeline.ts +4 -0
  254. package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
  255. package/front_end/panels/timeline/timelinePanel.css +2 -2
  256. package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
  257. package/front_end/panels/web_audio/WebAudioView.ts +7 -4
  258. package/front_end/third_party/chromium/README.chromium +1 -1
  259. package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
  260. package/front_end/third_party/codemirror.next/chunk/angular.js.map +1 -1
  261. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  262. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  263. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
  264. package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
  265. package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
  266. package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
  267. package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
  268. package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
  269. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  270. package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
  271. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  272. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  273. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  274. package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
  275. package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
  276. package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
  277. package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
  278. package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
  279. package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
  280. package/front_end/third_party/codemirror.next/chunk/vue.js.map +1 -1
  281. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  282. package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
  283. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
  284. package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
  285. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  286. package/front_end/third_party/codemirror.next/rollup.config.mjs +1 -1
  287. package/front_end/third_party/puppeteer/README.chromium +2 -2
  288. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +42 -12
  289. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +154 -26
  290. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts +47 -7
  291. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js +56 -4
  293. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js.map +1 -1
  294. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +6 -4
  295. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  296. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +5 -2
  297. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  298. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts +3 -3
  299. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  300. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.js.map +1 -1
  301. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +2 -1
  302. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +23 -11
  304. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  305. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts +3 -3
  306. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  307. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js +1 -2
  308. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js.map +1 -1
  309. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts +13 -7
  310. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +26 -11
  312. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
  313. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +2 -1
  314. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  315. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  317. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js +69 -13
  318. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js.map +1 -1
  319. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +10 -0
  320. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  322. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  323. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
  324. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  325. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  326. package/front_end/third_party/puppeteer/package/lib/types.d.ts +42 -12
  327. package/front_end/third_party/puppeteer/package/package.json +4 -4
  328. package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +103 -11
  329. package/front_end/third_party/puppeteer/package/src/api/Page.ts +11 -6
  330. package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +4 -4
  331. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +26 -14
  332. package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +7 -7
  333. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +40 -18
  334. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +2 -3
  335. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +87 -14
  336. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +10 -0
  337. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  338. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  339. package/front_end/tsconfig.json +1 -1
  340. package/front_end/ui/comments/CommentAnchorResolver.ts +1 -1
  341. package/front_end/ui/components/buttons/Button.ts +29 -18
  342. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +1 -1
  343. package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +94 -39
  344. package/front_end/ui/components/dialogs/dialog.css +1 -1
  345. package/front_end/ui/components/menus/menuItem.css +11 -0
  346. package/front_end/ui/components/text_editor/AccessiblePlaceholder.ts +1 -1
  347. package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +1 -1
  348. package/front_end/ui/components/text_editor/config.ts +2 -1
  349. package/front_end/ui/components/text_editor/javascript.ts +2 -1
  350. package/front_end/ui/legacy/InspectorView.ts +4 -2
  351. package/front_end/ui/legacy/SplitWidget.ts +23 -24
  352. package/front_end/ui/legacy/TabbedPane.ts +9 -1
  353. package/front_end/ui/legacy/UIUtils.ts +60 -40
  354. package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -2
  355. package/front_end/ui/legacy/components/data_grid/dataGrid.css +9 -0
  356. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +0 -1
  357. package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +5 -7
  358. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +1 -1
  359. package/front_end/ui/legacy/components/perf_ui/PieChart.ts +11 -0
  360. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +4 -4
  361. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +6 -0
  362. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +1 -1
  363. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +38 -13
  364. package/front_end/ui/legacy/dropTarget.css +1 -1
  365. package/front_end/ui/legacy/statusBar.css +7 -0
  366. package/front_end/ui/legacy/tabbedPane.css +0 -7
  367. package/front_end/ui/visual_logging/KnownContextValues.ts +55 -0
  368. package/inspector_overlay/main.ts +2 -15
  369. package/inspector_overlay/tool_persistent.ts +0 -14
  370. package/mcp/mcp.ts +3 -0
  371. package/package.json +1 -1
  372. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +0 -142
  373. package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +0 -178
  374. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -147
  375. package/front_end/panels/profiler/heapDetachedElementsDataGrid.css +0 -14
  376. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +0 -62
  377. package/front_end/ui/components/legacy_wrapper/legacy_wrapper.ts +0 -8
  378. package/inspector_overlay/tool_green_dev_anchors.css +0 -54
  379. package/inspector_overlay/tool_green_dev_anchors.ts +0 -164
  380. /package/front_end/models/{ai_assistance → ai-utils}/AiSetting.ts +0 -0
  381. /package/front_end/models/{ai_assistance → ai-utils}/debug.ts +0 -0
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: review-models-core
3
+ description: >-
4
+ Reviews Chrome DevTools frontend changes in path group models-and-core (^front_end/(core|models|entrypoints|generated)/, BUILD\.gn$, \.gni$),
5
+ strictly reflecting review standards, architectural invariants, and security boundaries
6
+ derived from historical code reviews.
7
+ ---
8
+
9
+ # Chrome DevTools frontend reviewer skill: models-and-core
10
+
11
+ This skill provides review guidance for Chrome DevTools frontend changes matching the `models-and-core` path group (^front_end/(core|models|entrypoints|generated)/, BUILD\.gn$, \.gni$). Every rule below recurred in at least 5 CLs from 2 distinct reviewers in historical reviews; cite the rule id in findings.
12
+
13
+ ## Path group `models-and-core` (10 rules)
14
+
15
+ ### `CORE_TRACE_ENGINE_HANDLER_INVARIANTS`: Normalize and precompute trace events in handler finalize passes using Types.Events.is* guards while keeping raw events immutable
16
+ - **Severity**: ERROR
17
+ - **Why**: Trace handlers (`front_end/models/trace/handlers/`) must normalize synthetic event fields, validate bounds, and group events once during `finalize()` so downstream insights and UI tracks do not repeatedly filter the raw trace array or mutate raw trace event objects.
18
+ - **Look for**: In-place property mutation of raw trace events, repeated full-trace `.filter()` scans inside insight calculators instead of handler precomputation, or ad-hoc property checks instead of `Types.Events.is*` (or `Trace.Types.Events.is*`) type guards.
19
+ - **Do not flag**: Constructing new synthetic trace event objects owned by the handler during `finalize()`.
20
+
21
+ ### `CORE_SDK_MODEL_AND_TARGET_LIFECYCLE`: Manage SDK model and sub-target state on scoped manager instances using O(1) indexed maps rather than module globals or linear scans
22
+ - **Severity**: ERROR
23
+ - **Why**: Storing model tracking collections (`Set`/`Map`) at module scope leaks state across multiple `TestUniverse` instances and targets, while failing to track OOPIF/worker sub-targets or scanning DOM trees linearly for frame nodes causes bugs and $O(N)$ bottlenecks.
24
+ - **Look for**: Module-level `const tracked = new Map/Set()` in `core/sdk/` or `models/bindings/`, linear DOM tree traversals for frame/node lookups instead of indexed `Map`s, or target listeners that ignore sub-target attachment/detachment.
25
+ - **Do not flag**: Immutable module-level `Set` or `Map` lookup tables of constant string literals. Properties marked required (non-optional) in generated `front_end/generated/protocol.ts` CDP types (do not ask for redundant runtime null/undefined checks on them), or `node.shadowRoots()[0]` accesses (elements have at most one shadow root; the array return type is a legacy Shadow DOM v0 artifact).
26
+
27
+ ### `CORE_GN_BUILD_AND_MODULE_LAYERING`: Enforce strict GN bundle visibility, declare complete deps/ts_deps, and never import UI or panel modules from foundation layers
28
+ - **Severity**: ERROR
29
+ - **Why**: DevTools enforces a strict DAG where `core/` and `models/` (`foundation`) must never depend on `ui/` or `panels/`. In `BUILD.gn`, modules must depend on `:bundle` targets across directories, register new files in `devtools_grd_files.gni` and `foundation_unittests`, and restrict panel `visibility`.
30
+ - **Look for**: Imports of `ui/` or `panels/` inside `core/` or `models/`, `visibility = [ "*" ]` on new panel `BUILD.gn` targets, direct internal file imports across module boundaries instead of `:bundle` namespace imports, or missing `foundation_unittests` entries.
31
+ - **Do not flag**: Core utility libraries intentionally exposed to the entire codebase with `visibility = [ "*" ]`.
32
+
33
+ ### `CORE_AI_AGENT_CONTEXT_AND_PROMPT_DISCIPLINE`: Keep AI agent prompts, tool schemas, and data formatters deterministic, token-efficient, and decoupled from UI and locale state
34
+ - **Severity**: WARNING
35
+ - **Why**: AI agent data formatters (`models/ai_assistance/data_formatters/`) must produce deterministic, unlocalized, concise text representations decoupled from UI widgets and trace insight models, while tools must declare explicit permission policies and flatten verbose CDP types.
36
+ - **Look for**: Localized `i18nString` calls or verbose boilerplate prose inside AI data formatters, unsorted flag/property lists in prompt serializers, AI tools missing permission policy declarations, or monolithic trace models passed to response widgets.
37
+ - **Do not flag**: User-facing UI labels rendered in the AI assistance panel chrome rather than sent to the LLM.
38
+
39
+ ### `CORE_RUNTIME_NEUTRALITY_AND_PLATFORM_UTILS`: Maintain runtime neutrality in foundation modules using Platform.HostRuntime, globalThis, and centralized core/platform utilities
40
+ - **Severity**: ERROR
41
+ - **Why**: Foundation modules (`core/` and `models/`) run in both browser DevTools and headless Node.js/worker environments (such as trace analysis and MCP servers). Accessing `window`, `navigator.userAgent`, or `document` directly breaks non-browser runtimes, and duplicating MIME/string/deferred utilities causes subtle bugs.
42
+ - **Look for**: `navigator.userAgent`, `window.setTimeout`, `window.atob`, manual `new Promise(r => { resolve = r; })` deferreds instead of `Promise.withResolvers()`, or ad-hoc MIME/escaping regexes in `core/` and `models/`.
43
+ - **Do not flag**: Browser-only UI components in `front_end/panels/` or `front_end/ui/`.
44
+
45
+ ### `CORE_CDP_AND_EXTENSION_ERROR_HANDLING`: Handle CDP ProtocolResponseWithError and ContentDataOrError explicitly, release RemoteObject handles in finally blocks, and return Promises
46
+ - **Severity**: ERROR
47
+ - **Why**: CDP agent calls and `requestContentData()` resolve to error-bearing response objects (`getError()`, `ContentData.isError()`) rather than throwing, so wrapping them in `try/catch` is misleading. Furthermore, temporary `RemoteObject` handles must be released in `finally` blocks, and extension APIs must reject with sanitized `Error` instances.
48
+ - **Look for**: `try { await ...invoke_*() }` or `try { await request.requestContentData() }` blocks, `Runtime.evaluate` calls creating `RemoteObject`s without `release()` in `finally`, callback-taking SDK methods instead of `Promise`, or `reject(rawObject)` in `ExtensionAPI.ts`.
49
+ - **Do not flag**: `try/catch` blocks that wrap subsequent throwing operations like `JSON.parse()`. Properties marked required (non-optional) in generated `front_end/generated/protocol.ts` CDP types (do not ask for redundant runtime null/undefined checks on them), or `node.shadowRoots()[0]` accesses (elements have at most one shadow root; the array return type is a legacy Shadow DOM v0 artifact).
50
+
51
+ ### `CORE_SECURITY_ORIGIN_AND_CAPABILITY_GUARDS`: Enforce security origin validation, enterprise policy guards, and branded UrlString types in the model and host layers
52
+ - **Severity**: ERROR
53
+ - **Why**: Security origin checks (SOP), workspace access boundaries, and enterprise/geo-restriction capability checks must be enforced in `core/` and `models/` using `SecurityOrigin`, `Common.ParsedURL`, and `Platform.DevToolsPath.UrlString` rather than relying on UI-layer checks or unvalidated source URLs.
54
+ - **Look for**: Unbranded `string` URLs in model/agent interfaces instead of `Platform.DevToolsPath.UrlString`, security origin checks performed only in UI views, or resource lookup errors returned before permission checks in `ExtensionServer`.
55
+ - **Do not flag**: Internal display-only label strings that are never used for resource resolution or security checks.
56
+
57
+ ### `CORE_SOURCEMAP_AND_WORKSPACE_MAPPING`: Handle source map parsing, inline script offset translation, and scope tree resolution fault-tolerantly
58
+ - **Severity**: ERROR
59
+ - **Why**: Real-world source maps and inline `<script>` tags frequently contain malformed fields, UTF-8 characters, or non-zero line/column offsets. Source map consumers must translate raw inline script locations to relative locations, use UTF-8-safe URI encoding (`encodeURIComponent` with `try/catch` instead of `btoa`), and guard scope stack traversals.
60
+ - **Look for**: `window.btoa` on source map strings containing UTF-8, raw script locations passed to source map lookups without `rawLocationToRelativeLocation`, or unguarded `encodeURIComponent` / `JSON.parse` on external source map payloads.
61
+ - **Do not flag**: ASCII-only binary buffer encoding via `Common.Base64.encode`.
62
+
63
+ ### `CORE_SETTINGS_AND_STORAGE_MIGRATION`: Guard settings and storage migrations with try/catch, preserve user preferences across renames, and clean up obsolete flags
64
+ - **Severity**: ERROR
65
+ - **Why**: Corrupted `localStorage` payloads or legacy setting schemas can throw during `JSON.parse` and break DevTools startup unless caught and reset. When migrating setting keys or storage formats, existing user selections must be migrated rather than overwritten.
66
+ - **Look for**: Unprotected `JSON.parse()` in `Settings.ts` or storage classes, setting key renames that discard previously stored user preferences, or experiment removals that leave orphaned `localStorage` keys behind.
67
+ - **Do not flag**: In-memory parsing of static constant JSON fixtures.
68
+
69
+ ### `CORE_TRACE_INSIGHT_MODELS_AND_TIMING_TYPES`: Enforce branded timing types (Micro, Milli) in trace models and keep types.ts and insight models free of executable or presentation logic
70
+ - **Severity**: ERROR
71
+ - **Why**: Mixing microseconds and milliseconds causes 1000x calculation bugs across trace insights; branded types (`Types.Timing.Micro`, `Types.Timing.Milli`) and canonical conversion helpers (such as `Trace.Helpers.Timing.microToMilli` or `Platform.Timing.microSecondsToMilliSeconds`) prevent unit confusion. Placing executable functions in `types.ts` or UI/AI formatting in insight models violates trace architecture.
72
+ - **Look for**: Manual `/ 1000` or `* 1000` arithmetic on trace timestamps, executable functions placed in `models/trace/**/types.ts`, or CSS/DOM/AI markdown formatting inside `models/trace/insights/`.
73
+ - **Do not flag**: Type guard functions (`is*`) in `Trace.Types.Events` that only perform type predicate checks.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: review-tests
3
+ description: >-
4
+ Reviews Chrome DevTools frontend changes in target directories (\.test\.ts$, ^test/, ^front_end/testing/),
5
+ strictly reflecting review standards, architectural invariants, and security boundaries
6
+ derived from historical code reviews.
7
+ ---
8
+
9
+ # Chrome DevTools frontend reviewer skill: tests
10
+
11
+ This skill provides review guidance for Chrome DevTools frontend changes matching the target directories (\.test\.ts$, ^test/, ^front_end/testing/). It focuses specifically on code review verification for test changes, complementing authoring guidance in `devtools-testing-guidance` and integrating with the general review checklist in `code-review`. Every rule below recurred in at least 5 CLs from 2 distinct reviewers in historical reviews; cite the rule id in findings.
12
+
13
+ ## Path group `tests` (9 rules)
14
+
15
+ ### `TEST_SHARED_FIXTURE_AND_HELPER_REUSE`: Reuse canonical front_end/testing helpers and beforeEach setup without mutating cached shared fixtures
16
+ - **Severity**: WARNING
17
+ - **Why**: Duplicating mock factories (`createTarget`, `createNetworkRequest`, `mockAidaClient`, `cleanTextContent`) or mutating cached objects returned by `TraceLoader` causes cross-test state corruption and maintenance drift across the test suite.
18
+ - **Look for**: Custom inline network request or AIDA client mocks in `.test.ts` files, in-place mutation of `parsedTrace` objects returned by `TraceLoader`, or manual `div` container creation around `renderElementIntoDOM(widget)`.
19
+ - **Do not flag**: Specialized test helpers inside `front_end/testing/` that define the canonical factory implementations themselves.
20
+
21
+ ### `TEST_MODULAR_HOOKS_AND_TEST_UNIVERSE`: Use lightweight modular setup hooks and TestUniverse instead of heavyweight describeWithEnvironment wrappers
22
+ - **Severity**: WARNING
23
+ - **Why**: Wrapping unit tests in `describeWithEnvironment` initializes all DevTools global singletons and settings, slowing down tests and hiding implicit global dependencies. Tests should use `TestUniverse` or granular hooks (`setupLocaleHooks()`, `setupSettingsHooks()`, `updateHostConfig()`) and never mix `TestUniverse` with `describeWithEnvironment`.
24
+ - **Look for**: `describeWithEnvironment` in unit tests that only need locale, settings, or `TestUniverse`, or suites combining `new TestUniverse()` with `describeWithEnvironment`, or direct mutation of `Root.Runtime.hostConfig` instead of `updateHostConfig(...)`.
25
+ - **Do not flag**: Integration-style panel tests that exercise legacy singleton classes not yet migrated to `Universe` dependency injection. Bot-only CLI flags, credentials, or standalone runner scripts under `test/conductor/` or `test/ai_evals/` that do not run inside the standard Mocha unit test harness.
26
+
27
+ ### `TEST_DETERMINISTIC_ASYNC_SYNCHRONIZATION`: Synchronize asynchronous test assertions using lifecycle promises, expectCall, or raf instead of arbitrary setTimeout delays
28
+ - **Severity**: ERROR
29
+ - **Why**: Waiting on wall-clock `setTimeout` delays or arbitrary microtask ticks makes unit tests slow and flaky under CPU contention on CI bots. Tests should await explicit widget update promises (`await widget.updateComplete`), event promises (`target.once(...)`), stub invocation helpers (`expectCall(stub)`), or `raf()`.
30
+ - **Look for**: `new Promise(r => setTimeout(r, ...))` in `.test.ts` files, synchronous DOM assertions immediately after `requestUpdate()`, or redundant `clock.tick()` calls when no fake timers are pending.
31
+ - **Do not flag**: Tests specifically verifying debounce/throttle timer expiration using `sinon.useFakeTimers()`.
32
+
33
+ ### `TEST_STRICT_ASSERTIONS_AND_LITERAL_EXPECTATIONS`: Use strict Chai and Sinon assertions against literal expected values rather than assert.isNotNull on undefined-unions or conditional guards
34
+ - **Severity**: ERROR
35
+ - **Why**: Calling `assert.isNotNull(x)` on a value typed as `T | undefined` passes when `x` is `undefined`, silently skipping assertions. Similarly, wrapping assertions inside `if (el)` or computing expected values by calling the same production helper under test allows broken code to pass.
36
+ - **Look for**: `assert.isNotNull(...)` on `container?.querySelector` / `Map.get` / `Array.find` / optional properties, `if (el) { assert... }` blocks, `assert.isTrue(spy.called)` instead of `sinon.assert.calledWith`, or assertions comparing output against production formatting helpers.
37
+ - **Do not flag**: Variables whose static return type is strictly `T | null` (and never `undefined`).
38
+
39
+ ### `TEST_VIEW_AND_PRESENTER_ISOLATION`: Test presenters via createViewFunctionStub and test pure view functions directly without piercing internal DOM structures
40
+ - **Severity**: WARNING
41
+ - **Why**: In DevTools' MVP (`UI.Widget` + `DEFAULT_VIEW`) architecture, presenter tests should follow the view stubbing conventions documented in [`docs/ui_engineering.md`](../../../docs/ui_engineering.md) by stubbing the view function with `createViewFunctionStub(Presenter)` and asserting on `await view.nextInput`, while view rendering tests should invoke `DEFAULT_VIEW(input, output, target)` directly or use screenshot assertions.
42
+ - **Look for**: Presenter tests instantiating full DOM trees and querying shadow/child DOM selectors to simulate clicks when the widget accepts a `view` function, or view tests instantiating full presenters just to test template markup.
43
+ - **Do not flag**: Legacy widgets that have not yet separated their template rendering into a standalone `DEFAULT_VIEW` function.
44
+
45
+ ### `TEST_PUBLIC_API_AND_ENCAPSULATION`: Exercise classes through public APIs and constructor-injected dependencies rather than accessing private members or stubbing unused singletons
46
+ - **Severity**: WARNING
47
+ - **Why**: Accessing `#private` or `private` methods via `(instance as any)` or `@ts-expect-error`, piercing child component shadow roots, or stubbing `Class.instance()` when dependencies are already passed via constructor couples tests to internal implementation details.
48
+ - **Look for**: `@ts-expect-error` or `(obj as any).privateMethod()` calls in `.test.ts` files, `sinon.stub(Class, 'instance')` alongside `new UnderTest(mockInstance)`, or `child.shadowRoot.querySelector(...)` inside parent component tests.
49
+ - **Do not flag**: Intentional negative type tests documented with an explanatory `@ts-expect-error` comment.
50
+
51
+ ### `TEST_SINGLE_RESPONSIBILITY_AND_CONCISENESS`: Keep each it() block focused on a single behavior and prune duplicate or obsolete tests when features change
52
+ - **Severity**: WARNING
53
+ - **Why**: Combining multiple independent user interactions or feature scenarios into a single monolithic `it()` block obscures failure root causes, while leaving duplicate or orphaned tests behind increases suite runtime and maintenance burden.
54
+ - **Look for**: `it('... and ...')` blocks testing multiple orthogonal interactions sequentially, nested `{ ... }` scope blocks inside a single `it()`, or identical test cases duplicated across `describe` blocks.
55
+ - **Do not flag**: Multi-step stateful workflow tests where earlier steps are required preconditions to reach the state under test.
56
+
57
+ ### `TEST_TYPE_SAFE_MOCKS_AND_EVENTS`: Construct typed stubs and real DOM or event instances instead of casting fake objects with as unknown as
58
+ - **Severity**: WARNING
59
+ - **Why**: Casting partial object literals via `as unknown as T` or `as any` bypasses TypeScript compile-time checks, masks missing methods when interfaces evolve, and causes brittle runtime failures. Using `sinon.createStubInstance(Class)`, real DOM/Event constructors (`DataTransfer`, `ClipboardEvent`), or typed fixture helpers preserves type safety.
60
+ - **Look for**: `as unknown as` or `as any` casts on mock objects, fake DOM nodes, or synthetic events in `.test.ts` files, or untyped `querySelector(...) as HTMLElement` calls.
61
+ - **Do not flag**: Tests explicitly verifying runtime handling of malformed untrusted payloads or narrow generic type parameters inside shared `front_end/testing/` helpers.
62
+
63
+ ### `TEST_CLEANUP_MUTATED_GLOBALS_AND_WIDGETS`: Restore mutated global properties and detach manually instantiated widgets or singletons in afterEach or finally blocks
64
+ - **Severity**: WARNING
65
+ - **Why**: While Sinon stubs are restored automatically, direct mutations to `window`, `globalThis`, prototypes, or `localStorage`, as well as widgets and panels instantiated with `.markAsRoot()` or `show()`, persist across tests and leak listeners unless explicitly cleaned up in `afterEach` or `try...finally`.
66
+ - **Look for**: Direct assignments to `window.*`, `globalThis.*`, `Object.prototype.*`, `localStorage.*`, or `panel.show(document.body)` in `.test.ts` files without a matching restoration or `detach()` in `afterEach` or `finally`.
67
+ - **Do not flag**: Widgets mounted directly via `renderElementIntoDOM(widget)`, which detaches widgets automatically during global harness teardown.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: review-ui-widgets
3
+ description: >-
4
+ Reviews Chrome DevTools frontend changes in path group ui-and-widgets (^front_end/(ui|panels)/.*\.(ts|css)$),
5
+ strictly reflecting review standards, architectural invariants, and security boundaries
6
+ derived from historical code reviews.
7
+ ---
8
+
9
+ # Chrome DevTools frontend reviewer skill: ui-and-widgets
10
+
11
+ This skill provides review guidance for Chrome DevTools frontend changes matching the `ui-and-widgets` path group (^front_end/(ui|panels)/.*\.(ts|css)$). It focuses specifically on code review verification for UI and widget changes, complementing authoring guidance in `ui-widgets` and [`docs/ui_engineering.md`](../../../docs/ui_engineering.md), and integrating with the general review checklist in `code-review`. Every rule below recurred in at least 5 CLs from 2 distinct reviewers in historical reviews; cite the rule id in findings.
12
+
13
+ ## Path group `ui-and-widgets` (17 rules)
14
+
15
+ ### `UI_MODERN_COMPONENT_AND_ENCAPSULATION_STANDARDS`: Use modern DevTools UI primitives (`devtools-button`, `devtools-data-grid`, `devtools-icon`), #private fields, and module entrypoint imports
16
+ - **Severity**: WARNING
17
+ - **Why**: Legacy `UI.Fragment`, `DataGridImpl`, `LitElement`, `new Icon()`, and TypeScript `private` fields are superseded by standard `<devtools-*>` custom elements (imported via module entrypoints such as `import * as Buttons from '../../ui/components/buttons/buttons.js'` so custom tags register at runtime) and ECMAScript `#private` fields.
18
+ - **Look for**: `UI.Fragment.build`, legacy `DataGridImpl`, `extends LitElement`, `private ` keyword instead of `#` in new UI classes, or `<devtools-*>` tags in Lit templates without importing the corresponding component module entrypoint (e.g. `import * as Buttons from '../../ui/components/buttons/buttons.js'`).
19
+ - **Do not flag**: Overriding inherited `protected` lifecycle methods on framework base classes (e.g. extending `UI.Widget.Widget`).
20
+
21
+ ### `UI_TYPE_SAFETY_AND_EXHAUSTIVENESS`: Model multi-state UI workflows with discriminated unions, Platform.assertNever exhaustiveness checks, and strict domain types
22
+ - **Severity**: WARNING
23
+ - **Why**: Representing mutually exclusive UI states with loose optional boolean flags or `any` types permits impossible states and silently misses new enum variants. Discriminated unions paired with `Platform.assertNever` in `default:` branches enforce compile-time exhaustiveness.
24
+ - **Look for**: `switch` statements over union/enum types missing `Platform.assertNever(x)` in `default:`, `any` or `declare` field modifiers in UI classes, or multiple boolean flags (`isLoading`, `isError`, `isEmpty`) representing mutually exclusive states.
25
+ - **Do not flag**: Switch statements that intentionally handle only a small subset of a large external protocol enum.
26
+
27
+ ### `UI_PURE_VIEW_AND_PRESENTER_SEPARATION`: Keep UI.Widget view functions pure and stateless by computing presentation data in presenters, passing decoupled ViewInput data structures, and preserving helper topology
28
+ - **Severity**: WARNING
29
+ - **Why**: In DevTools' MVP architecture, `DEFAULT_VIEW` functions must be pure projections of `ViewInput` to Lit templates. Querying SDK models, reading global settings, mutating presenter state, or calling host/clipboard APIs inside the view couples rendering to global state and breaks isolated view testing. Additionally, deleting existing standalone/module-level DOM helper functions or async class update helpers and inlining them into `performUpdate()` or `DEFAULT_VIEW` during Lit migrations unnecessarily flattens the abstraction topology and inflates diffs.
30
+ - **Look for**: `DEFAULT_VIEW` or view helper functions calling `Common.Settings.Settings.instance()`, `SDK.*`, `Host.*`, mutating `input.*` arrays in place, accepting raw `SDK`/`Protocol` domain objects instead of decoupled presentation interfaces on `ViewInput`, or Lit migrations that delete existing standalone/class DOM helper functions and inline their logic into `performUpdate()` or `DEFAULT_VIEW` instead of converting them in place to return `LitTemplate` (or `Promise<LitTemplate|null>`).
31
+ - **Do not flag**: Legacy `UI.Widget` subclasses that have not yet migrated to a `DEFAULT_VIEW` function.
32
+
33
+ ### `UI_LIT_DECLARATIVE_TEMPLATES_AND_DIRECTIVES`: Use Lit.nothing, repeat with keys, classMap/styleMap, and ifDefined in declarative templates while preserving modular helper functions
34
+ - **Severity**: WARNING
35
+ - **Why**: Mutating DOM elements via `appendChild`, `classList.toggle`, or `innerHTML` alongside Lit templates, or returning `''`/`null` instead of `Lit.nothing` in conditional branches, corrupts Lit's part tracking and creates unnecessary text nodes or wrapper `<div>`s. Conversely, collapsing existing standalone DOM helper functions (e.g., `linkifyIcon`, `maybeCreateLinkToElementsPanel`) or class rendering helpers into a single monolithic `DEFAULT_VIEW` template harms readability and reviewability compared to converting those helpers in place to return `LitTemplate`.
36
+ - **Look for**: Ternary branches returning `''` or `undefined` in `html` templates instead of `Lit.nothing`, unkeyed `.map()` on dynamic stateful lists instead of `repeat()`, `ifDefined` omissions on optional attributes, multiple `Lit.render()` calls mutating the same container, or Lit migrations that flatten/inline existing DOM helper functions and class helper methods instead of preserving them in their original locations returning `LitTemplate`.
37
+ - **Do not flag**: Static arrays of primitive labels where item identity never reorders.
38
+
39
+ ### `UI_WIDGET_DOM_AND_LISTENER_LIFECYCLE`: Attach listeners to external models and managers in wasShown and detach them symmetrically in willHide
40
+ - **Severity**: ERROR
41
+ - **Why**: Subscribing to long-lived SDK `TargetManager`, `Settings`, or model events in a widget's constructor without unsubscribing in `willHide()` (or `onDetach()` / `onunbind()`) causes hidden panels to process background updates and leaks detached widget instances.
42
+ - **Look for**: `addEventListener`, `addModelListener`, or `addChangeListener` on singletons, models, or settings inside `UI.Widget` constructors or `wasShown()` without a matching `remove*` call in `willHide()` using the same function reference.
43
+ - **Do not flag**: Listeners attached to the widget's own internal DOM elements (`this.contentElement`), which are garbage-collected together with the widget.
44
+
45
+ ### `UI_ACCESSIBILITY_AND_SEMANTIC_HTML`: Use native semantic HTML controls with accurate ARIA attributes, keyboard handlers, and !event.isComposing guards
46
+ - **Severity**: WARNING
47
+ - **Why**: Clickable `<div>`/`<span>` elements and nested interactive controls (`<button>` inside `<a>` or `<button>`) break keyboard navigation and screen readers. Interactive elements require semantic tags (`<button>`, `<details>`/`<summary>`, `<thead>`/`<tbody>`), synchronized ARIA state (`aria-expanded`, `aria-details` for rich tooltips vs `aria-describedby` for plain text), and `!event.isComposing` checks on `Enter` keydown handlers.
48
+ - **Look for**: `@click` on `<div>`/`<span>` without button semantics, `<button>` nested inside `<button>`/`<x-link>`, `Enter` keydown handlers missing `!event.isComposing`, or `aria-describedby` pointing to interactive `<devtools-tooltip>` elements.
49
+ - **Do not flag**: Delegating click listeners on container elements that handle bubbled events from child buttons.
50
+
51
+ ### `UI_PERFORMANCE_AND_FLAMECHART_RENDERING`: Precompute expensive metrics outside render loops, use Set/Map for O(1) lookups, and debounce high-frequency UI updates
52
+ - **Severity**: WARNING
53
+ - **Why**: Performing linear `Array.includes`/`find` scans, sorting, or regex parsing inside FlameChart canvas draw loops, `ElementsTreeOutline` mutation callbacks, or Lit render passes causes frame drops and UI jank on large traces and DOM trees.
54
+ - **Look for**: `.includes()` / `.find()` / `.sort()` inside canvas draw or event iteration loops, repeated `ResizeObserver` registrations on individual child items instead of the parent container, or un-debounced filter/mutation handlers.
55
+ - **Do not flag**: One-time initialization passes over bounded small arrays (less than 20 items).
56
+
57
+ ### `UI_LOCALIZATION_AND_UISTRINGS_HYGIENE`: Define user-facing strings in sentence-case UIStrings using complete sentences and i18nTemplate for embedded elements, and prune unused entries
58
+ - **Severity**: WARNING
59
+ - **Why**: Concatenating translated fragments breaks word order in non-English locales, title-Cased strings violate Chromium UX standards, translating English-only experimental strings wastes localization quota, and unused `UIStrings` entries bloat locale bundles.
60
+ - **Look for**: String concatenation around `i18nString(...)`, HTML/DOM elements interpolated without `i18nTemplate`, Title Case labels in `UIStrings`, unlocalized English literals in templates, or unused keys in `UIStrings`.
61
+ - **Do not flag**: Technical protocol identifiers, MIME types, or strings in `UIStringsNotTranslate` / `i18n.i18n.lockedString(...)`.
62
+
63
+ ### `UI_REACTIVE_WIDGET_UPDATE_LIFECYCLE`: Schedule widget re-renders asynchronously via this.requestUpdate() and guard property setters with equality checks
64
+ - **Severity**: WARNING
65
+ - **Why**: Calling `this.performUpdate()` or invoking `this.#view(...)` synchronously inside property setters causes redundant synchronous DOM renders when multiple properties change in the same tick. Setters should short-circuit if the value is unchanged and call `this.requestUpdate()`.
66
+ - **Look for**: Widget property setters calling `this.performUpdate()` or `this.#view(...)` directly, or setters calling `this.requestUpdate()` without checking `if (this.#prop === value) return;`.
67
+ - **Do not flag**: Internal test helpers or synchronous initialization paths explicitly documented as requiring immediate flush.
68
+
69
+ ### `UI_VISUAL_LOGGING_INSTRUMENTATION`: Instrument interactive UI elements and containers with kebab-case VisualLogging contexts registered in KnownContextValues
70
+ - **Severity**: WARNING
71
+ - **Why**: DevTools relies on Visual Elements (`jslog`) telemetry to measure feature usage. Omitting `jslog` on new buttons/toggles/menus, using localized or camelCase context strings, adding redundant panel prefixes inside already-logged containers, or dropping `jslog` during Lit refactors breaks analytics.
72
+ - **Look for**: Interactive elements (`<button>`, `<devtools-button>`, `<input>`, menus, drawers) missing `jslog` or `jslogContext`, non-kebab-case context names, or new context values missing from `KnownContextValues.ts`.
73
+ - **Do not flag**: Purely decorative icons or internal wrapper `<div>`s that represent neither a distinct visual section nor an interactive control.
74
+
75
+ ### `UI_CSS_SCOPING_AND_FLEX_LAYOUT`: Scope light-DOM stylesheets and align elements using flexbox or grid rather than competing margin and position offsets
76
+ - **Severity**: INFO
77
+ - **Why**: Unscoped class or tag selectors in light-DOM widget stylesheets leak across the DevTools document, while combining `vertical-align`, negative margins, and `position: relative` offsets creates brittle layouts that break under font scaling or zoom.
78
+ - **Look for**: Unscoped generic selectors in light-DOM `.css` files (or `:host` inside `@scope` blocks instead of `:scope`), or CSS rules combining `vertical-align`, negative `margin-top`, and pixel offsets to center icons and buttons.
79
+ - **Do not flag**: Shadow DOM component stylesheets where `:host` scoping is native.
80
+
81
+ ### `UI_VIEW_OUTPUT_AND_CALLBACK_CONTRACTS`: Encapsulate imperative DOM actions in ViewOutput callbacks and pass user actions via semantic ViewInput callbacks instead of raw DOM references
82
+ - **Severity**: WARNING
83
+ - **Why**: Exposing raw `HTMLElement` references on `ViewOutput` or passing raw `MouseEvent`/`KeyboardEvent` objects to presenter callbacks leaks DOM details into presenters. Views should populate narrow functional closures on `ViewOutput` (e.g. `output.focusInput = () => ...`) and unpack event values before calling `input.onSelect(value)`.
84
+ - **Look for**: `ViewOutput` interfaces containing `HTMLElement` or `Element` properties, or `ViewInput` callbacks typed as `(event: Event) => void` instead of semantic domain values.
85
+ - **Do not flag**: Third-party editor or canvas host containers that require a raw mount `HTMLElement`.
86
+
87
+ ### `UI_PANEL_AND_META_REGISTRATION`: Follow DevTools panel directory conventions and register settings and views in the appropriate *-meta.ts scope
88
+ - **Severity**: WARNING
89
+ - **Why**: Panel-level `UI.Widget` views belong directly under `front_end/panels/<panel>/` (reserving `components/` for reusable leaf components), internal non-user-facing settings must use `SettingCategory.NONE` or model descriptors rather than appearing in Settings UI, and shared SDK settings belong in `sdk-meta.ts`.
90
+ - **Look for**: Panel-level `UI.Widget` views placed inside `panels/<panel>/components/`, internal state flags registered with user-facing titles in `*-meta.ts`, or `loadView` callbacks calling `.instance()` instead of using the passed `Universe` context.
91
+ - **Do not flag**: Standalone reusable leaf components inside `components/` or genuine user-configurable preferences.
92
+
93
+ ### `UI_WEAK_DOM_REFERENCES_AND_OBSERVER_CLEANUP`: Store DOM node metadata in WeakMap or WeakRef collections and clean up observers when elements detach
94
+ - **Severity**: WARNING
95
+ - **Why**: Retaining DOM `Element` or `SDK.Target` references in strong `Map`/`Set` collections (or in `WeakMap` values that hold strong references back to their keys) prevents detached DOM trees from being garbage-collected, while leaving `ResizeObserver`, `MutationObserver`, or `Lit.Directives.ref` callbacks active after unmount leaks memory.
96
+ - **Look for**: Strong `Map<Element, ...>` / `Set<Element>` collections holding DOM/model associations, `WeakMap` values retaining strong references back to their DOM keys, `ResizeObserver`/`IntersectionObserver` without `.unobserve()`/`.disconnect()` on teardown, or `ref(el => ...)` callbacks that do not handle `el === undefined`.
97
+ - **Do not flag**: Module-level `WeakMap<Element, ...>` globals whose values do not strongly reference the key, or short-lived local maps created and discarded within a single synchronous function call.
98
+
99
+ ### `UI_SECURITY_AND_OUTPUT_SANITIZATION`: Sanitize untrusted strings, URLs, CSS selectors, and Markdown exports before rendering or exporting
100
+ - **Severity**: ERROR
101
+ - **Why**: Interpolating untrusted network URLs, DOM attributes, or user strings into raw HTML snippets, `CSS.escape`-free attribute selectors, Markdown table exports, or `href` attributes without protocol validation risks injection, XSS, broken layout formatting, or text spoofing.
102
+ - **Look for**: Raw string interpolation in `querySelector('[attr="' + val + '"]')` without `CSS.escape`, `href` attribute bindings with unvalidated `javascript:` URLs, Markdown table cell serialization without escaping `|*_<>\`, or raw HTML snippet generation without HTML escaping.
103
+ - **Do not flag**: Standard Lit `html` text bindings (`${text}`), which escape HTML entities automatically.
104
+
105
+ ### `UI_DECLARATIVE_CHILD_WIDGET_COMPOSITION`: Compose child UI.Widget instances declaratively in Lit templates using the two-argument widget(ChildWidget, {...}) directive instead of imperative show() calls or single-argument factory callbacks
106
+ - **Severity**: WARNING
107
+ - **Why**: Imperatively instantiating child widgets and calling `child.show(container)` inside presenters or views bypasses Lit reconciliation, complicates lifecycle management, and recreates widgets unnecessarily across renders. Similarly, single-argument factory callbacks `widget(element => ...)` only run on initial creation and fail to propagate updated properties on subsequent re-renders; strongly prefer the two-argument `widget(ChildWidget, {...})` form (converting `setFoo()` methods on the child widget into `set foo()` setters if needed).
108
+ - **Look for**: `new ChildWidget()` followed by `.show(...)` or `.appendChild(child.element)` inside Lit view functions or migrated `performUpdate()` methods, or `widget(element => ...)` factory callbacks configuring child widget properties imperatively instead of `<devtools-widget ${widget(ChildWidget, {...})}></devtools-widget>` (or `${widget(ChildWidget, {...})}`).
109
+ - **Do not flag**: Top-level legacy split widgets or tabbed panes that have not migrated to Lit views.
110
+
111
+ ### `UI_AWAIT_UPDATE_COMPLETE_POST_RENDER`: Await this.updateComplete before executing post-render DOM measurements, focus changes, or scroll adjustments
112
+ - **Severity**: ERROR
113
+ - **Why**: Because `this.requestUpdate()` schedules rendering asynchronously in a microtask, querying DOM geometry, focusing newly rendered controls, or anchoring popovers immediately after `requestUpdate()` operates on stale pre-render DOM state.
114
+ - **Look for**: `this.requestUpdate()` followed synchronously by `.focus()`, `.getBoundingClientRect()`, `.scrollIntoView()`, or child widget measurement without `await this.updateComplete`.
115
+ - **Do not flag**: State updates that do not interact with rendered DOM nodes after scheduling the update.
@@ -18,6 +18,11 @@ existing element containers.
18
18
 
19
19
  * Maintain the existing class hierarchy, helper class boundaries, and
20
20
  logical groups.
21
+ * Preserve existing standalone/module-level DOM helper functions (e.g.,
22
+ `linkifyIcon`, `maybeCreateLinkToElementsPanel`) and class helper
23
+ methods in their original locations, converting DOM-returning helpers in
24
+ place to return `LitTemplate` (or `Promise<LitTemplate|null>`) rather
25
+ than deleting and inlining them into `performUpdate()` or `DEFAULT_VIEW`.
21
26
  * Do not aggressively "flatten" classes or collapse helper abstractions
22
27
  into the main view just to coerce a single master template. Pass 2
23
28
  should only change the *implementation details* of rendering (imperative
@@ -34,14 +39,18 @@ existing element containers.
34
39
  that method. **Do not** introduce Widget lifecycle methods
35
40
  (`performUpdate`) on classes that do not inherit them.
36
41
 
37
- 3. **Import Modern Templating**:
42
+ 3. **Import Modern Templating (Named Imports Only)**:
38
43
 
39
- * Import the `Lit` rendering system inside the view module:
44
+ * Always use named imports from `../../ui/lit/lit.js`:
40
45
 
41
46
  ```typescript
42
- import {html, render, nothing} from '../../ui/lit/lit.js';
47
+ import {html, nothing, render, Directives, type LitTemplate} from '../../ui/lit/lit.js';
43
48
  ```
44
49
 
50
+ * **NEVER** use namespace imports like `import * as Lit` or reference
51
+ `Lit.nothing` / `Lit.render`. Named imports enable better tree-shaking and
52
+ maintain consistent codebase style.
53
+
45
54
  4. **Modern Component Mapping**:
46
55
  * **MANDATORY**: You **MUST** read and load [ui_engineering.md](../../../docs/ui_engineering.md) first to understand specific component mappings (e.g., Toolbar vs `devtools-toolbar`). Do not assume standard Lit defaults.
47
56
  * If unsure, also consult the [automatic migration code](../../../scripts/eslint_rules/lib/no-imperative-dom-api.ts)
@@ -115,13 +124,64 @@ existing element containers.
115
124
  * The Gerrit Code Review UI cannot identify moved blocks of unchanged code.
116
125
  * If blocks of code need to be reordered, create a "prefactoring" change that first extracts the code that needs to be reordered into a named helper functions and pause the migration, waiting user confirmation.
117
126
 
118
- 12. **Micro-Commit Strategy**:
127
+ 12. **Composing Child `UI.Widget`s & Pre-Existing Instances**:
128
+
129
+ * **Strongly Prefer Two-Argument `widget(ChildWidgetClass, {params})`**:
130
+ When instantiating child widgets in a Lit template, strongly prefer the
131
+ two-argument form `widget(ChildWidgetClass, {propA: input.a, propB: input.b})`
132
+ over the single-argument factory `widget(element => new ChildWidgetClass(element))`.
133
+ The two-argument form automatically propagates updated parameters and
134
+ schedules `requestUpdate()` on re-renders, whereas a factory callback only
135
+ runs once on initial creation. If the child widget currently uses
136
+ `setFoo()` methods instead of setters, convert them into `set foo()`
137
+ setters on the child widget so you can use the two-argument `widget()`
138
+ directive.
139
+ * **Pre-Existing Widget Instances (`UI.Widget.WrapperWidget`)**: Use
140
+ `${widget(UI.Widget.WrapperWidget, {widget: input.childWidget})}` when
141
+ embedding widgets owned by `UI.ViewManager`
142
+ (`TabbedViewLocation.tabbedPane()`, `StackLocation.widget()`) or when
143
+ conditionally moving a shared widget instance between containers
144
+ (`{widget: shouldShow ? this.#sharedWidget : null}`).
145
+ * `WrapperWidget` automatically handles showing and detaching the inner
146
+ widget and forwards calculateConstraints without requiring custom wrapper
147
+ classes.
148
+
149
+ 13. **Declarative `<devtools-split-view>` Guidelines**:
150
+
151
+ * **CSS Sizing**: Ensure `<devtools-split-view>` has `flex: auto; height: 100%;`
152
+ in CSS so it fills available container space and doesn't collapse to 0x0.
153
+ * **Reuse Existing Settings for `showMode`**: When binding `show=${...}`
154
+ declaratively on `<devtools-split-view name="...">`, reuse the existing
155
+ `SplitWidget` setting (`{vertical?: {size, showMode}, horizontal?: {size, showMode}}`)
156
+ for `showMode` rather than creating new boolean settings (which loses user
157
+ preferences and requires `KnownContextValues.ts` updates).
158
+ * **Keep Environment Overrides in Templates**: Keep environment overrides
159
+ (like `!input.isTraceApp`) in the `DEFAULT_VIEW` template (e.g.,
160
+ `show=${!input.isTraceApp && input.isSidebarOpen ? 'both' : 'main'}`)
161
+ rather than baking them into the presenter's setting state.
162
+ * **Clean Up Resizers**: Do not leave unused `resizer-widget` classes in
163
+ templates; `<devtools-split-view>` manages its own built-in splitter
164
+ unless custom elements are explicitly registered with `installResizer`.
165
+
166
+ 14. **Declarative Long-Press Action Buttons (`bindToAction`)**:
167
+
168
+ * Legacy `UI.Toolbar.Toolbar.createLongPressActionButton(action, [subButtons])`
169
+ maps declaratively to nesting option `<devtools-button>` elements directly
170
+ inside `<devtools-button ${bindToAction('action-id')}>...</devtools-button>`.
171
+
172
+ 15. **Audit Removed `UIStrings`**:
173
+
174
+ * If a `UIStrings` entry becomes unused during template migration, verify
175
+ that a conditional UI branch (such as a dynamically shown checkbox, button,
176
+ or tooltip) wasn't accidentally dropped before deleting the string.
177
+
178
+ 16. **Micro-Commit Strategy**:
119
179
 
120
180
  * Do not attempt to convert every helper method and UI component in a single monolithic commit. Break the template extraction into **small, self-contained micro-commits** (e.g., migrating one helper method, toolbar button, or list item render at a time).
121
181
  * Verify with build and run tests after each micro-commit to guarantee zero regressions and 100% visual parity before moving to the next compartment.
122
182
  * Provide the exact list of files and commit message when presenting progress so the change history remains atomic and easy to review.
123
183
 
124
- 13. **Wait for confirmation**:
184
+ 17. **Wait for confirmation**:
125
185
 
126
186
  * Wait for an explicit confirmation from the user (or Parent Orchestrator Agent) before proceeding to the next step.
127
187
 
@@ -130,8 +190,12 @@ existing element containers.
130
190
  ## 🔍 Mental Audit (Internal Self-Correction)
131
191
 
132
192
  *Before reporting back or committing, re-read the instructions and verify:*
133
- 1. ❓ **Tag Parity**: Did I accidentally change any `span` to `div` (or vice versa)?
134
- 2. ❓ **Attribute Drop**: Did I drop any `aria-*`, `role`, or custom data attributes?
135
- 3. ❓ **Clang-Off Boundary**: Is the template wrapped in `// clang-format off`?
136
- 4. ❓ **Build**: Does the code compile and do visual tests pass with 0% diff?
193
+ 1. ❓ **Named Imports**: Did I use named imports `{html, nothing, render}` from `ui/lit/lit.js` (and no `import * as Lit`)?
194
+ 2. ❓ **Tag Parity**: Did I accidentally change any `span` to `div` (or vice versa)?
195
+ 3. ❓ **Attribute Drop**: Did I drop any `aria-*`, `role`, or custom data attributes?
196
+ 4. ❓ **Clang-Off Boundary**: Is the template wrapped in `// clang-format off`?
197
+ 5. ❓ **Split Views**: Does `<devtools-split-view>` have `flex: auto; height: 100%;` CSS and reuse existing split settings?
198
+ 6. ❓ **String Audit**: Did I verify that any removed `UIStrings` weren't from accidentally dropped UI branches?
199
+ 7. ❓ **Build**: Does the code compile and do visual tests pass with 0% diff?
200
+
137
201
 
@@ -76,7 +76,29 @@ consolidating them into private helper methods with explicit data contracts.
76
76
  that first extracts the code that needs to be reordered into named
77
77
  helper functions and pause the migration, waiting for user confirmation.
78
78
 
79
- 6. **Wait for confirmation**:
79
+ 6. **No Write-Only State Fields in Prefactor CLs**:
80
+
81
+ * Do not introduce `#state` fields in a logic-consolidation CL that are only
82
+ written to in that CL and only read in the *next* CL's `DEFAULT_VIEW`.
83
+ * Either read them in the prefactor CL (e.g., inside an extracted imperative
84
+ `#render...` helper) or introduce them in the CL that actually adds
85
+ `DEFAULT_VIEW`.
86
+
87
+ 7. **Extract Imperative `#renderSubtreeContent()` Helpers**:
88
+
89
+ * For complex layouts, extracting an imperative `#renderFooContent()`
90
+ helper in Pass 1 (while keeping the outer container imperative) minimizes
91
+ the Pass 2/3 diff when converting `#renderFooContent()` to
92
+ `renderFooContent(input: ViewInput): LitTemplate`.
93
+
94
+ 8. **Preserve Imperative Cleanup Calls**:
95
+
96
+ * When consolidating DOM/widget references (e.g., replacing
97
+ `#tabbedLocationHeader` with `#debuggerSidebarTabbedLocation`), preserve
98
+ imperative cleanup calls like `splitWidget.uninstallResizer(...)` until the
99
+ imperative container itself is removed.
100
+
101
+ 9. **Wait for confirmation**:
80
102
 
81
103
  * Wait for an explicit confirmation from the user (or Parent Orchestrator Agent) before proceeding to the next step.
82
104
 
@@ -86,6 +108,8 @@ consolidating them into private helper methods with explicit data contracts.
86
108
 
87
109
  *Before reporting back or committing, re-read the instructions and verify:*
88
110
  1. ❓ **Minimal Diffs**: Did I move code blocks around unnecessarily?
89
- 2. ❓ **State Completeness**: Are all imperative DOM updates now backed by state variables?
90
- 3. ❓ **Build**: Does the code still compile?
111
+ 2. ❓ **State Completeness & Utility**: Are all state variables actually read in this CL, with no write-only placeholders?
112
+ 3. ❓ **Cleanup Preserved**: Are resizer/listener uninstallation calls preserved during reference consolidation?
113
+ 4. ❓ **Build**: Does the code still compile?
114
+
91
115
 
@@ -76,6 +76,26 @@ principles.
76
76
  clean and focused on high-level orchestration, prefer delegating intense
77
77
  execution tasks (like running tests, debugging compilations, or processing
78
78
  independent classes in parallel) to specialized subagents.
79
+ 13. **Cross-Repo Runtime Coupling Check (`legacy_test_runner` & `blink/web_tests`)**:
80
+ Before converting TypeScript `private` fields/methods to ES `#private` or
81
+ removing widget properties (e.g., `.tabbedPane`, `.sidebarPaneStack`,
82
+ `.threadsSidebarPane`, `.searchInputElement`), search both
83
+ `front_end/legacy_test_runner/**/*.js` and Chromium's
84
+ `third_party/blink/web_tests/http/tests/devtools/**/*.js` (which run on
85
+ `dtf_linux_rel` CQ via `blink_web_tests` and reflectively access private
86
+ members in untyped JS). Keep accessed members as TypeScript `private` with a
87
+ `// Accessed in web_tests / legacy_test_runner` comment, or migrate the
88
+ web_tests first in a dedicated CL.
89
+ 14. **Strict CL Splitting Rules**:
90
+ * **One Class Per CL for Hybrid Files**: When modernizing files containing
91
+ multiple classes, extract or migrate secondary classes (e.g.,
92
+ `QuickSourceView`) into their own dedicated CLs.
93
+ * **Separate Infrastructure CLs**: Keep shared `ui/legacy` or component
94
+ infrastructure changes (e.g., `bindToAction`, `SplitWidget`,
95
+ `WrapperWidget`) in separate, preceding CLs. Always verify with
96
+ `cog_api.py diff` before uploading that no changes from later commits
97
+ leaked into earlier infrastructure CLs.
98
+
79
99
 
80
100
 
81
101
  --------------------------------------------------------------------------------
@@ -129,6 +149,8 @@ The plan you generate **MUST** follow this structure:
129
149
  ## 🛠️ Passes Checklist
130
150
  - [ ] **Pass 0: Baseline & Safety Scaffolding**
131
151
  - Assigned to: `ui-eng-vision-test-scaffolder`
152
+ - [ ] **Pass 0.5: Privatize & Dead-Code Cleanup**
153
+ - Mechanical prefactor: convert TypeScript `private` to ES `#private` and remove dead code
132
154
  - [ ] **Pass 1: Logic Consolidation**
133
155
  - Assigned to: `ui-eng-vision-logic-consolidator`
134
156
  - [ ] **Pass 2: Lit-HTML Rendering**
@@ -149,10 +171,18 @@ The plan you generate **MUST** follow this structure:
149
171
  regressions.
150
172
  2. Pay extra attention not to skip this step.
151
173
 
174
+ ### Privatize & Dead-Code Cleanup (Pass 0.5)
175
+
176
+ * **Trigger Condition**: Baseline tests green.
177
+ * **Actions**:
178
+ 1. Perform the **Cross-Repo Runtime Coupling Check** against `legacy_test_runner` and `blink_web_tests` first.
179
+ 2. Convert internal TypeScript `private` fields/methods to ES `#private` (except those reflectively accessed by web tests).
180
+ 3. Identify and remove unused dead code, redundant containers, or obsolete split widgets in a dedicated prefactor CL so mechanical renames don't clutter logic and view CLs.
181
+ 4. Verify that all tests and lints pass and stage this prefactor CL before proceeding to logic consolidation.
182
+
152
183
  ### Logic Consolidation
153
184
 
154
- * **Trigger Condition**: Baseline tests green (or respective previous pass
155
- staged).
185
+ * **Trigger Condition**: Pass 0.5 staged (or baseline tests green if 0.5 skipped).
156
186
  * **Subskill to Import/Delegate**: `ui-eng-vision-logic-consolidator` (Delegate to a subagent to maintain focus)
157
187
  * **Actions**:
158
188
  1. Extract manual elements, constructor DOM configurations, and imperative
@@ -65,20 +65,23 @@ logical regressions are introduced during modernization.
65
65
 
66
66
  Always detect the execution environment first to run tests successfully:
67
67
 
68
- ### Scenario A: Google-Internal Cog/Cider Workspaces (PRIMARY PATH for Google Workspaces)
68
+ ### Scenario A: Google-Internal Cog Workspaces (PRIMARY PATH for Google Workspaces)
69
69
 
70
70
  * **Detection**: Triggered if the workspace path starts with `/google/cog/` or
71
71
  `/google/src/`.
72
- * **Why it is required**: Raw commands like `./dt test` or `autoninja` fail
73
- because they lack Google cloudtop/virtualization wrapper configurations.
72
+ * **Execution Guide**: Follow [`devtools-verification`](../devtools-verification/SKILL.md).
74
73
  * **Resolution Steps**:
75
74
 
76
- 1. Do not run `./dt test` or standard `autoninja` directly.
77
- 2. Leverage the Google-specific Cider testing script to compile and run
78
- tests in the cloud workspace:
75
+ 1. Ensure `depot_tools` is at the front of your `PATH`:
79
76
 
80
77
  ```bash
81
- python3 internal/infra/scripts/cider/init_workspace.py test /google/cog/cloud/username/workspace_name --test_filter=front_end/panels/application/IndexedDBViews.test.ts
78
+ export PATH="/path/to/depot_tools:$PATH"
79
+ ```
80
+
81
+ 2. Execute tests using `./dt test` directly from `chromium/third_party/devtools-frontend/src`:
82
+
83
+ ```bash
84
+ ./dt test front_end/panels/application/IndexedDBViews.test.ts
82
85
  ```
83
86
 
84
87
  ### Scenario B: Standard Chromium Environment (Fallback)
@@ -133,6 +136,33 @@ Always detect the execution environment first to run tests successfully:
133
136
  3. If it's a layout shift, check if you replaced a block element with an inline element (e.g. `div` -> `span`).
134
137
  4. If styles are missing, verify if the test wrapper needs `{includeCommonStyles: true}`.
135
138
 
139
+ ### Scenario E: Lightweight Test Hook Gotchas (`describe` vs `describeWithEnvironment`)
140
+
141
+ * Prefer `describe` with lightweight hooks (`setupLocaleHooks()`, `setupSettingsHooks()`) when full `describeWithEnvironment` is unnecessary.
142
+ * **Always reset singleton registries in `afterEach`**:
143
+ When registering actions, shortcuts, or context menus in tests, singleton registries MUST be reset in `afterEach`:
144
+
145
+ ```typescript
146
+ afterEach(() => {
147
+ UI.ActionRegistration.reset();
148
+ UI.ActionRegistry.ActionRegistry.reset();
149
+ UI.ShortcutRegistry.ShortcutRegistry.removeInstance();
150
+ });
151
+ ```
152
+
153
+ Without these resets, repeated runs (such as `--repeat=10` or CQ flake detection) will fail on iteration 2+ with `Duplicate action ID: '...'`.
154
+
155
+ * **GlassPane Container Setup**:
156
+ If testing UI that opens a `GlassPane` or long-press option menu (e.g. `bindToAction` with long-press buttons) in a test suite using `describe` without `describeWithEnvironment`, call:
157
+
158
+ ```typescript
159
+ beforeEach(() => {
160
+ UI.GlassPane.GlassPane.setContainer(document.body);
161
+ });
162
+ ```
163
+
164
+ Otherwise, menu rendering will fail because `GlassPane` lacks an attached container element.
165
+
136
166
  --------------------------------------------------------------------------------
137
167
 
138
168
  ## 🔍 Mental Audit (Internal Self-Correction)
@@ -28,11 +28,11 @@ clean `UI.Widget` classes that use native update rendering delegates.
28
28
  2. **Upgrade View Delegates & Inject View**:
29
29
 
30
30
  * Migrate the local Lit template strings into a formally exported default
31
- view layout:
31
+ view layout (using named imports `import {html, render} from '../../ui/lit/lit.js';`):
32
32
 
33
33
  ```typescript
34
34
  export const DEFAULT_VIEW: View = (input, output, target) => {
35
- Lit.render(html`...`, target);
35
+ render(html`...`, target);
36
36
  };
37
37
  ```
38
38
 
@@ -67,12 +67,13 @@ clean `UI.Widget` classes that use native update rendering delegates.
67
67
 
68
68
  * Remove any `LegacyWrapper` bindings or custom wrappable custom elements.
69
69
  * Replace old panel instantiations with standard `<devtools-widget>`
70
- declarative entries:
70
+ declarative entries (using `const {widget} = UI.Widget;`):
71
71
 
72
72
  ```typescript
73
- html`<devtools-widget .widgetConfig=${widgetConfig(MyWidgetClass, [params])}></devtools-widget>`
73
+ html`<devtools-widget ${widget(MyWidgetClass, {params})}></devtools-widget>`
74
74
  ```
75
75
 
76
+ * **Strongly prefer the two-argument `widget(MyWidgetClass, {params})` form** over the single-argument factory callback `widget(element => new MyWidgetClass(element, ...))`. The single-argument factory only runs on initial creation and does not update properties on subsequent re-renders. If the child widget only exposes `setFoo(...)` methods, convert them into `set foo(...)` setters so they can be passed via the second argument of `widget()`.
76
77
  * Inspect instantiator files (e.g., `ApplicationPanelSidebar.ts`) and
77
78
  decouple any direct accesses to `.element`.
78
79
 
@@ -81,7 +82,7 @@ clean `UI.Widget` classes that use native update rendering delegates.
81
82
  ## 2. Safety & Verification Rules
82
83
 
83
84
  * **CRITICAL**: Never update screenshot goldens without explicit consent of the user. Most likely the failure points to an issue in the implementation or (less likely) the test itself. Look at the screenshot diffs to debug.
84
- * **Minimal Code Movement**: When migrating, try to move code around as little as possible, in particular around the lit rendering helpers. This minimizes the git diff and improves reviewability.
85
+ * **Minimal Code Movement & Helper Topology**: When migrating, try to move code around as little as possible, in particular around the lit rendering helpers. Preserve existing standalone/module-level DOM helper functions (e.g., `linkifyIcon`, `maybeCreateLinkToElementsPanel`) and async class update helpers in their original locations, having DOM helpers return `LitTemplate` (or `Promise<LitTemplate|null>`) rather than deleting and inlining them into `performUpdate()` or `DEFAULT_VIEW`. This minimizes the git diff and improves reviewability.
85
86
 
86
87
  --------------------------------------------------------------------------------
87
88