chrome-devtools-frontend 1.0.1662289 → 1.0.1664496

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-unicode-escaping/SKILL.md +64 -0
  3. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +2 -1
  4. package/.agents/skills/fixing-skipped-tests/SKILL.md +3 -3
  5. package/.agents/skills/merging-devtools-module/SKILL.md +1 -1
  6. package/.agents/skills/migrate-chromium-test/SKILL.md +32 -6
  7. package/.agents/skills/repro-flaky-tests/SKILL.md +71 -31
  8. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +1 -0
  9. package/docs/ui_engineering.md +2 -0
  10. package/eslint.config.mjs +1 -0
  11. package/front_end/core/common/SettingRegistration.ts +0 -5
  12. package/front_end/core/common/Settings.ts +144 -3
  13. package/front_end/core/platform/StringUtilities.ts +38 -6
  14. package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +112 -0
  15. package/front_end/core/sdk/CPUProfilerModel.ts +21 -13
  16. package/front_end/core/sdk/CSSContainerQuery.ts +1 -1
  17. package/front_end/core/sdk/CSSLayer.ts +1 -1
  18. package/front_end/core/sdk/CSSMedia.ts +1 -1
  19. package/front_end/core/sdk/CSSModel.ts +1 -1
  20. package/front_end/core/sdk/CSSNavigation.ts +1 -1
  21. package/front_end/core/sdk/CSSProperty.ts +1 -1
  22. package/front_end/core/sdk/CSSQuery.ts +1 -1
  23. package/front_end/core/sdk/CSSRule.ts +1 -1
  24. package/front_end/core/sdk/CSSScope.ts +1 -1
  25. package/front_end/core/sdk/CSSStartingStyle.ts +1 -1
  26. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  27. package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
  28. package/front_end/core/sdk/CSSSupports.ts +1 -1
  29. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
  30. package/front_end/core/sdk/NetworkManager.ts +1 -1
  31. package/front_end/core/sdk/NetworkRequest.ts +7 -7
  32. package/front_end/core/sdk/Resource.ts +1 -1
  33. package/front_end/core/sdk/ScopeTreeCache.ts +1 -1
  34. package/front_end/core/sdk/Script.ts +1 -1
  35. package/front_end/core/sdk/ServerSentEvents.ts +1 -1
  36. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -10
  37. package/front_end/core/sdk/SourceMap.ts +1 -1
  38. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  39. package/front_end/core/sdk/StorageBucketsModel.ts +0 -10
  40. package/front_end/core/sdk/sdk-meta.ts +3 -4
  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/inspector_main/OutermostTargetSelector.ts +0 -13
  51. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +8 -3
  52. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +3 -3
  53. package/front_end/entrypoints/main/MainImpl.ts +21 -3
  54. package/front_end/foundation/Universe.ts +16 -0
  55. package/front_end/generated/InspectorBackendCommands.ts +2 -14
  56. package/front_end/generated/protocol-mapping.d.ts +0 -53
  57. package/front_end/generated/protocol-proxy-api.d.ts +0 -46
  58. package/front_end/generated/protocol.ts +0 -148
  59. package/front_end/models/ai_assistance/AgentProject.ts +1 -1
  60. package/front_end/models/ai_assistance/AiAgent2.ts +3 -3
  61. package/front_end/models/ai_assistance/AiConversation.ts +21 -10
  62. package/front_end/models/ai_assistance/AiHistoryStorage.ts +21 -10
  63. package/front_end/models/ai_assistance/ChangeManager.ts +2 -2
  64. package/front_end/models/ai_assistance/ExtensionScope.ts +6 -2
  65. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +4 -7
  66. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
  67. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +19 -11
  68. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
  69. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -10
  70. package/front_end/models/ai_assistance/agents/StorageAgent.ts +19 -18
  71. package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
  72. package/front_end/models/ai_assistance/contexts/FileContext.ts +7 -3
  73. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +39 -11
  74. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +6 -3
  75. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -1
  76. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +4 -4
  77. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
  78. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +76 -3
  79. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +11 -1
  80. package/front_end/models/badges/AiExplorerBadge.ts +8 -3
  81. package/front_end/models/badges/Badge.ts +1 -0
  82. package/front_end/models/badges/UserBadges.ts +43 -23
  83. package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
  84. package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
  85. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -2
  86. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
  87. package/front_end/models/bindings/DefaultScriptMapping.ts +1 -1
  88. package/front_end/models/bindings/FileUtils.ts +1 -1
  89. package/front_end/models/bindings/NetworkProject.ts +16 -4
  90. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +7 -10
  91. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  92. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
  93. package/front_end/models/bindings/SASSSourceMapping.ts +1 -1
  94. package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
  95. package/front_end/models/breakpoints/BreakpointManager.ts +1 -1
  96. package/front_end/models/crux-manager/CrUXManager.ts +1 -1
  97. package/front_end/models/emulation/DeviceModeModel.ts +67 -5
  98. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  99. package/front_end/models/extensions/RecorderPluginManager.ts +10 -6
  100. package/front_end/models/har/Importer.ts +1 -1
  101. package/front_end/models/har/Log.snapshot.txt +193 -0
  102. package/front_end/models/har/Log.ts +3 -2
  103. package/front_end/models/har/Writer.ts +1 -1
  104. package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
  105. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  106. package/front_end/models/issues_manager/LazyLoadImageIssue.ts +76 -0
  107. package/front_end/models/issues_manager/descriptions/lazyLoadImageZeroSize.md +7 -0
  108. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  109. package/front_end/models/javascript_metadata/NativeFunctions.js +9 -10
  110. package/front_end/models/live-metrics/LiveMetrics.ts +2 -3
  111. package/front_end/models/logs/NetworkLog.ts +4 -3
  112. package/front_end/models/logs/logs-meta.ts +3 -3
  113. package/front_end/models/network_time_calculator/NetworkTimeCalculator.ts +4 -4
  114. package/front_end/models/persistence/Automapping.ts +1 -1
  115. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
  116. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
  117. package/front_end/models/persistence/IsolatedFileSystem.ts +2 -2
  118. package/front_end/models/persistence/NetworkPersistenceManager.ts +1 -1
  119. package/front_end/models/persistence/PersistenceImpl.ts +1 -1
  120. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  121. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +8 -6
  122. package/front_end/models/source_map_scopes/NamesResolver.ts +37 -31
  123. package/front_end/models/stack_trace/StackTrace.ts +17 -0
  124. package/front_end/models/text_utils/text_utils.ts +2 -24
  125. package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
  126. package/front_end/models/trace/insights/LegacyJavaScript.ts +1 -1
  127. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  128. package/front_end/models/trace/insights/ThirdParties.ts +1 -1
  129. package/front_end/models/workspace/FileManager.ts +1 -1
  130. package/front_end/models/workspace/UISourceCode.ts +1 -1
  131. package/front_end/models/workspace/WorkspaceImpl.ts +1 -1
  132. package/front_end/models/workspace_diff/WorkspaceDiff.ts +1 -1
  133. package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -1
  134. package/front_end/panels/accessibility/AccessibilityStrings.ts +2 -2
  135. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
  136. package/front_end/panels/ai_assistance/ExportConversation.ts +1 -1
  137. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +1 -1
  138. package/front_end/panels/ai_assistance/components/ChatMessage.ts +1 -1
  139. package/front_end/panels/application/AppManifestView.ts +4 -4
  140. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -2
  141. package/front_end/panels/application/CrashReportContextView.ts +1 -1
  142. package/front_end/panels/application/DOMStorageItemsView.ts +1 -1
  143. package/front_end/panels/application/DeviceBoundSessionsView.ts +4 -4
  144. package/front_end/panels/application/ExtensionStorageItemsView.ts +1 -1
  145. package/front_end/panels/application/FrameDetailsView.ts +1 -1
  146. package/front_end/panels/application/IndexedDBModel.ts +0 -10
  147. package/front_end/panels/application/IndexedDBViews.ts +240 -164
  148. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +12 -2
  149. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  150. package/front_end/panels/application/SharedStorageModel.ts +0 -10
  151. package/front_end/panels/application/application.ts +2 -0
  152. package/front_end/panels/application/components/AdsView.ts +23 -0
  153. package/front_end/panels/application/components/BackForwardCacheView.ts +21 -5
  154. package/front_end/panels/application/components/CrashReportContextGrid.ts +1 -1
  155. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +1 -1
  156. package/front_end/panels/application/components/TrustTokensView.ts +2 -2
  157. package/front_end/panels/application/components/adsView.css +21 -1
  158. package/front_end/panels/application/indexedDBViews.css +1 -1
  159. package/front_end/panels/application/preloading/PreloadingView.ts +1 -1
  160. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
  161. package/front_end/panels/application/preloading/components/PreloadingString.ts +2 -2
  162. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -4
  163. package/front_end/panels/autofill/AutofillView.ts +1 -1
  164. package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
  165. package/front_end/panels/common/ExtensionServer.ts +1 -1
  166. package/front_end/panels/console/ConsoleFilter.ts +1 -1
  167. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  168. package/front_end/panels/console/ConsoleView.ts +1 -1
  169. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  170. package/front_end/panels/console/PromptBuilder.ts +1 -1
  171. package/front_end/panels/coverage/CoverageDecorationManager.ts +9 -1
  172. package/front_end/panels/coverage/CoverageModel.ts +1 -1
  173. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
  174. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  175. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  176. package/front_end/panels/elements/AccessibilityTreeView.ts +38 -3
  177. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +1 -1
  178. package/front_end/panels/elements/ElementIssueUtils.ts +2 -2
  179. package/front_end/panels/elements/ElementsTreeElement.ts +10 -3
  180. package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
  181. package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
  182. package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
  183. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -1
  184. package/front_end/panels/elements/StylesContainer.ts +1 -1
  185. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  186. package/front_end/panels/elements/components/CSSPropertyDocsView.ts +1 -1
  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 +72 -8
  198. package/front_end/panels/network/NetworkLogView.ts +1 -1
  199. package/front_end/panels/network/NetworkLogViewColumns.ts +6 -6
  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/RequestInitiatorView.ts +24 -2
  205. package/front_end/panels/network/RequestPayloadView.ts +1 -1
  206. package/front_end/panels/network/RequestPreviewView.ts +1 -1
  207. package/front_end/panels/network/RequestResponseView.ts +1 -1
  208. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  209. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -1
  210. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -1
  211. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  212. package/front_end/panels/network/forward/UIRequestLocation.ts +1 -1
  213. package/front_end/panels/network/network-meta.ts +3 -3
  214. package/front_end/panels/network/networkLogView.css +5 -0
  215. package/front_end/panels/network/requestInitiatorViewTree.css +5 -0
  216. package/front_end/panels/profiler/HeapProfileView.ts +200 -81
  217. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  218. package/front_end/panels/profiler/ProfileDataGrid.ts +12 -8
  219. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -1
  220. package/front_end/panels/recorder/README.md +1 -2
  221. package/front_end/panels/recorder/RecorderPanel.ts +1861 -17
  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/recorder/recorder.ts +0 -2
  228. package/front_end/panels/search/SearchResultsPane.ts +1 -1
  229. package/front_end/panels/security/SecurityPanel.ts +3 -3
  230. package/front_end/panels/settings/AISettingsTab.ts +17 -4
  231. package/front_end/panels/settings/components/SyncSection.ts +4 -4
  232. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +3 -3
  233. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
  234. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  235. package/front_end/panels/sources/CoveragePlugin.ts +1 -1
  236. package/front_end/panels/sources/DebuggerPlugin.ts +4 -4
  237. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +27 -3
  238. package/front_end/panels/sources/NavigatorView.ts +1 -1
  239. package/front_end/panels/sources/PersistenceActions.ts +1 -1
  240. package/front_end/panels/sources/SourcesNavigator.ts +1 -1
  241. package/front_end/panels/sources/SourcesSearchScope.ts +1 -1
  242. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -3
  243. package/front_end/panels/sources/UISourceCodeFrame.ts +1 -1
  244. package/front_end/panels/sources/components/HeadersView.ts +1 -1
  245. package/front_end/panels/sources/filteredUISourceCodeListProvider.css +12 -1
  246. package/front_end/panels/sources/sources-meta.ts +1 -1
  247. package/front_end/panels/timeline/StatusDialog.ts +1 -1
  248. package/front_end/panels/timeline/TimelineController.ts +24 -3
  249. package/front_end/panels/timeline/TimelinePanel.ts +116 -25
  250. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +2 -2
  251. package/front_end/panels/timeline/TimelineUIUtils.ts +1 -1
  252. package/front_end/panels/timeline/components/CWVMetrics.ts +1 -1
  253. package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
  254. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
  255. package/front_end/panels/timeline/timeline-meta.ts +13 -0
  256. package/front_end/services/tracing/TracingManager.ts +27 -2
  257. package/front_end/third_party/chromium/README.chromium +1 -1
  258. package/front_end/third_party/lighthouse/README.chromium +2 -2
  259. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1418 -1413
  260. package/front_end/third_party/lighthouse/locales/en-US.json +12 -6
  261. package/front_end/third_party/lighthouse/locales/en-XL.json +12 -6
  262. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  263. package/front_end/third_party/puppeteer/puppeteer.ts +20 -1
  264. package/front_end/ui/components/highlighting/HighlightElement.ts +4 -1
  265. package/front_end/ui/components/highlighting/HighlightManager.ts +1 -1
  266. package/front_end/ui/components/highlighting/MarkupHighlight.ts +1 -1
  267. package/front_end/ui/components/markdown_view/MarkdownView.ts +46 -2
  268. package/front_end/ui/components/markdown_view/markdownView.css +23 -0
  269. package/front_end/ui/components/spinners/Spinner.ts +29 -32
  270. package/front_end/ui/components/spinners/spinner.css +32 -84
  271. package/front_end/ui/components/text_editor/config.ts +1 -1
  272. package/front_end/ui/components/tree_outline/TreeOutline.ts +7 -1
  273. package/front_end/ui/legacy/Infobar.ts +1 -1
  274. package/front_end/ui/legacy/InspectorView.ts +12 -7
  275. package/front_end/ui/legacy/SuggestBox.ts +1 -1
  276. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  277. package/front_end/ui/legacy/Toolbar.ts +5 -2
  278. package/front_end/ui/legacy/Treeoutline.ts +40 -13
  279. package/front_end/ui/legacy/UIUtils.ts +25 -10
  280. package/front_end/ui/legacy/Widget.ts +17 -10
  281. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -1
  282. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +37 -8
  283. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +1 -1
  284. package/front_end/ui/legacy/components/data_grid/dataGrid.css +1 -1
  285. package/front_end/ui/legacy/components/inline_editor/AnimationTimingUI.ts +27 -13
  286. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +5 -2
  287. package/front_end/ui/legacy/components/inline_editor/CSSLinearEasingModel.ts +23 -0
  288. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +223 -121
  289. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +1 -1
  290. package/front_end/ui/legacy/components/object_ui/objectValue.css +2 -1
  291. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -1
  292. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +1 -1
  293. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
  294. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  295. package/front_end/ui/legacy/components/source_frame/JSONView.ts +105 -115
  296. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -1
  297. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +1 -1
  298. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -3
  299. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +1 -1
  300. package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -1
  301. package/front_end/ui/legacy/components/source_frame/jsonView.css +4 -0
  302. package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -1
  303. package/front_end/ui/legacy/inspectorCommon.css +10 -6
  304. package/front_end/ui/lit/lit.ts +1 -0
  305. package/front_end/ui/lit/render.ts +44 -10
  306. package/front_end/ui/lit/strip-whitespace.ts +23 -2
  307. package/front_end/ui/settings/SettingUIRegistration.ts +105 -0
  308. package/front_end/ui/settings/settings.ts +9 -0
  309. package/front_end/ui/visual_logging/KnownContextValues.ts +13 -0
  310. package/mcp/mcp.ts +1 -0
  311. package/package.json +1 -1
  312. package/front_end/panels/recorder/RecorderController.ts +0 -1759
  313. /package/.agents/skills/{verification → devtools-verification}/SKILL.md +0 -0
  314. /package/front_end/{models → core}/text_utils/CodeMirrorUtils.ts +0 -0
  315. /package/front_end/{models → core}/text_utils/ContentData.ts +0 -0
  316. /package/front_end/{models → core}/text_utils/Text.ts +0 -0
  317. /package/front_end/{models → core}/text_utils/TextCursor.ts +0 -0
  318. /package/front_end/{models → core}/text_utils/TextUtils.snapshot.txt +0 -0
  319. /package/front_end/panels/recorder/{recorderController.css → recorderPanel.css} +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.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: devtools-unicode-escaping
