chrome-devtools-frontend 1.0.1662965 → 1.0.1664619

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 (319) hide show
  1. package/.agents/skills/{creating-a-model → devtools-model-management}/SKILL.md +0 -1
  2. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +4 -3
  3. package/.agents/skills/fixing-skipped-tests/SKILL.md +3 -3
  4. package/.agents/skills/merging-devtools-module/SKILL.md +1 -1
  5. package/.agents/skills/migrate-chromium-test/SKILL.md +3 -2
  6. package/.agents/skills/repro-flaky-tests/SKILL.md +71 -31
  7. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +1 -0
  8. package/.agents/skills/version-control/SKILL.md +4 -3
  9. package/docs/ui_engineering.md +91 -0
  10. package/eslint.config.mjs +1 -1
  11. package/front_end/core/common/Settings.ts +75 -0
  12. package/front_end/core/host/AidaClient.ts +19 -4
  13. package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
  14. package/front_end/core/host/ResourceLoader.ts +15 -15
  15. package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +112 -0
  16. package/front_end/core/sdk/CPUProfilerModel.ts +21 -13
  17. package/front_end/core/sdk/CSSContainerQuery.ts +1 -1
  18. package/front_end/core/sdk/CSSLayer.ts +1 -1
  19. package/front_end/core/sdk/CSSMatchedStyles.ts +75 -0
  20. package/front_end/core/sdk/CSSMedia.ts +1 -1
  21. package/front_end/core/sdk/CSSModel.ts +1 -1
  22. package/front_end/core/sdk/CSSNavigation.ts +1 -1
  23. package/front_end/core/sdk/CSSProperty.ts +1 -1
  24. package/front_end/core/sdk/CSSQuery.ts +1 -1
  25. package/front_end/core/sdk/CSSRule.ts +1 -1
  26. package/front_end/core/sdk/CSSScope.ts +1 -1
  27. package/front_end/core/sdk/CSSStartingStyle.ts +1 -1
  28. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  29. package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
  30. package/front_end/core/sdk/CSSSupports.ts +1 -1
  31. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
  32. package/front_end/core/sdk/NetworkManager.ts +1 -1
  33. package/front_end/core/sdk/NetworkRequest.ts +10 -10
  34. package/front_end/core/sdk/Resource.ts +1 -1
  35. package/front_end/core/sdk/ScopeTreeCache.ts +1 -1
  36. package/front_end/core/sdk/Script.ts +1 -1
  37. package/front_end/core/sdk/ServerSentEvents.ts +1 -1
  38. package/front_end/core/sdk/SourceMap.ts +1 -1
  39. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  40. package/front_end/core/sdk/sdk-meta.ts +3 -3
  41. package/front_end/{models → core}/text_utils/ContentProvider.ts +4 -6
  42. package/front_end/{models → core}/text_utils/StaticContentProvider.ts +4 -6
  43. package/front_end/{models → core}/text_utils/StreamingContentData.ts +1 -2
  44. package/front_end/{models → core}/text_utils/TextRange.ts +6 -3
  45. package/front_end/{models → core}/text_utils/TextUtils.ts +7 -7
  46. package/front_end/{models → core}/text_utils/WasmDisassembly.ts +2 -2
  47. package/front_end/core/text_utils/text_utils.ts +27 -0
  48. package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +1 -1
  49. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +1 -1
  50. package/front_end/entrypoints/main/MainImpl.ts +15 -1
  51. package/front_end/entrypoints/main/main-meta.ts +0 -15
  52. package/front_end/entrypoints/shell/shell.ts +1 -0
  53. package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
  54. package/front_end/foundation/Universe.ts +2 -1
  55. package/front_end/models/ai_assistance/AgentProject.ts +1 -1
  56. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +3 -6
  57. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -2
  58. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +19 -11
  59. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
  60. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -10
  61. package/front_end/models/ai_assistance/agents/StorageAgent.ts +19 -18
  62. package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -3
  63. package/front_end/models/ai_assistance/contexts/FileContext.ts +7 -3
  64. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +39 -11
  65. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +14 -4
  66. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +9 -3
  67. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +4 -4
  68. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
  69. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +76 -3
  70. package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -2
  71. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -2
  72. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +8 -1
  73. package/front_end/models/badges/AiExplorerBadge.ts +8 -3
  74. package/front_end/models/badges/Badge.ts +1 -0
  75. package/front_end/models/badges/UserBadges.ts +11 -5
  76. package/front_end/models/badges/badges-meta.ts +27 -0
  77. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -3
  78. package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
  79. package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
  80. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -2
  81. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +5 -4
  82. package/front_end/models/bindings/DefaultScriptMapping.ts +1 -1
  83. package/front_end/models/bindings/FileUtils.ts +1 -1
  84. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +25 -21
  85. package/front_end/models/bindings/ResourceMapping.ts +39 -33
  86. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
  87. package/front_end/models/bindings/SASSSourceMapping.ts +1 -1
  88. package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
  89. package/front_end/models/breakpoints/BreakpointManager.ts +3 -2
  90. package/front_end/models/crux-manager/CrUXManager.ts +1 -1
  91. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  92. package/front_end/models/har/Importer.ts +1 -1
  93. package/front_end/models/har/Writer.ts +3 -3
  94. package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
  95. package/front_end/models/issues_manager/IssuesManager.ts +9 -2
  96. package/front_end/models/issues_manager/LazyLoadImageIssue.ts +76 -0
  97. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +6 -2
  98. package/front_end/models/issues_manager/descriptions/lazyLoadImageZeroSize.md +7 -0
  99. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  100. package/front_end/models/javascript_metadata/NativeFunctions.js +9 -10
  101. package/front_end/models/live-metrics/LiveMetrics.ts +2 -3
  102. package/front_end/models/logs/NetworkLog.ts +4 -3
  103. package/front_end/models/logs/logs-meta.ts +23 -16
  104. package/front_end/models/network_time_calculator/NetworkTimeCalculator.ts +4 -4
  105. package/front_end/models/persistence/Automapping.ts +1 -1
  106. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
  107. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
  108. package/front_end/models/persistence/IsolatedFileSystem.ts +2 -2
  109. package/front_end/models/persistence/NetworkPersistenceManager.ts +1 -1
  110. package/front_end/models/persistence/PersistenceImpl.ts +1 -1
  111. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  112. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +1 -1
  113. package/front_end/models/source_map_scopes/NamesResolver.ts +105 -87
  114. package/front_end/models/source_map_scopes/ScopeChainModel.ts +6 -2
  115. package/front_end/models/text_utils/text_utils.ts +2 -24
  116. package/front_end/models/trace/handlers/UserTimingsHandler.ts +17 -6
  117. package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
  118. package/front_end/models/trace/insights/LegacyJavaScript.ts +1 -1
  119. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  120. package/front_end/models/trace/insights/ThirdParties.ts +1 -1
  121. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +2 -2
  122. package/front_end/models/workspace/FileManager.ts +1 -1
  123. package/front_end/models/workspace/UISourceCode.ts +1 -1
  124. package/front_end/models/workspace/WorkspaceImpl.ts +1 -1
  125. package/front_end/models/workspace_diff/WorkspaceDiff.ts +13 -8
  126. package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -1
  127. package/front_end/panels/accessibility/AccessibilityStrings.ts +2 -2
  128. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
  129. package/front_end/panels/ai_assistance/ExportConversation.ts +1 -1
  130. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +1 -1
  131. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  132. package/front_end/panels/ai_assistance/components/ChatInput.ts +21 -17
  133. package/front_end/panels/ai_assistance/components/ChatMessage.ts +8 -1
  134. package/front_end/panels/ai_assistance/components/ImageResize.ts +74 -0
  135. package/front_end/panels/animation/animationTimeline.css +0 -2
  136. package/front_end/panels/application/AppManifestView.ts +4 -4
  137. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -2
  138. package/front_end/panels/application/CrashReportContextView.ts +1 -1
  139. package/front_end/panels/application/DOMStorageItemsView.ts +1 -1
  140. package/front_end/panels/application/DeviceBoundSessionsView.ts +4 -4
  141. package/front_end/panels/application/ExtensionStorageItemsView.ts +1 -1
  142. package/front_end/panels/application/FrameDetailsView.ts +1 -1
  143. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +12 -2
  144. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  145. package/front_end/panels/application/application.ts +2 -0
  146. package/front_end/panels/application/components/BackForwardCacheView.ts +21 -5
  147. package/front_end/panels/application/components/CrashReportContextGrid.ts +1 -1
  148. package/front_end/panels/application/components/TrustTokensView.ts +2 -2
  149. package/front_end/panels/application/preloading/PreloadingView.ts +1 -1
  150. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
  151. package/front_end/panels/application/preloading/components/PreloadingString.ts +2 -2
  152. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -4
  153. package/front_end/panels/autofill/AutofillView.ts +1 -1
  154. package/front_end/panels/changes/ChangesSidebar.ts +1 -1
  155. package/front_end/panels/changes/ChangesView.ts +3 -4
  156. package/front_end/panels/changes/CombinedDiffView.ts +2 -2
  157. package/front_end/panels/changes/changes-meta.ts +2 -2
  158. package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
  159. package/front_end/panels/common/ExtensionServer.ts +1 -1
  160. package/front_end/panels/common/aiCodeCompletionDisclaimer.css +0 -1
  161. package/front_end/panels/console/ConsoleFilter.ts +1 -1
  162. package/front_end/panels/console/ConsolePrompt.ts +3 -1
  163. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  164. package/front_end/panels/console/ConsoleView.ts +1 -1
  165. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  166. package/front_end/panels/console/PromptBuilder.ts +1 -1
  167. package/front_end/panels/coverage/CoverageDecorationManager.ts +9 -1
  168. package/front_end/panels/coverage/CoverageModel.ts +1 -1
  169. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
  170. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  171. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  172. package/front_end/panels/elements/AccessibilityTreeView.ts +38 -3
  173. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +1 -1
  174. package/front_end/panels/elements/ElementIssueUtils.ts +2 -2
  175. package/front_end/panels/elements/ElementsTreeElement.ts +10 -3
  176. package/front_end/panels/elements/LayoutPane.ts +19 -9
  177. package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
  178. package/front_end/panels/elements/StylePropertiesSection.ts +34 -6
  179. package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
  180. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -1
  181. package/front_end/panels/elements/StylesContainer.ts +1 -1
  182. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  183. package/front_end/panels/elements/components/CSSPropertyDocsView.ts +1 -1
  184. package/front_end/panels/emulation/DeviceModeToolbar.ts +92 -32
  185. package/front_end/panels/emulation/DeviceModeView.ts +5 -4
  186. package/front_end/panels/emulation/MediaQueryInspector.ts +33 -17
  187. package/front_end/panels/explain/components/ConsoleInsight.ts +2 -2
  188. package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +76 -0
  189. package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
  190. package/front_end/panels/issues/CorsIssueDetailsView.ts +1 -1
  191. package/front_end/panels/issues/IssueView.ts +2 -0
  192. package/front_end/panels/issues/issues.ts +2 -0
  193. package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
  194. package/front_end/panels/lighthouse/LighthouseController.ts +5 -0
  195. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -1
  196. package/front_end/panels/network/BinaryResourceView.ts +1 -1
  197. package/front_end/panels/network/NetworkDataGridNode.ts +29 -7
  198. package/front_end/panels/network/NetworkLogView.ts +1 -1
  199. package/front_end/panels/network/NetworkLogViewColumns.ts +7 -7
  200. package/front_end/panels/network/NetworkPanel.ts +4 -4
  201. package/front_end/panels/network/NetworkSearchScope.ts +1 -1
  202. package/front_end/panels/network/RequestConditionsDrawer.ts +1 -1
  203. package/front_end/panels/network/RequestHTMLView.ts +1 -1
  204. package/front_end/panels/network/RequestPayloadView.ts +1 -1
  205. package/front_end/panels/network/RequestPreviewView.ts +1 -1
  206. package/front_end/panels/network/RequestResponseView.ts +1 -1
  207. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  208. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -1
  209. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -1
  210. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  211. package/front_end/panels/network/forward/UIRequestLocation.ts +1 -1
  212. package/front_end/panels/network/network-meta.ts +3 -3
  213. package/front_end/panels/network/networkTimingTable.css +2 -2
  214. package/front_end/panels/profiler/BottomUpProfileDataGrid.ts +0 -4
  215. package/front_end/panels/profiler/HeapProfileView.ts +59 -39
  216. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  217. package/front_end/panels/profiler/ProfileDataGrid.ts +12 -8
  218. package/front_end/panels/profiler/TopDownProfileDataGrid.ts +0 -4
  219. package/front_end/panels/profiler/profilesPanel.css +9 -13
  220. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -1
  221. package/front_end/panels/recorder/RecorderPanel.ts +493 -381
  222. package/front_end/panels/recorder/RecordingListView.ts +8 -37
  223. package/front_end/panels/recorder/RecordingView.ts +54 -27
  224. package/front_end/panels/recorder/SelectorPicker.ts +0 -13
  225. package/front_end/panels/recorder/StepEditor.ts +6 -14
  226. package/front_end/panels/recorder/StepView.ts +36 -105
  227. package/front_end/panels/search/SearchResultsPane.ts +1 -1
  228. package/front_end/panels/security/SecurityPanel.ts +3 -3
  229. package/front_end/panels/sensors/LocationsSettingsTab.ts +245 -232
  230. package/front_end/panels/settings/AISettingsTab.ts +4 -4
  231. package/front_end/panels/settings/SettingsScreen.ts +29 -24
  232. package/front_end/panels/settings/components/SyncSection.ts +4 -4
  233. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +3 -3
  234. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
  235. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  236. package/front_end/panels/sources/CoveragePlugin.ts +1 -1
  237. package/front_end/panels/sources/DebuggerPlugin.ts +10 -7
  238. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +27 -3
  239. package/front_end/panels/sources/NavigatorView.ts +1 -1
  240. package/front_end/panels/sources/PersistenceActions.ts +1 -1
  241. package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -1
  242. package/front_end/panels/sources/SourcesNavigator.ts +1 -1
  243. package/front_end/panels/sources/SourcesSearchScope.ts +1 -1
  244. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -3
  245. package/front_end/panels/sources/UISourceCodeFrame.ts +1 -1
  246. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -1
  247. package/front_end/panels/sources/components/HeadersView.ts +1 -1
  248. package/front_end/panels/sources/filteredUISourceCodeListProvider.css +12 -1
  249. package/front_end/panels/sources/sources-meta.ts +1 -1
  250. package/front_end/panels/timeline/StatusDialog.ts +1 -1
  251. package/front_end/panels/timeline/TimelineController.ts +24 -3
  252. package/front_end/panels/timeline/TimelinePanel.ts +116 -25
  253. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +2 -2
  254. package/front_end/panels/timeline/TimelineUIUtils.ts +3 -3
  255. package/front_end/panels/timeline/components/CWVMetrics.ts +1 -1
  256. package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
  257. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
  258. package/front_end/panels/timeline/timeline-meta.ts +13 -0
  259. package/front_end/panels/whats_new/ReleaseNoteText.ts +8 -8
  260. package/front_end/panels/whats_new/resources/WNDT.md +7 -8
  261. package/front_end/services/tracing/TracingManager.ts +27 -2
  262. package/front_end/third_party/chromium/README.chromium +1 -1
  263. package/front_end/third_party/lighthouse/README.chromium +2 -2
  264. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1418 -1413
  265. package/front_end/third_party/lighthouse/locales/en-US.json +12 -6
  266. package/front_end/third_party/lighthouse/locales/en-XL.json +12 -6
  267. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  268. package/front_end/third_party/puppeteer/puppeteer.ts +20 -1
  269. package/front_end/ui/components/highlighting/HighlightElement.ts +4 -1
  270. package/front_end/ui/components/highlighting/HighlightManager.ts +7 -2
  271. package/front_end/ui/components/highlighting/MarkupHighlight.ts +1 -1
  272. package/front_end/ui/components/markdown_view/MarkdownView.ts +46 -2
  273. package/front_end/ui/components/markdown_view/markdownView.css +23 -0
  274. package/front_end/ui/components/settings/SettingCheckbox.ts +12 -7
  275. package/front_end/ui/components/text_editor/config.ts +1 -1
  276. package/front_end/ui/components/text_editor/javascript.ts +3 -1
  277. package/front_end/ui/components/tree_outline/TreeOutline.ts +7 -1
  278. package/front_end/ui/legacy/Infobar.ts +1 -1
  279. package/front_end/ui/legacy/InspectorView.ts +12 -7
  280. package/front_end/ui/legacy/SuggestBox.ts +1 -1
  281. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  282. package/front_end/ui/legacy/Toolbar.ts +9 -3
  283. package/front_end/ui/legacy/Treeoutline.ts +26 -7
  284. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -1
  285. package/front_end/ui/legacy/components/color_picker/spectrum.css +1 -2
  286. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +25 -2
  287. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +1 -1
  288. package/front_end/ui/legacy/components/data_grid/dataGrid.css +1 -1
  289. package/front_end/ui/legacy/components/inline_editor/AnimationTimingUI.ts +27 -13
  290. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +5 -2
  291. package/front_end/ui/legacy/components/inline_editor/CSSLinearEasingModel.ts +23 -0
  292. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +3 -1
  293. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +161 -54
  294. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +14 -11
  295. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -1
  296. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +14 -4
  297. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +1 -1
  298. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
  299. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  300. package/front_end/ui/legacy/components/source_frame/JSONView.ts +105 -115
  301. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -1
  302. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +1 -1
  303. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -3
  304. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +1 -1
  305. package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -1
  306. package/front_end/ui/legacy/components/source_frame/jsonView.css +4 -0
  307. package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -1
  308. package/front_end/ui/legacy/inspectorCommon.css +6 -2
  309. package/front_end/ui/settings/SettingUIRegistration.ts +110 -0
  310. package/front_end/ui/settings/settings.ts +9 -0
  311. package/front_end/ui/visual_logging/KnownContextValues.ts +13 -0
  312. package/mcp/mcp.ts +2 -0
  313. package/package.json +4 -4
  314. /package/.agents/skills/{verification → devtools-verification}/SKILL.md +0 -0
  315. /package/front_end/{models → core}/text_utils/CodeMirrorUtils.ts +0 -0
  316. /package/front_end/{models → core}/text_utils/ContentData.ts +0 -0
  317. /package/front_end/{models → core}/text_utils/Text.ts +0 -0
  318. /package/front_end/{models → core}/text_utils/TextCursor.ts +0 -0
  319. /package/front_end/{models → core}/text_utils/TextUtils.snapshot.txt +0 -0
@@ -1,4 +1,3 @@
1
- ```
2
1
  ---
3
2
  name: devtools-model-management
4
3
  description: Guidelines for creating, migrating, and registering models in front_end/models/. Covers BUILD.gn, devtools_grd_files.gni, and entrypoints.
@@ -52,7 +52,7 @@ Locate all TypeScript files in the target folder that define `const UIStrings =
52
52
  * *Check sibling references:* If you change a setting name or label (for example, changing “Preserve log” to “Keep log”), search sibling files in the folder for explanatory text or status strings that reference the old name in quotes (for example, “console.clear() was prevented due to ‘Preserve log’”), and update them to match.
53
53
  2. **Cut unnecessary words:** Eliminate politeness (`please`, `sorry`), filler (`very`, `strongly`, `there is` or `there are`), and marketing fluff (`seamless`, `awesome`, `fast`, `quick`).
54
54
  3. **Contractions:** Use contractions (`don’t`, `can’t`, `isn’t`, `won’t`) instead of formal spellings (`do not`, `cannot`, `is not`, `will not`).
55
- 4. **Curly apostrophes, quotation marks, and ellipses:** Use curly apostrophes (`’`) and quotation marks (`“ ”`) for improved readability. Use the ellipsis character (`…`) instead of three periods (`...`). Use prime (`′`) and double prime (`″`) symbols as needed for measurements like length or coordinates.
55
+ 4. **Curly apostrophes, quotation marks, and ellipses:** Use curly apostrophes (`’`) in user-facing `UIStrings` values for contractions and possessives, and quotation marks (`“ ”`) for improved readability. Use the ellipsis character (`…`) instead of three periods (`...`). Use prime (`′`) and double prime (`″`) symbols as needed for measurements like length or coordinates.
56
56
  5. **Sentence case and capitalization:** Use sentence case for headings, labels, and UI element names. Capitalize only the first word, proper nouns, product names (`Chrome DevTools`), and web APIs (`Background Fetch API`).