3
+ description: Guidelines for escaping strings and handling user-controlled data in DevTools to prevent layout bleed-through, XSS, and security issues.
4
+ ---
5
+
6
+ # Unicode Escaping and User-Controlled Data Guidelines
7
+
8
+ When displaying inspected data, user-controlled strings, or untrusted input in the DevTools UI (e.g., console messages, object properties, DOM tree nodes, or UI titles/descriptions), you must ensure they are properly escaped to prevent layout bleed-through (such as Right-to-Left leaks) or security vulnerabilities.
9
+
10
+ DevTools provides two primary Unicode escaping functions in `Platform.StringUtilities`:
11
+
12
+ ## 1. Escaping for Text Representation (`escapeUnicodeAsText`)
13
+
14
+ Use `Platform.StringUtilities.escapeUnicodeAsText(content)` when rendering values that developers need to inspect (e.g. string values inside the Console or the Object properties view) where hidden, invisible, or formatting characters should be made explicitly visible.
15
+
16
+ * **Behavior**: Escapes all formatting and surrogate characters into literal Unicode escape sequences (e.g., `\u202E`, `\u200B`).
17
+ * **Example Usage**:
18
+ ```typescript
19
+ const text = Platform.StringUtilities.escapeUnicodeAsText(JSON.stringify(description));
20
+ ```
21
+
22
+ ## 2. Escaping for UI Rendering (`safeEscapeUnicode`)
23
+
24
+ Use `Platform.StringUtilities.safeEscapeUnicode(content)` when rendering content inside templates or HTML markup where you want safe layout-critical zero-width formatting characters to function normally for word wrapping or rendering layout, but want to escape dangerous layout-disrupting characters (like bidi overrides).
25
+
26
+ * **Behavior**: Escapes dangerous formatting and surrogate characters (like `\u202E`), but leaves safe formatting characters untouched:
27
+ * Zero Width Space (`\u200B`)
28
+ * Zero Width Non-Joiner (`\u200C`)
29
+ * Zero Width Joiner (`\u200D`)
30
+ * **Example Usage**:
31
+ Used automatically by the global Lit template wrapper.
32
+
33
+ ---
34
+
35
+ ## 3. Global Lit Template Wrapper
36
+
37
+ DevTools wraps Lit's default `html` function inside `front_end/ui/lit/strip-whitespace.ts` (re-exported via `ui/lit/lit.js`). This wrapper automatically intercepts and escapes standard string values using `Platform.StringUtilities.safeEscapeUnicode(val)` at runtime.
38
+
39
+ * **What is escaped automatically**: Any standard string interpolated directly in a template (e.g., `html`<span>${myString}</span>``).
40
+ * **Array items**: Array values are traversed recursively, and string elements inside arrays are escaped automatically.
41
+ * **Lit directives**: Directives (like `ifDefined`, `live`, `repeat`, `classMap`, etc.) are automatically traversed, and any string arguments inside their `values` array are escaped recursively.
42
+
43
+ ### Directives Rule:
44
+ Because the wrapper automatically processes directive arguments, you **do not** need to manually escape strings passed to standard Lit directives. They will be handled safely at runtime.
45
+
46
+ ### Correct Example:
47
+ ```typescript
48
+ title=${ifDefined(tooLong ? undefined : description)} // Automatically escaped!
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 4. Manual DOM Assignments & Non-Lit Rendering
54
+
55
+ Any manual assignments that bypass Lit entirely (e.g., setting `element.textContent`, `element.title`, or constructing DOM elements imperatively) will also bypass the Lit wrapper.
56
+
57
+ * Always wrap user-controlled strings in these contexts with the appropriate escaping helper:
58
+ * Use `escapeUnicodeAsText` if you want hidden characters to display as text (e.g., showing `\\u202E`).
59
+ * Use `safeEscapeUnicode` if you want zero-width spaces to function but other dangerous characters to be escaped.
60
+
61
+ ### Correct Example:
62
+ ```typescript
63
+ nameElement.textContent = Platform.StringUtilities.escapeUnicodeAsText(name);
64
+ ```
@@ -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.
@@ -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,12 +41,37 @@ 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
- 7. Uploading a CL with your changes using the `version-control` skill. And **STRICTLY** follow the following additional template
46
- - **Title**: `[test-migration] Migrating <chromium-test-name> to unit test`
47
- - **Body**: `Migrated <link-to-chromium-test> to <devtools-test-name>`
48
- - **Footer**: Use `Fixed: <issue number>` trailer instead of `Bug: <issue number>`.
46
+ 7. **Upload the CL:**
47
+
48
+ ## Commit message & CL upload requirements
49
+
50
+ When committing and uploading CLs, **STRICTLY** follow this format and constraints:
51
+
52
+ 1. **Title line**: `[test-migration] Migrate <short test name> test to unit test`
53
+ 2. **Body**: `This CL migrates the legacy layout test <long test name> to a unit test in <new test name>. <optional additional explanation>`
54
+ 2. **Body appendix**: `https://crsrc.org/c/third_party/blink/web_tests/<long test name>;drc=4d51e9cab50efd0f8029c45a486e199a1d519fd1`
55
+ 3. **Bug line**: `Fixed: <issue number>`
56
+ 4. **Formatting constraints**: Wrap all lines to a maximum of 72 characters per line.
57
+
58
+ Example commit message:
59
+
60
+ ```text
61
+ [test-migration] Migrate console-eval-global test to unit test
62
+
63
+ This CL migrates the legacy layout test
64
+ http/tests/devtools/console/console-eval-global.js to a unit test in
65
+ ConsolePrompt.test.ts. It verifies that the evaluation in ConsolePrompt
66
+ is performed in the correct execution context (the active one) and with
67
+ the correct expression.
68
+
69
+ https://crsrc.org/c/third_party/blink/web_tests/http/tests/devtools/console/console-eval-global.js;drc=4d51e9cab50efd0f8029c45a486e199a1d519fd1
70
+
71
+ Fixed: <issue number>
72
+ ```
73
+
74
+ Use the `version-control` skill to upload the CL.
49
75
 