57
57
  * Don’t capitalize feature names (for example, `conditional breakpoint` or `command menu`).
58
58
  * Capitalize panel names and UX elements that are named after panels (for example, `Show Application`, `Toggle Console`, `Console sidebar`, or `Styles`).
@@ -62,6 +62,7 @@ Locate all TypeScript files in the target folder that define `const UIStrings =
62
62
  6. **Punctuation and actionability:** Remove trailing periods from single-sentence labels or titles. Ensure that error messages instruct the user how to recover (for example, `Shorten filename to 64 characters or less` instead of `Invalid filename`). Ensure that ARIA labels and multi-sentence tooltips have consistent terminal punctuation.
63
63
  7. **Terminology (glossary):** Strictly follow standard DevTools UI terminology and letter casing (`panel`, `tab`, `drawer`, `sidebar`, `datagrid` or `table`, `action bar`, `status bar`, and `live expressions section`). Never use `pane` or call tabs `panes` in UI strings or localization (L10n) comments.
64
64
  8. **Localization (L10n) comments:** Ensure that every string in `UIStrings` has a preceding `@description` comment that explains where and when it appears. This information is used for translators who need to understand the context in which the string is used.
65
+ * **Straight apostrophes in comments:** Always use straight apostrophes (`'`) in code comments (such as `@description` comments and L10n annotations), even if the UI string itself uses curly apostrophes (`’`).
65
66
  * Use precise terminology and correct letter casing (see rule 7). Ensure that the description is easy to understand and provides enough context for translators. For descriptions that are underspecified or
66
67
  ambiguous, figure out the context by looking at the use site of the
67
68
  string and come up with a better description.
@@ -111,9 +112,9 @@ When all tests and presubmit checks pass, commit your changes and upload the CL
111
112
  *(If you update an existing commit on this branch, use `git commit --amend`).*
112
113
 
113
114
  2. **Upload the CL to Gerrit**
114
- Upload the CL using `git cl upload`. Provide a dynamic summary of changes (depending on the actual content of the change) and the bug trailer:
115
+ Upload the CL using `git cl upload -f`. Always pass `-f` (`--force`) to prevent `git cl upload` from prompting or opening an interactive text editor in background agent shells:
115
116
  ```bash
116
- git cl upload -d --commit-description="Ensure consistent UI Strings in <folder_path>
117
+ git cl upload -f -d --commit-description="Ensure consistent UI Strings in <folder_path>
117
118
 
118
119
  Summary of changes:
119
120
  - <dynamically list specific words replaced, contractions adopted, or sentence case fixes>
@@ -20,10 +20,10 @@ This skill outlines the workflow for fixing skipped tests in the DevTools codeba
20
20
  - You should look for occurrences like `it.skip('[crbug.com/<bugid>] ...', ...)` or skipped describes that mention the bug ID.
21
21
 
22
22
  4. **Iterative Fix Process**
23
- - **Step 1:** Change `it.skip` or `describe.skip` to `it.only` or `describe.only` for *one* of the tests associated with the bug, so that only that specific test runs.
24
- - **Step 2:** Re-run the tests (e.g., `npm run test -- <path_to_test_file>`) using the guidelines from the `devtools-verification` skill. If you are dealing with flaky tests, you can use the `--repeat=x` flag (e.g. `npm run test -- <path_to_test_file> --repeat=20`) to run the test multiple times to reproduce the flakiness.
23
+ - **Step 1:** Remove `it.skip` or `describe.skip` for *one* of the tests associated with the bug.
24
+ - **Step 2:** Re-run the specific test using its exact test ID (e.g., `npm run test path/to/foo.test.ts:test_name`) using the guidelines from the `devtools-verification` skill. If you are dealing with flaky tests, you can use the `--repeat=x` flag (e.g. `npm run test -- --repeat=20 path/to/foo.test.ts:test_name`) to run the test multiple times to reproduce the flakiness. This flag works for both E2E and unit tests.
25
25
  - **Step 3:** Analyze the test failure and make the necessary fixes to the code or the test itself.
26
- - **Step 4:** Re-run the test to ensure the fix is correct. Remove `.only`.
26
+ - **Step 4:** Re-run the test to ensure the fix is correct.
27
27
  - **Step 5:** Remove the `[crbug.com/<bugid>]` prefix from the test name string if it is present.
28
28
  - **Step 6:** Remove any comments directly above the test that explain the reason why the test was skipped (e.g., `// TODO(crbug...): Flaky`).
29
29
  - **Step 7:** Apply the fix to the remaining tests, un-skipping them one by one or in batches, and verifying until all are passing.
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: devtools-module-merging
2
+ name: merging-devtools-module
3
3
  description: Workflow for merging a DevTools submodule into its parent module. Covers BUILD.gn consolidation and updating devtools_grd_files.gni.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: devtools-migrate-chromium-test
2
+ name: migrate-chromium-test
3
3
  description: Use when migrating Chromium layout tests to DevTools unit tests
4
4
  ---
5
5
 
@@ -26,6 +26,7 @@ description: Use when migrating Chromium layout tests to DevTools unit tests
26
26
  - If tests require a repetitive setup extract it into a test helper function at the top of the file.
27
27
  - Code comments must be full sentences ending with a period, except when the entire comment is a URL.
28
28
  - Do not include comments of the form `// Replaces web test: http/tests/devtools/persistence/automapping-absolute-paths.js`. Since we plan to remove migrated web tests, these are not useful references.
29
+ - **Important** If the test imports only `TestRunner` and no other TestRunner helper or DevTools code. The test should be move to the inspector-protocol test, and the issue should be closed as "Won't Fix (Infeasible)" and add the issue to the hotlist with ID 8691563.
29
30
 
30
31
  4. **Update BUILD.gn**:
31
32
 
@@ -40,7 +41,7 @@ description: Use when migrating Chromium layout tests to DevTools unit tests
40
41
 
41
42
  - Critically review the newly created test to ensure it provides meaningful coverage. Cross-reference it with the original Chromium layout test to verify that all original behaviors, edge cases, and assertions have been fully migrated and are actively being tested.
42
43
  - If the newly added test does not test any logic from the component but just the getters from the mocked data explain to the user that this test does not add value and it's better to close it without adding the test. Provide a command without executing it to close the issue as "Fixed".
43
- - If the newly added test uses too extensive mocks of CDP objects and methods explain to the user that the test should be foundation e2e test instead of unit test and we won't migrate it. Provide a command without executing it to close the issue as "Won't Fix (Infeasible)".
44
+ - If the newly added test uses too extensive mocks of CDP objects and methods explain to the user that the test should be foundation e2e test instead of unit test and we won't migrate it. **CRITICAL** upload a comment to the issue with your investigation and the reason why you won't submit a CL and close the issue as "Won't Fix (Infeasible)" and add the issue to the hotlist with ID 8687901.
44
45
 
45
46
  7. **Upload the CL:**
46
47
 
@@ -1,53 +1,93 @@
1
1
  ---
2
- name: repro-flaky-test
2
+ name: repro-flaky-tests
3
3
  description: Reproduce and investigate flakiness in a test.
4
4
  ---
5
5
 
6
- # Fixing flaky Tests
6
+ # Workflow
7
7
 
8
- This skill outlines the workflow for reproducing and fixing a flaky test in the DevTools codebase.
9
-
10
- ## Workflow
8
+ This skill outlines the workflow for reproducing and fixing a flaky test in the DevTools codebase. The work should be divided into sub-agents that should only be started when certain criteria are met.
11
9
 
12
10
  - You will be given as input, either a Chromium bug link (e.g. `crbug.com/1234567`), or a name of a test file and (optionally) the test name.
13
11
  - For example: e2e/extensions/debugger-language-plugins.test.ts and "The Debugger Language Plugins/shows sensible error messages".