50
76
  ## Example Conversion
51
77
 
@@ -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`. 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`.
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
 
@@ -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
package/eslint.config.mjs CHANGED
@@ -624,6 +624,7 @@ export default defineConfig([
624
624
  '@devtools/l10n-no-locked-or-placeholder-only-phrase': 'error',
625
625
  '@devtools/l10n-no-uistrings-export': 'error',
626
626
  '@devtools/l10n-no-unused-message': 'error',
627
+ '@devtools/l10n-use-curly-apostrophes': 'error',
627
628
  },
628
629
  },
629
630
  {
@@ -268,11 +268,6 @@ export interface SettingRegistration {
268
268
  * Determines if the setting value is stored in the global, local or session storage.
269
269
  */
270
270
  storageType?: SettingStorageType;
271
- /**
272
- * A condition that, when present in the queryParamsObject of Runtime, constraints the value
273
- * of the setting to be changed only if the user set it.
274
- */
275
- userActionCondition?: string;
276
271
  /**
277
272
  * A condition is a function that will make the setting available if it
278
273
  * returns true, and not available, otherwise. Make sure that objects you
@@ -23,6 +23,75 @@ import {
23
23
  } from './SettingRegistration.js';
24
24
  import {VersionController} from './VersionController.js';
25
25
 
26
+ /**
27
+ * Describes and configures a Setting.
28
+ *
29
+ * Use `Settings#resolve` to get the concrete `Setting` instance for a descriptor.
30
+ */
31
+ export interface SettingDescriptor<ValueT> {
32
+ /** The unique identifier of a setting */
33
+ readonly name: string;
34
+
35
+ /**
36
+ * Determines how the possible values of the setting are expressed.
37
+ *
38
+ * - If the setting can only be enabled and disabled use BOOLEAN
39
+ * - If the setting has a list of possible values use ENUM
40
+ * - If each setting value is a set of objects use ARRAY
41
+ * - If the setting value is a regular expression use REGEX
42
+ */
43
+ readonly type: SettingType;
44
+
45
+ /**
46
+ * The default value for this setting.
47
+ *
48
+ * Can be computed based on the `hostConfig` (but NOTHING ELSE).
49
+ */
50
+ readonly defaultValue: ValueT|((hostConfig: Root.Runtime.HostConfig) => ValueT);
51
+
52
+ /**
53
+ * Determines if the setting value is stored in the global, local or session storage.
54
+ */
55
+ readonly storageType?: SettingStorageType;
56
+ }
57
+
58
+ /**
59
+ * Describes and configures a Setting that might be unavailable or disabled depending on the HostConfig.
60
+ *
61
+ * See {@link SettingAvailability} for details.
62
+ *
63
+ * Use `Settings#maybeResolve` to get the concrete `Setting` instance (or a reason why it's not available).
64
+ */
65
+ export interface ConditionalSettingDescriptor<ValueT, ReasonT> extends SettingDescriptor<ValueT> {
66
+ /** The function used as `isAvailable` must only read the host config, NOTHING ELSE. */
67
+ isAvailable: (hostConfig: Root.Runtime.HostConfig) => SettingAvailabilityStatus<ReasonT>;
68
+ }
69
+
70
+ export type SettingAvailabilityStatus<ReasonT> = {
71
+ status: SettingAvailability.AVAILABLE,
72
+ }|{
73
+ status: SettingAvailability.UNAVAILABLE | SettingAvailability.DISABLED,
74
+ reason: ReasonT,
75
+ };
76
+
77
+ export const enum SettingAvailability {
78
+ /**
79
+ * Setting is available and can be changed by the user or programmatically.
80
+ */
81
+ AVAILABLE = 1,
82
+
83
+ /**
84
+ * Setting is not available at all. Any `maybeResolve` or `resolve` call will fail.
85
+ * The setting should be hidden from the user.
86
+ */
87
+ UNAVAILABLE = 2,
88
+
89
+ /**
90
+ * Setting is available, but its value can't be read or written.
91
+ */
92
+ DISABLED = 3,
93
+ }
94
+
26
95
  export interface SettingsCreationOptions {
27
96
  syncedStorage: SettingsStorage;
28
97
  globalStorage: SettingsStorage;
@@ -33,6 +102,8 @@ export interface SettingsCreationOptions {
33
102
  console: Console;
34
103
  }
35
104
 
105
+ type NoFunction<T> = T extends(...args: never[]) => unknown ? never : T;
106
+
36
107
  export class Settings {
37
108
  readonly syncedStorage: SettingsStorage;
38
109
  readonly globalStorage: SettingsStorage;
@@ -75,9 +146,6 @@ export class Settings {
75
146
  this.createSetting(settingName, evaluatedDefaultValue, storageType);
76
147
 
77
148
  setting.setTitleFunction(registration.title);
78
- if (registration.userActionCondition) {
79
- setting.setRequiresUserAction(Boolean(Root.Runtime.Runtime.queryParam(registration.userActionCondition)));
80
- }
81
149
  setting.setRegistration(registration);
82
150
 
83
151
  this.registerModuleSetting(setting);
@@ -257,6 +325,70 @@ export class Settings {
257
325
  getRegistry(): Map<string, Setting<unknown>> {
258
326
  return this.#registry;
259
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
+ }
260
392
  }
261
393
 
262
394
  export interface SettingsBackingStore {
@@ -405,6 +537,15 @@ export class Setting<V> {
405
537
  this.#serializer = serializer;
406
538
  }
407
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
+
408
549
  addChangeListener(listener: (arg0: EventTargetEvent<V>) => void, thisObject?: Object): EventDescriptor {
409
550
  return this.eventSupport.addEventListener(this.name, listener, thisObject);
410
551
  }
@@ -50,8 +50,40 @@ const escapedReplacements = new Map([
50
50
  ['</script', '\\x3C/script'],
51
51
  ]);
52
52
 
53
- export const escapeUnicode = (content: string): string => {
54
- return content.replaceAll(/[\p{Format}\p{Surrogate}]/gu, match => {
53
+ const UNICODE_ESCAPE_SOURCE = '[\\p{Format}\\p{Surrogate}]';
54
+ const UNICODE_ESCAPE_REGEX = new RegExp(UNICODE_ESCAPE_SOURCE, 'u');
55
+ const UNICODE_ESCAPE_GLOBAL_REGEX = new RegExp(UNICODE_ESCAPE_SOURCE, 'gu');
56
+
57
+ const UNICODE_ESCAPE_EXCEPT_ZWSP_SOURCE = '(?![\\u200B\\u200C\\u200D])[\\p{Format}]|\\p{Surrogate}';
58
+ const UNICODE_ESCAPE_EXCEPT_ZWSP_REGEX = new RegExp(UNICODE_ESCAPE_EXCEPT_ZWSP_SOURCE, 'u');
59
+ const UNICODE_ESCAPE_EXCEPT_ZWSP_GLOBAL_REGEX = new RegExp(UNICODE_ESCAPE_EXCEPT_ZWSP_SOURCE, 'gu');
60
+
61
+ /**
62
+ * Escapes formatting and surrogate characters in the string into literal Unicode escape sequences (e.g. \u200B).
63
+ * Use this when displaying strings to developers for inspection (e.g. in the Console or Object properties)
64
+ * where you want hidden or invisible characters to be explicitly visible as literal text.
65
+ */
66
+ export const escapeUnicodeAsText = (content: string): string => {
67
+ if (!UNICODE_ESCAPE_REGEX.test(content)) {
68
+ return content;
69
+ }
70
+ return content.replaceAll(UNICODE_ESCAPE_GLOBAL_REGEX, match => {
71
+ return match.split('').map(char => '\\u' + toHexadecimal(char.charCodeAt(0), 4)).join('');
72
+ });
73
+ };
74
+
75
+ /**
76
+ * Escapes dangerous formatting and surrogate characters (like bidi override characters) to prevent
77
+ * security and layout issues, but leaves safe, layout-critical zero-width formatting characters
78
+ * (Zero Width Space \u200B, Zero Width Non-Joiner \u200C, and Zero Width Joiner \u200D) untouched.
79
+ * Use this when rendering user-controlled content inside templates or HTML markup where you want formatting
80
+ * characters to function normally for word wrapping or rendering layout, rather than showing as literal text.
81
+ */
82
+ export const safeEscapeUnicode = (content: string): string => {
83
+ if (!UNICODE_ESCAPE_EXCEPT_ZWSP_REGEX.test(content)) {
84
+ return content;
85
+ }
86
+ return content.replaceAll(UNICODE_ESCAPE_EXCEPT_ZWSP_GLOBAL_REGEX, match => {
55
87
  return match.split('').map(char => '\\u' + toHexadecimal(char.charCodeAt(0), 4)).join('');
56
88
  });
57
89
  };
@@ -176,8 +208,8 @@ export const toBase64 = (inputString: string): string => {
176
208
  shift = i % 3;
177
209
  v |= data[i] << (16 >>> shift & 24);
178
210
  if (shift === 2) {
179
- encoded += String.fromCharCode(
180
- encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), encodeBits(v & 63));
211
+ encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63),
212
+ encodeBits(v & 63));
181
213
  v = 0;
182
214
  }
183
215
  }
@@ -312,8 +344,8 @@ export const filterRegex = function(query: string): RegExp {
312
344
  return new RegExp(regexString, 'i');
313
345
  };
314
346
 
315
- export const createSearchRegex = function(
316
- query: string, caseSensitive: boolean, isRegex: boolean, matchWholeWord = false): RegExp {
347
+ export const createSearchRegex = function(query: string, caseSensitive: boolean, isRegex: boolean,
348
+ matchWholeWord = false): RegExp {
317
349
  const regexFlags = caseSensitive ? 'g' : 'gi';
318
350
  let regexObject;
319
351