14
- - If nothing is provided, as the user which test you should run.
15
- - Find the test in the codebase and look at its implementation.
16
- - Run the test three times to note how long the test runs (on average) per minute.
12
+ - If nothing is provided, ask the user which test you should run.
13
+ - Before starting the sub-agents, explain the workflow. For example:
14
+
15
+ ```
16
+ I will attempt to reproduce the flakiness (simultaneously) locally and using the 'stressor bots'. Once issues are discovered, I will attempt to fix them.
17
+ ```
17
18
 
18
- ## Reproduction
19
+ ## Reproduction agents
19
20
 
20
- - Run the test enough times for a full test run to take one minute. For example, if a test takes a second to run, set it to repeat 60 times. If a test takes 5 seconds to run, run it 12 times.
21
- - Start with one minute and, if the failure does not repeat, try again and increase the time by a minute (up to a maximum of 5 minutes per run).
22
- - Use `npm run test -- path/to/foo.test.ts --grep "<test name>" --repeat <count>` to run the tests repeatedly.
23
- - Be sure to keep track of the cumulative count of how often you run the test and how often they fail, so that you can calculate a 'flaky percentage' before and after making a fix.
21
+ First, create and start two sub-agents simultaneously. One called 'local-repro' (that should attempt to reproduce the problem locally) and one called 'bot-repro' (that attempts to use the stressor bots to reproduce).
24
22
 
25
- After every round, display the *cumulative* results in a table:
23
+ ### Local reproduction (local-repro)
24
+
25
+ - Use command: `npm run test -- --repeat=<count> path/to/foo.test.ts:exact_test_id` to locally run the tests repeatedly. Both E2E and unit tests support this. Use the exact test ID printed in the test runner output (usually the suite and test names with spaces replaced by underscores). Do not use `--grep` or a `bash` script with a `for` loop.
26
+ - First run the test three times to note how long the test runs (on average).
27
+ - Then run the test continuously for 4 minutes, while noting any failures and failure rates. If the failure rate is still 0% after that, assume the problem does not reproduce locally.
28
+ - After the local test run completes, then show the results in a table. For example:
26
29
 
27
30
  ```
28
- Test: Runs Time Failures
29
- "Recorder/should be able to start a replay..." 30 60s 0 (0.00%)
30
- "The Debugger Language Plugins/shows sensible..." 60 60s 1 (1.67%)
31
+ Test: Runs Sec Failures
32
+ "Recorder/should be able to start a replay..." 30 180 0 (0.00%)
33
+ "The Debugger Language Plugins/shows sensible..." 60 180 1 (1.67%)
31
34
  ```
32
35
 
33
- Once you have one or more failures, show the error message and ask the user if they want to:
36
+ If problems were detected, list the different problems found and how often they occurred. Ask the user if the errors match the ones they are trying to get rid of.
34
37
 
35
- 1) Start investigating the test failures.
36
- 2) Continue running all the tests.
37
- 3) Run only the failed tests (to get a clearer indication of their failure rate).
38
- 4) Run only the tests that haven't failed (to attempt to get a reproduction).
38
+ ### Bot reproduction agent (bot-repro)
39
39
 
40
- ## Investigation
40
+ The second bot should do the following:
41
41
 
42
- - Create a branch flaky_tests and append a datestamp, such as _2026_07_04_14h16m.
42
+ - Create a branch with a meaningful name, such as `deflake_<test_name>`.
43
43
  - Ensure you use the instructions from the `devtools-version-control` skill to create and switch branches appropriately.
44
- - Investigate each test failure and propose a fix.
45
- - Don't commit the changes to the branch.
44
+ - Make a minor, harmless modification directly to the test file being investigated (e.g., adding a comment `// Trigger stressor bot`) to ensure the commit is not empty.
45
+ - Add this file (with `git add`) and commit it using a meaningful commit message (e.g., `git commit -m "Deflake <test name>"`). Ask the user which bug number to use for the changelist description.
46
+ - Upload this change using `git cl upload -f`. Always use `-f` (`--force`) so the upload runs non-interactively without opening a text editor or prompt. This creates a debugging CL that all agents (like the fix agent) will continue to work on.
47
+ - Note the <issue number> created during upload.
48
+ - To start the stressor bot, run this command (substituting `<test file>:exact_test_id` with the actual file and exact test ID):
49
+ `git cl try -B devtools-frontend/try -b e2e_stressor_linux -b e2e_stressor_win64 -b e2e_stressor_mac -p runner_args='<test file>:exact_test_id --repeat=100'`
50
+ - **Note on Screenshot Tests:** If the test involves screenshot assertions (`assertScreenshot`), it should ONLY be run on the Linux stressor bot (`-b e2e_stressor_linux`), because screenshot assertions are not supported on Mac or Windows. Furthermore, they cannot be reproduced locally on a Mac.
51
+ - **Auth Issues:** If `git cl try` fails with a login error (e.g., `Login required: run bb auth-login`), inform the user so they can resolve the auth issue and ask you to retry.
52
+
53
+ - Note that the test file name needs to be relative to the root, so use `test/e2e/foo.test.ts` instead of `e2e/foo.test.ts`.
54
+ - Check the results of the stressor tests with `git cl try-results --issue=<issue number> --patchset=<patchset number>`. You can dive into each result by id using `bb get <id>`.
55
+ - Once a test run completes, always report to the user how often the tests ran and what the failure rate was.
56
+ - Critical: Make sure that at least one test ran to completion on the bot (to catch incorrect syntax for `git cl try` or incorrect test IDs).
57
+
58
+ ## Next steps
59
+
60
+ - Monitor the results of the two agents. The local reproduction bot will likely finish sooner.
61
+ - If it does but doesn't reproduced the failure, ask the user this question:
62
+
63
+ ```
64
+ While we wait for the bots to complete their run, would you like to:
65
+
66
+ 1) Continue trying to reproduce locally
67
+ 2) Start investigating the test
68
+ ```
69
+
70
+ If they opt for investigating the test, start a new agent called 'fix-test'.
71
+
72
+ ### Fixing the test (fix-test)
73
+
74
+ The test fixing sub-agent should do the following:
75
+
76
+ - Find the test in the codebase and look at its implementation. Look at the relevant production code that is being testing.
77
+ - Look at the failures reproduced in the test (if any) by prior sub-agents.
78
+ - Suggest a fix for the failure(s).
79
+ - IMPORTANT: Ensure any dummy comments added earlier to trigger the stressor bot are removed before finalizing the fix.
80
+ - Run the full verification process (TypeScript checks, and linters) as required by the repository best practices.
81
+ - Compile and run the test locally, to make sure there are no obvious errors introduced.
82
+ - Commit the changes (to the branch created earlier). Make sure to list (in the changelist description) the test name, the fix, reasoning for why the test failed, why the fix fixes the issue and the failure rate (if non-zero). If you were not able to reproduce the error, state that the fix is speculative. Ask the user to provide the bug number to use in the changelist description.
83
+ - CRITICAL: Iff the 'local-repro' bot does not reproduce the error, the 'fix-test' agent MUST wait until the stressor bot finishes its run before uploading the fix to the server (so that the stressor try run isn't aborted prematurely). If the error reproduces locally, you can upload immediately.
84
+ - Once it is safe to do so, upload the change with `git cl upload -f`.
46
85
 
47
86
  ## Results
48
87
 
49
- - Before finishing, run the full verification process (TypeScript checks, and linters) as required by the repository best practices.
50
- - Request to run the test again for as long as you think it would take to be sure the problem is gone, but get permission from the user before starting very long runs (anything over 4 minutes).
51
- - For things that have a 33% failure rate before fixing (for example), only a handful of runs are needed to verify, but tests with lower failure rate need more.
52
- - NOTE: If the test fails again with the same error as before, you don't need to finish the test run but instead you should augment or replace your fix with a better one.
53
- - At the end, list the tests, state briefly why each test was failing and how the fix addresses the issue along with the failure rate before and after.
88
+ - Always verify, by running the tests again that the problem has been fixed.
89
+ - If the problem reproduces locally during your initially attempt, then always prefer a local reproduction run (don't use the bots).
90
+ - But if the problem doesn't reproduce locally, always prefer the bot-repro but run the test locally (once only per fix) to verify the fix compiles and doesn't introduce a regression..
91
+ - For things that have (let's say) a 33% failure rate before fixing (for example), a smaller amount of run is needed to verify, than for tests with lower failure rate.
92
+ - CRITICAL: If the test fails again with the same error as before (or a new error), it is clear that the fix is not working and a new fix must be implemented (repeat the verification cycle).
93
+ - Upon completion, list the tests, state briefly why each test was failing and how the fix addresses the issue along with the failure rate before and after.
@@ -21,6 +21,7 @@ clean `UI.Widget` classes that use native update rendering delegates.
21
21
  * Clean up and remove older constructors that perform custom container
22
22
  initializations or access `.element` directly for manual append
23
23
  operations.
24
+ * Note that `VBox` and `HBox` inherit directly from `Widget`. They fully support view injection (`view = DEFAULT_VIEW`), `performUpdate()`, and `requestUpdate()` without modification.
24
25
 
25
26
  2. **Upgrade View Delegates & Inject View**:
26
27
 
@@ -60,8 +60,9 @@ git rebase-update
60
60
  ### Initial upload
61
61
  When a CL is ready, upload it with:
62
62
  ```bash
63
- git cl upload -d --commit-description="<description>"
63
+ git cl upload -f -d --commit-description="<description>"
64
64
  ```
65
+ * Always include `-f` (`--force`) so that `git cl upload` runs non-interactively without opening a text editor or prompting.
65
66
  * Use the same writing style as the current committer
66
67
  * Keep line length below 72
67
68
  * Add a "Bug: <issue number>" or "Bug: None" trailer on a separate line.
@@ -70,7 +71,7 @@ git cl upload -d --commit-description="<description>"
70
71
  ### Subsequent upload
71
72
  To upload an updated CL:
72
73
  ```bash
73
- git cl upload -d -t "<one sentence patch set description>"
74
+ git cl upload -f -d -t "<one sentence patch set description>"
74
75
  ```
75
76
 
76
77
  ## Release and Roll Status
@@ -86,7 +87,7 @@ To check whether a DevTools commit (`devtools/devtools-frontend`) has rolled int
86
87
  | Create new CL from main | `git new-branch <name>` |
87
88
  | Create stacked CL | `git new-branch --upstream_current <name>` |
88
89
  | Update current CL | `git commit --amend` |
89
- | Upload to Gerrit | `git cl upload` |
90
+ | Upload to Gerrit | `git cl upload -f` |
90
91
  | Change branch parent | `git reparent-branch <new-parent>` |
91
92
  | Sync all branches | `git rebase-update` |
92
93
  | Check release & roll status | Query `https://chromiumdash.appspot.com/fetch_commit?commit=<sha>` |
@@ -34,6 +34,8 @@ This approach has two main benefits:
34
34
  1. **Testability**: In unit tests, we can pass a simple stub as the view function, which allows us to test the presenter's logic without any DOM manipulation.
35
35
  2. **Clarity**: It cleanly separates the presenter's logic from its rendering logic.
36
36
 
37
+ Note that `VBox` and `HBox` inherit directly from `Widget`. They fully support view injection (`view = DEFAULT_VIEW`), `performUpdate()`, and `requestUpdate()` without modification.
38
+
37
39
  To test the `DEFAULT_VIEW` function itself, we should use screenshot and e2e tests.
38
40
 
39
41
  ## Declarative and orchestrated DOM updates
@@ -1513,3 +1515,92 @@ The component will automatically sort and merge the ranges provided.
1513
1515
 
1514
1516
  In this example, the ranges `1,3` and `2,3` will be merged into `1,4`. The
1515
1517
  ranges `10,2` and the current range `5,3` will also be highlighted.
1518
+
1519
+ ## Migrating `UI.ListWidget.ListWidget`
1520
+
1521
+ Replace the legacy imperative `UI.ListWidget.ListWidget` (which rendered inline editing controls and required custom delegates) with the modern `<devtools-list>` component.
1522
+
1523
+ ### Guidelines
1524
+ 1. **Dialogue Modals for Complex Editors:** If the editor contains multiple input fields (e.g., location details, headers), show the editor in a modal card dialog powered by `UI.Dialog.Dialog`.
1525
+ 2. **Inline Prompts for Trivial Editors:** If the editor is trivial (i.e., a single text input, such as URL pattern blocking rules), handle editing inline using a `<devtools-prompt>` component. In this case, clicking the item focuses the prompt and toggles `editing` mode inline, dispatching `@commit` and `@cancel` events to update the state. See `RequestConditionsDrawer` for a reference implementation.
1526
+ 3. **Conditionally render list:** Use `<devtools-list>` and conditionally render it inside the card only if the list has elements (`input.locations.length > 0`). This ensures empty state layout rules are correctly applied and prevents extra spacing/gaps.
1527
+ 4. **Declarative dialog views:** Define the edit/add modal content in a separate, customizable view function (e.g. `DEFAULT_DIALOG_VIEW`). Instantiating `UI.Dialog.Dialog` in the class is fine, but its content rendering should be driven declaratively by the dialog view function.
1528
+ 5. **Common styles integration:** Ensure `{includeCommonStyles: true}` is passed when rendering elements into the DOM inside test setups to import proper layout variables and global typography styles (e.g. Roboto).
1529
+
1530
+ **Before:**
1531
+ ```typescript
1532
+ class SettingsTab extends UI.Widget.VBox implements UI.ListWidget.Delegate<Location> {
1533
+ private readonly listWidget: UI.ListWidget.ListWidget<Location>;
1534
+ constructor() {
1535
+ super();
1536
+ this.listWidget = new UI.ListWidget.ListWidget(this);
1537
+ this.listWidget.show(this.element);
1538
+ }
1539
+
1540
+ renderItem(item: Location, editable: boolean): Element {
1541
+ const element = document.createElement('div');
1542
+ element.createChild('span').textContent = item.title;
1543
+ return element;
1544
+ }
1545
+
1546
+ beginEdit(item: Location): UI.ListWidget.Editor<Location> {
1547
+ const editor = new UI.ListWidget.Editor<Location>();
1548
+ editor.createInput('title', 'text', 'Title', titleValidator);
1549
+ return editor;
1550
+ }
1551
+
1552
+ commitEdit(item: Location, editor: UI.ListWidget.Editor<Location>, isNew: boolean): void {
1553
+ item.title = editor.control('title').value;
1554
+ this.update();
1555
+ }
1556
+ }
1557
+ ```
1558
+
1559
+ **After:**
1560
+ ```typescript
1561
+ export interface SettingsTabInput {
1562
+ items: Location[];
1563
+ onAddClicked: () => void;
1564
+ onEdit: (index: number) => void;
1565
+ onDelete: (index: number) => void;
1566
+ }
1567
+
1568
+ export const DEFAULT_VIEW: View = (input, _output, target) => {
1569
+ render(html`
1570
+ <devtools-card heading="Locations">
1571
+ ${input.items.length > 0 ? html`
1572
+ <devtools-list
1573
+ .editable=${true}
1574
+ .deletable=${true}
1575
+ @edit=${(e: Lists.List.ItemEditEvent) => input.onEdit(e.detail.index)}
1576
+ @delete=${(e: Lists.List.ItemRemoveEvent) => input.onDelete(e.detail.index)}>
1577
+ ${input.items.map((item, index) => html`
1578
+ <div slot="slot-${index}">
1579
+ <span>${item.title}</span>
1580
+ </div>
1581
+ `)}
1582
+ </devtools-list>
1583
+ ` : nothing}
1584
+ <devtools-button @click=${input.onAddClicked}>Add location</devtools-button>
1585
+ </devtools-card>
1586
+ `, target);
1587
+ };
1588
+
1589
+ export interface SettingsTabDialogInput {
1590
+ editingValues: {title: string};
1591
+ validationErrors: {title: string | null};
1592
+ onTitleInput: (val: string) => void;
1593
+ onCancel: () => void;
1594
+ onSave: () => void;
1595
+ }
1596
+
1597
+ export const DEFAULT_DIALOG_VIEW = (input: SettingsTabDialogInput, target: HTMLElement) => {
1598
+ render(html`
1599
+ <div class="editor-container">
1600
+ <input type="text" .value=${input.editingValues.title} @input=${(e: Event) => input.onTitleInput((e.target as HTMLInputElement).value)}>
1601
+ <devtools-button @click=${input.onCancel}>Cancel</devtools-button>
1602
+ <devtools-button @click=${input.onSave}>Save</devtools-button>
1603
+ </div>
1604
+ `, target);
1605
+ };
1606
+ ```
package/eslint.config.mjs CHANGED
@@ -621,9 +621,9 @@ export default defineConfig([
621
621
  ],
622
622
  '@devtools/l10n-i18nString-call-only-with-uistrings': 'error',
623
623
  '@devtools/l10n-no-i18nString-calls-module-instantiation': 'error',
624
- '@devtools/l10n-no-locked-or-placeholder-only-phrase': 'error',
625
624
  '@devtools/l10n-no-uistrings-export': 'error',
626
625
  '@devtools/l10n-no-unused-message': 'error',
626
+ '@devtools/l10n-uistrings-text-style': 'error',
627
627
  },
628
628
  },
629
629
  {
@@ -102,6 +102,8 @@ export interface SettingsCreationOptions {
102
102
  console: Console;
103
103
  }
104
104
 
105
+ type NoFunction<T> = T extends(...args: never[]) => unknown ? never : T;
106
+
105
107
  export class Settings {
106
108
  readonly syncedStorage: SettingsStorage;
107
109
  readonly globalStorage: SettingsStorage;
@@ -323,6 +325,70 @@ export class Settings {
323
325
  getRegistry(): Map<string, Setting<unknown>> {
324
326
  return this.#registry;
325
327
  }
328
+
329
+ /**
330
+ * Resolves a setting descriptor to a concrete {@link Setting} instance.
331
+ *
332
+ * If a setting with the same name already exists (either pre-registered or
333
+ * previously resolved), that instance is returned. Otherwise, a new setting
334
+ * is created and registered.
335
+ *
336
+ * @param descriptor The descriptor defining the setting. Must not be conditional.
337
+ * @throws If the descriptor is conditional (contains `isAvailable`). Use `maybeResolve` instead.
338
+ */
339
+ resolve<T>(descriptor: SettingDescriptor<NoFunction<T>>&{isAvailable?: never}): Setting<T> {
340
+ if ('isAvailable' in descriptor) {
341
+ // TS can only do so much if developers downcast explicitly.
342
+ throw new Error('Use Settings#maybeResolve for conditional descriptors.');
343
+ }
344
+
345
+ return this.#resolve(descriptor);
346
+ }
347
+
348
+ #resolve<T>(descriptor: SettingDescriptor<T>): Setting<T> {
349
+ let setting = this.moduleSettings.get(descriptor.name);
350
+ if (setting) {
351
+ return setting as Setting<T>;
352
+ }
353
+
354
+ const {name, type, defaultValue, storageType} = descriptor;
355
+ const isRegex = type === SettingType.REGEX;
356
+
357
+ const isGetter =
358
+ (value: T|((config: Root.Runtime.HostConfig) => T)): value is((config: Root.Runtime.HostConfig) => T) =>
359
+ typeof value === 'function';
360
+
361
+ const evaluatedDefaultValue = isGetter(defaultValue) ? defaultValue(Root.Runtime.hostConfig) : defaultValue;
362
+ setting = isRegex && typeof evaluatedDefaultValue === 'string' ?
363
+ this.createRegExpSetting(name, evaluatedDefaultValue, undefined, storageType) :
364
+ this.createSetting(name, evaluatedDefaultValue, storageType);
365
+
366
+ this.registerModuleSetting(setting);
367
+ return setting as Setting<T>;
368
+ }
369
+
370
+ /**
371
+ * Resolves a conditional setting descriptor to a concrete {@link Setting} instance if it is available.
372
+ *
373
+ * This method checks the availability of the setting using the descriptor's `isAvailable` function
374
+ * and the current `hostConfig`. If available, it resolves and returns the setting (caching it if
375
+ * necessary). If not available (either unavailable or disabled), it returns the availability status
376
+ * and the reason.
377
+ *
378
+ * @param descriptor The conditional descriptor defining the setting.
379
+ * @returns An object with either the resolved `setting` or the availability `status` and `reason`.
380
+ */
381
+ maybeResolve<T, R>(descriptor: ConditionalSettingDescriptor<NoFunction<T>, R>): {setting: Setting<T>}|{
382
+ status: SettingAvailability.UNAVAILABLE|SettingAvailability.DISABLED, reason: R,
383
+ }
384
+ {
385
+ const available = descriptor.isAvailable(Root.Runtime.hostConfig);
386
+ if (available.status === SettingAvailability.AVAILABLE) {
387
+ return {setting: this.#resolve(descriptor)};
388
+ }
389
+
390
+ return available;
391
+ }
326
392
  }
327
393
 
328
394
  export interface SettingsBackingStore {
@@ -471,6 +537,15 @@ export class Setting<V> {
471
537
  this.#serializer = serializer;
472
538
  }
473
539
 
540
+ descriptor(): SettingDescriptor<V> {
541
+ return {
542
+ name: this.name,
543
+ type: this.type() ?? SettingType.BOOLEAN,
544
+ defaultValue: this.defaultValue,
545
+ storageType: this.#registration?.storageType,
546
+ };
547
+ }
548
+
474
549
  addChangeListener(listener: (arg0: EventTargetEvent<V>) => void, thisObject?: Object): EventDescriptor {
475
550
  return this.eventSupport.addEventListener(this.name, listener, thisObject);
476
551
  }
@@ -64,6 +64,7 @@ const AidaLanguageToMarkdown: Record<AidaInferenceLanguage, string> = {
64
64
  export class AidaAbortError extends Error {}
65
65
  export class AidaBlockError extends Error {}
66
66
  export class AidaQuotaError extends Error {}
67
+ export class AidaPayloadTooLargeError extends Error {}
67
68
 
68
69
  interface AiStream {
69
70
  write: (data: string) => Promise<void>;
@@ -195,13 +196,16 @@ export class AidaClient {
195
196
  return;
196
197
  }
197
198
  if ('error' in result && result.error) {
198
- const errorStr = typeof result.error === 'string' ? result.error : '';
199
- const detailStr = typeof result.detail === 'string' ? result.detail : '';
200
- if (errorStr.toLowerCase().includes('quota') || detailStr.toLowerCase().includes('quota')) {
199
+ if (isQuotaError(result.error, result.detail)) {
201
200
  stream.fail(new AidaQuotaError(
202
201
  `Cannot send request: ${result.error}${result.detail ? ` ${result.detail}` : ''}`));
203
202
  return;
204
203
  }
204
+ if (isPayloadTooLargeError(result.error, result.detail)) {
205
+ stream.fail(new AidaPayloadTooLargeError(
206
+ `Cannot send request: ${result.error}${result.detail ? ` ${result.detail}` : ''}`));
207
+ return;
208
+ }
205
209
  stream.fail(new Error(`Cannot send request: ${result.error}${result.detail ? ` ${result.detail}` : ''}`));
206
210
  return;
207
211
  }
@@ -261,9 +265,12 @@ export class AidaClient {
261
265
  thoughtSignature: result.functionCallChunk.functionCall.thoughtSignature,
262
266
  });
263
267
  } else if ('error' in result) {
264
- if (typeof result.error === 'string' && result.error.toLowerCase().includes('quota')) {
268
+ if (isQuotaError(result.error)) {
265
269
  throw new AidaQuotaError(`Server responded: ${JSON.stringify(result)}`);
266
270
  }
271
+ if (isPayloadTooLargeError(result.error)) {
272
+ throw new AidaPayloadTooLargeError(`Server responded: ${JSON.stringify(result)}`);
273
+ }
267
274
  throw new Error(`Server responded: ${JSON.stringify(result)}`);
268
275
  } else {
269
276
  throw new Error(`Unknown chunk result ${JSON.stringify(result)}`);
@@ -519,3 +526,11 @@ export const enum Events {
519
526
  export interface EventTypes {
520
527
  [Events.AIDA_AVAILABILITY_CHANGED]: void;
521
528
  }
529
+
530
+ function isQuotaError(...inputs: Array<string|undefined>): boolean {
531
+ return inputs.some(input => input?.toLowerCase().includes('quota'));
532
+ }
533
+
534
+ function isPayloadTooLargeError(...inputs: Array<string|undefined>): boolean {
535
+ return inputs.some(input => input?.toLowerCase().includes('payload size exceeds the limit'));
536
+ }
@@ -37,7 +37,7 @@ import {streamWrite as resourceLoaderStreamWrite} from './ResourceLoader.js';
37
37
 
38
38
  const UIStrings = {
39
39
  /**
40
- * @description Document title in Inspector Frontend Host of the DevTools window
40
+ * @description Document title in Inspector Frontend Host of the DevTools window.
41
41
  * @example {example.com} PH1
42
42
  */
43
43
  devtoolsS: 'DevTools - {PH1}',
@@ -12,59 +12,59 @@ import type {LoadNetworkResourceResult} from './InspectorFrontendHostAPI.js';
12
12
 
13
13
  const UIStrings = {
14
14
  /**
15
- * @description Name of an error category used in error messages
15
+ * @description Name of an error category used in error messages.
16
16
  */
17
17
  systemError: 'System error',
18
18
  /**
19
- * @description Name of an error category used in error messages
19
+ * @description Name of an error category used in error messages.
20
20
  */
21
21
  connectionError: 'Connection error',
22
22
  /**
23
- * @description Name of an error category used in error messages
23
+ * @description Name of an error category used in error messages.
24
24
  */
25
25
  certificateError: 'Certificate error',
26
26
  /**
27
- * @description Name of an error category used in error messages
27
+ * @description Name of an error category used in error messages.
28
28
  */
29
29
  httpError: 'HTTP error',
30
30
  /**
31
- * @description Name of an error category used in error messages
31
+ * @description Name of an error category used in error messages.
32
32
  */
33
33
  cacheError: 'Cache error',
34
34
  /**
35
- * @description Name of an error category used in error messages
35
+ * @description Name of an error category used in error messages.
36
36
  */
37
- signedExchangeError: 'Signed Exchange error',
37
+ signedExchangeError: '`Signed Exchange` error',
38
38
  /**
39
- * @description Name of an error category used in error messages
39
+ * @description Name of an error category used in error messages.
40
40
  */
41
41
  ftpError: 'FTP error',
42
42
  /**
43
- * @description Name of an error category used in error messages
43
+ * @description Name of an error category used in error messages.
44
44
  */
45
45
  certificateManagerError: 'Certificate manager error',
46
46
  /**
47
- * @description Name of an error category used in error messages
47
+ * @description Name of an error category used in error messages.
48
48
  */
49
49
  dnsResolverError: 'DNS resolver error',
50
50
  /**
51
- * @description Name of an error category used in error messages
51
+ * @description Name of an error category used in error messages.
52
52
  */
53
53
  unknownError: 'Unknown error',
54
54
  /**
55
- * @description Phrase used in error messages that carry a network error name
55
+ * @description Phrase used in error messages that carry a network error name.
56
56
  * @example {404} PH1
57
57
  * @example {net::ERR_INSUFFICIENT_RESOURCES} PH2
58
58
  */
59
59
  httpErrorStatusCodeSS: 'HTTP error: status code {PH1}, {PH2}',
60
60
  /**
61
- * @description Name of an error category used in error messages
61
+ * @description Name of an error category used in error messages.
62
62
  */
63
63
  invalidUrl: 'Invalid URL',
64
64
  /**
65
- * @description Name of an error category used in error messages
65
+ * @description Name of an error category used in error messages.
66
66
  */
67
- decodingDataUrlFailed: 'Decoding Data URL failed',
67
+ decodingDataUrlFailed: 'Decoding data URL failed',
68
68
  } as const;
69
69
  const str_ = i18n.i18n.registerUIStrings('core/host/ResourceLoader.ts', UIStrings);
70
70
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);