chrome-devtools-frontend 1.0.1526630 → 1.0.1528866

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/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/i18n/i18nImpl.ts +6 -1
  4. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  5. package/front_end/core/root/Runtime.ts +28 -4
  6. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  7. package/front_end/core/sdk/CSSRule.ts +35 -6
  8. package/front_end/core/sdk/Connections.ts +2 -1
  9. package/front_end/core/sdk/DOMModel.ts +4 -0
  10. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  11. package/front_end/core/sdk/NetworkManager.ts +214 -31
  12. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  13. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  14. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  15. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  16. package/front_end/core/sdk/SourceMap.ts +37 -11
  17. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  18. package/front_end/core/sdk/SourceMapScopesInfo.ts +17 -0
  19. package/front_end/core/sdk/TargetManager.ts +0 -22
  20. package/front_end/core/sdk/TraceObject.ts +8 -7
  21. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  22. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  23. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  24. package/front_end/entrypoints/main/MainImpl.ts +20 -25
  25. package/front_end/generated/InspectorBackendCommands.js +3 -2
  26. package/front_end/generated/protocol.ts +17 -3
  27. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  28. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  29. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  30. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  31. package/front_end/models/extensions/ExtensionView.ts +3 -0
  32. package/front_end/models/javascript_metadata/NativeFunctions.js +23 -27
  33. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  34. package/front_end/models/persistence/EditFileSystemView.ts +1 -0
  35. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  36. package/front_end/models/stack_trace/Trie.ts +9 -0
  37. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  38. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  39. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  40. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  41. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  42. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  43. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  44. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  45. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  46. package/front_end/panels/application/CookieItemsView.ts +1 -0
  47. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  48. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  49. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  50. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  51. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  52. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  53. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  54. package/front_end/panels/console/ConsoleInsightTeaser.ts +106 -0
  55. package/front_end/panels/console/ConsolePanel.ts +2 -0
  56. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  57. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  58. package/front_end/panels/console/ConsoleView.ts +12 -0
  59. package/front_end/panels/console/ConsoleViewMessage.ts +27 -0
  60. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  61. package/front_end/panels/console/console.ts +6 -0
  62. package/front_end/panels/console/consoleInsightTeaser.css +55 -0
  63. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  64. package/front_end/panels/coverage/CoverageView.ts +292 -284
  65. package/front_end/panels/coverage/coverageView.css +17 -0
  66. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  67. package/front_end/panels/elements/LayoutPane.ts +1 -0
  68. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  69. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  70. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  71. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  72. package/front_end/panels/explain/ActionDelegate.ts +1 -2
  73. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  74. package/front_end/panels/explain/explain.ts +0 -1
  75. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  76. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  77. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  78. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  79. package/front_end/panels/media/MainView.ts +1 -0
  80. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  81. package/front_end/panels/network/BlockedURLsPane.ts +111 -85
  82. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  83. package/front_end/panels/network/NetworkItemView.ts +1 -0
  84. package/front_end/panels/network/NetworkLogView.ts +9 -7
  85. package/front_end/panels/network/NetworkOverview.ts +1 -0
  86. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  87. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  88. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  89. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  90. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  91. package/front_end/panels/network/RequestResponseView.ts +1 -0
  92. package/front_end/panels/network/RequestTimingView.ts +2 -0
  93. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  94. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  95. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  96. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  97. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  98. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  99. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  100. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  101. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  102. package/front_end/panels/profiler/ProfileView.ts +1 -0
  103. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  104. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  105. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  106. package/front_end/panels/search/SearchView.ts +1 -0
  107. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  108. package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -0
  109. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  110. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  111. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  112. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  113. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  114. package/front_end/panels/timeline/README.md +2 -2
  115. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  116. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  117. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  118. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  119. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  120. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  121. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  122. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  123. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  124. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  125. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  126. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  127. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  128. package/front_end/third_party/chromium/README.chromium +1 -1
  129. package/front_end/third_party/lighthouse/README.chromium +2 -2
  130. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  131. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  132. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  133. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  134. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  135. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  136. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  137. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  138. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  139. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  140. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  141. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  142. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  143. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  144. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  145. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  146. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  147. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  148. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  149. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  150. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  151. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  156. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  158. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  159. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  160. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  161. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  163. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  164. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  167. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  169. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  172. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  174. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  176. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  178. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  179. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  180. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  181. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  182. package/front_end/third_party/web-vitals/README.chromium +5 -8
  183. package/front_end/third_party/web-vitals/package/README.md +191 -152
  184. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  185. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  186. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  187. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  188. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  189. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  190. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  191. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  192. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  193. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  194. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  195. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  196. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  197. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  198. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  199. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  200. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  201. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  202. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  203. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  204. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  205. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  206. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  207. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  208. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  209. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  210. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  211. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  212. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  215. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  219. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  220. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  221. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  222. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  223. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  224. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  225. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  226. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  227. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  228. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  229. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  230. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  231. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  232. package/front_end/third_party/web-vitals/package/package.json +4 -10
  233. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  234. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  235. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  236. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  237. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  238. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  239. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  240. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  241. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  242. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  243. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  244. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  245. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  246. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  247. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  248. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  249. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  250. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  251. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  252. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  253. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  254. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  255. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  256. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  257. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  258. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  259. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  260. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  261. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  262. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  263. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  264. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  265. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  266. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  267. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  268. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  269. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  270. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  271. package/front_end/ui/legacy/InspectorView.ts +2 -0
  272. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  273. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  274. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  275. package/front_end/ui/legacy/UIUtils.ts +8 -19
  276. package/front_end/ui/legacy/ViewManager.ts +1 -0
  277. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  278. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  279. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  280. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  281. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  282. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  283. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  284. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  285. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  286. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  287. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  288. package/front_end/ui/visual_logging/KnownContextValues.ts +17 -0
  289. package/mcp/README.md +7 -0
  290. package/mcp/mcp.ts +8 -0
  291. package/package.json +1 -1
  292. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  293. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  294. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  295. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  296. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  297. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  298. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  299. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  300. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  301. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  302. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  303. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  304. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  305. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  306. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  307. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  308. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  309. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  310. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  311. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  312. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  313. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  314. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  315. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  316. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  317. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  318. package/front_end/ui/legacy/inlineButton.css +0 -22
  319. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
@@ -1,8 +1,6 @@
1
1
  // Copyright 2016 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable rulesdir/no-imperative-dom-api */
5
- /* eslint-disable rulesdir/no-lit-render-outside-of-view */
6
4
 
7
5
  import '../../ui/legacy/legacy.js';
8
6
 
@@ -15,7 +13,7 @@ import * as Bindings from '../../models/bindings/bindings.js';
15
13
  import * as Workspace from '../../models/workspace/workspace.js';
16
14
  import * as Buttons from '../../ui/components/buttons/buttons.js';
17
15
  import * as UI from '../../ui/legacy/legacy.js';
18
- import {Directives, html, nothing, render} from '../../ui/lit/lit.js';
16
+ import {Directives, html, i18nTemplate as unboundI18nTemplate, render, type TemplateResult} from '../../ui/lit/lit.js';
19
17
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
20
18
 
21
19
  import {CoverageDecorationManager} from './CoverageDecorationManager.js';
@@ -126,76 +124,50 @@ const UIStrings = {
126
124
  } as const;
127
125
  const str_ = i18n.i18n.registerUIStrings('panels/coverage/CoverageView.ts', UIStrings);
128
126
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
127
+ const i18nTemplate = unboundI18nTemplate.bind(undefined, str_);
129
128
  const {ref} = Directives;
130
129
  const {bindToAction} = UI.UIUtils;
131
130
  const {bindToSetting} = UI.SettingsUI;
131
+ const {widgetConfig} = UI.Widget;
132
132
 
133
133
  let coverageViewInstance: CoverageView|undefined;
134
134
 
135
- export class CoverageView extends UI.Widget.VBox {
136
- private model: CoverageModel|null;
137
- private decorationManager: CoverageDecorationManager|null;
138
- private coverageTypeComboBox!: HTMLSelectElement;
139
- private readonly coverageTypeComboBoxSetting: Common.Settings.Setting<number>;
140
- private toggleRecordAction: UI.ActionRegistration.Action;
141
- private toggleRecordButton!: Buttons.Button.Button;
142
- private inlineReloadButton: Element|null;
143
- private startWithReloadButton!: Buttons.Button.Button|undefined;
144
- private readonly clearAction: UI.ActionRegistration.Action;
145
- private readonly exportAction: UI.ActionRegistration.Action;
146
- private textFilterRegExp: RegExp|null;
147
- private filterInput!: UI.Toolbar.ToolbarInputElement;
148
- private typeFilterValue: number|null;
149
- private filterByTypeComboBox!: HTMLSelectElement;
150
- private showContentScriptsSetting: Common.Settings.Setting<boolean>;
151
- private contentScriptsCheckbox!: UI.UIUtils.CheckboxLabel;
152
- private coverageResultsElement!: HTMLElement;
153
- private readonly landingPage: UI.Widget.VBox;
154
- private readonly bfcacheReloadPromptPage: UI.Widget.VBox;
155
- private readonly activationReloadPromptPage: UI.Widget.VBox;
156
- private listView: CoverageListView;
157
- private statusMessageElement!: HTMLElement;
158
-
159
- constructor() {
160
- super({
161
- jslog: `${VisualLogging.panel('coverage').track({resize: true})}`,
162
- useShadowDom: true,
163
- });
164
- this.registerRequiredCSS(coverageViewStyles);
165
-
166
- this.model = null;
167
- this.decorationManager = null;
168
-
169
- this.coverageTypeComboBoxSetting =
170
- Common.Settings.Settings.instance().createSetting('coverage-view-coverage-type', 0);
171
-
172
- this.toggleRecordAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.toggle-recording');
173
-
174
- const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
175
- const mainTargetSupportsRecordOnReload = Boolean(mainTarget?.model(SDK.ResourceTreeModel.ResourceTreeModel));
176
- this.inlineReloadButton = null;
177
- this.clearAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.clear');
178
- this.clearAction.setEnabled(false);
179
- this.exportAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.export');
180
- this.exportAction.setEnabled(false);
181
-
182
- this.textFilterRegExp = null;
135
+ export interface CoverageViewInput {
136
+ coverageType: number;
137
+ recording: boolean;
138
+ supportsRecordOnReload: boolean;
139
+ textFilter: RegExp|null;
140
+ typeFilter: number|null;
141
+ showContentScriptsSetting: Common.Settings.Setting<boolean>;
142
+
143
+ needsReload: 'bfcache-page'|'prerender-page'|null;
144
+ coverageInfo: CoverageListItem[]|null;
145
+ selectedUrl: Platform.DevToolsPath.UrlString|null;
146
+ statusMessage: string;
147
+
148
+ onCoverageTypeChanged: (newValue: number) => void;
149
+ onFilterChanged: (e: string) => void;
150
+ onTypeFilterChanged: (newValue: number) => void;
151
+ }
183
152
 
184
- this.typeFilterValue = null;
153
+ export interface CoverageViewOutput {
154
+ focusResults: () => void;
155
+ }
185
156
 
186
- this.showContentScriptsSetting = Common.Settings.Settings.instance().createSetting('show-content-scripts', false);
187
- this.showContentScriptsSetting.addChangeListener(this.onFilterChanged, this);
157
+ export type View = (input: CoverageViewInput, output: CoverageViewOutput, target: HTMLElement) => void;
188
158
 
189
- // clang-format off
190
- render(html`
159
+ export const DEFAULT_VIEW: View = (input, output, target) => {
160
+ // clang-format off
161
+ render(html`
191
162
  <style>${coverageViewStyles}</style>
192
163
  <div class="coverage-toolbar-container" jslog=${VisualLogging.toolbar()} role="toolbar">
193
164
  <devtools-toolbar class="coverage-toolbar" role="presentation" wrappable>
194
165
  <select title=${i18nString(UIStrings.chooseCoverageGranularityPer)}
195
166
  aria-label=${i18nString(UIStrings.chooseCoverageGranularityPer)}
196
167
  jslog=${VisualLogging.dropDown('coverage-type').track({change: true})}
197
- @change=${this.onCoverageTypeComboBoxSelectionChanged.bind(this)}
198
- ${ref(e => { if (e instanceof HTMLSelectElement) { this.coverageTypeComboBox = e; } })}>
168
+ @change=${(event: Event) => input.onCoverageTypeChanged((event.target as HTMLSelectElement).selectedIndex)}
169
+ .selectedIndex=${input.coverageType}
170
+ ?disabled=${input.recording}>
199
171
  <option value=${CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION}
200
172
  jslog=${VisualLogging.item(`${CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION}`).track({click: true})}>
201
173
  ${i18nString(UIStrings.perFunction)}
@@ -205,65 +177,185 @@ export class CoverageView extends UI.Widget.VBox {
205
177
  ${i18nString(UIStrings.perBlock)}
206
178
  </option>
207
179
  </select>
208
- ${mainTargetSupportsRecordOnReload ? html`
209
- <devtools-button ${bindToAction('coverage.start-with-reload')}
210
- ${ref(e => { if (e instanceof Buttons.Button.Button) { this.startWithReloadButton = e; } })}>
211
- </devtools-button>` : nothing}
212
- <devtools-button ${bindToAction('coverage.toggle-recording')}
213
- .disabled=${mainTargetSupportsRecordOnReload}
214
- .hidden=${mainTargetSupportsRecordOnReload}
215
- ${ref(e => { if (e instanceof Buttons.Button.Button) { this.toggleRecordButton = e; } })}>
180
+ <devtools-button ${bindToAction(input.supportsRecordOnReload && !input.recording ?
181
+ 'coverage.start-with-reload' : 'coverage.toggle-recording')}>
216
182
  </devtools-button>
217
183
  <devtools-button ${bindToAction('coverage.clear')}></devtools-button>
218
184
  <div class="toolbar-divider"></div>
219
185
  <devtools-button ${bindToAction('coverage.export')}></devtools-button>
220
186
  <div class="toolbar-divider"></div>
221
187
  <devtools-toolbar-input type="filter" placeholder=${i18nString(UIStrings.filterByUrl)}
222
- disabled @change=${this.onFilterChanged.bind(this)} style="flex-grow:1; flex-shrink:1"
223
- ${ref(e => { if (e instanceof UI.Toolbar.ToolbarInputElement) { this.filterInput = e; } })}>
188
+ ?disabled=${!Boolean(input.coverageInfo)}
189
+ @change=${(e: CustomEvent<string>) => input.onFilterChanged(e.detail)}
190
+ style="flex-grow:1; flex-shrink:1">
224
191
  </devtools-toolbar-input>
225
192
  <div class="toolbar-divider"></div>
226
193
  <select title=${i18nString(UIStrings.filterCoverageByType)}
227
194
  aria-label=${i18nString(UIStrings.filterCoverageByType)}
228
- jslog=${VisualLogging.dropDown('coverage-by-type').track({change: true})} disabled
229
- @change=${this.onFilterByTypeChanged.bind(this)}
230
- ${ref(e => { if (e instanceof HTMLSelectElement) { this.filterByTypeComboBox = e; } })}>
231
- <option value="" jslog=${VisualLogging.item('').track({click: true})}>${i18nString(UIStrings.all)}</option>
195
+ jslog=${VisualLogging.dropDown('coverage-by-type').track({change: true})}
196
+ ?disabled=${!Boolean(input.coverageInfo)}
197
+ @change=${(event: Event) => input.onTypeFilterChanged(
198
+ Number((event.target as HTMLSelectElement).selectedOptions[0]?.value))}>
199
+ <option value="" jslog=${VisualLogging.item('').track({click: true})}
200
+ .selected=${input.typeFilter === null}>${i18nString(UIStrings.all)}</option>
232
201
  <option value=${CoverageType.CSS}
233
- jslog=${VisualLogging.item(`${CoverageType.CSS}`).track({click: true})}>
202
+ jslog=${VisualLogging.item(`${CoverageType.CSS}`).track({click: true})}
203
+ .selected=${input.typeFilter === CoverageType.CSS}>
234
204
  ${i18nString(UIStrings.css)}
235
205
  </option>
236
206
  <option value=${CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION}
237
- jslog=${VisualLogging.item(`${CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION}`).track({click: true})}>
207
+ jslog=${VisualLogging.item(`${CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION}`).track({click: true})}
208
+ .selected=${(input.typeFilter !== null && Boolean(input.typeFilter & (CoverageType.JAVA_SCRIPT | CoverageType.JAVA_SCRIPT_PER_FUNCTION)))}>
238
209
  ${i18nString(UIStrings.javascript)}
239
210
  </option>
240
211
  </select>
241
212
  <div class="toolbar-divider"></div>
242
- <devtools-checkbox title=${i18nString(UIStrings.includeExtensionContentScripts)} disabled
243
- ${bindToSetting(this.showContentScriptsSetting)}
244
- ${ref(e => { if (e instanceof UI.UIUtils.CheckboxLabel) { this.contentScriptsCheckbox = e; } })}>
213
+ <devtools-checkbox title=${i18nString(UIStrings.includeExtensionContentScripts)}
214
+ ${bindToSetting(input.showContentScriptsSetting)}
215
+ ?disabled=${!Boolean(input.coverageInfo)}>
245
216
  ${i18nString(UIStrings.contentScripts)}
246
217
  </devtools-checkbox>
247
218
  </devtools-toolbar>
248
219
  </div>
249
- <div class="coverage-results"
250
- ${ref(e => { if (e instanceof HTMLElement) { this.coverageResultsElement = e; } })}>
220
+ <div class="coverage-results">
221
+ ${input.needsReload ?
222
+ renderReloadPromptPage(input.needsReload === 'bfcache-page' ?
223
+ i18nString(UIStrings.bfcacheNoCapture) : i18nString(UIStrings.activationNoCapture),
224
+ input.needsReload)
225
+ : input.coverageInfo ? html`
226
+ <devtools-widget autofocus class="results" .widgetConfig=${widgetConfig(CoverageListView, {
227
+ coverageInfo: input.coverageInfo,
228
+ highlightRegExp: input.textFilter,
229
+ selectedUrl: input.selectedUrl,
230
+ })}
231
+ ${ref(e => { if (e instanceof HTMLElement) { output.focusResults = () => { e.focus(); };}})}>`
232
+ : renderLandingPage(input.supportsRecordOnReload)}
251
233
  </div>
252
234
  <div class="coverage-toolbar-summary">
253
- <div class="coverage-message"
254
- ${ref(e => { if (e instanceof HTMLElement) { this.statusMessageElement = e; } })}>
235
+ <div class="coverage-message">
236
+ ${input.statusMessage}
255
237
  </div>
256
- </div>`, this.contentElement);
238
+ </div>`, target);
239
+ // clang-format on
240
+ };
241
+
242
+ function renderLandingPage(supportsRecordOnReload: boolean): TemplateResult {
243
+ if (supportsRecordOnReload) {
244
+ // clang-format off
245
+ return html`
246
+ <devtools-widget .widgetConfig=${widgetConfig(UI.EmptyWidget.EmptyWidget,{
247
+ header: i18nString(UIStrings.noCoverageData),
248
+ link: 'https://developer.chrome.com/docs/devtools/coverage' as Platform.DevToolsPath.UrlString,
249
+ text: i18nString(UIStrings.clickTheReloadButtonSToReloadAnd, {PH1: i18nString(UIStrings.reloadPage)}),
250
+ })}>
251
+ <devtools-button ${bindToAction('coverage.start-with-reload')}
252
+ .variant=${Buttons.Button.Variant.TONAL} .iconName=${undefined}>
253
+ ${i18nString(UIStrings.reloadPage)}
254
+ </devtools-button>
255
+ </devtools-widget>`;
257
256
  // clang-format on
257
+ }
258
+ // clang-format off
259
+ return html`
260
+ <devtools-widget .widgetConfig=${widgetConfig(UI.EmptyWidget.EmptyWidget,{
261
+ header: i18nString(UIStrings.noCoverageData),
262
+ link: 'https://developer.chrome.com/docs/devtools/coverage' as Platform.DevToolsPath.UrlString,
263
+ text: i18nString(UIStrings.clickTheRecordButtonSToStart, {PH1: i18nString(UIStrings.startRecording)}),
264
+ })}>
265
+ <devtools-button ${bindToAction('coverage.toggle-recording')}
266
+ .variant=${Buttons.Button.Variant.TONAL} .iconName=${undefined}>
267
+ ${i18nString(UIStrings.startRecording)}
268
+ </devtools-button>
269
+ </devtools-widget>`;
270
+ // clang-format on
271
+ }
272
+
273
+ function renderReloadPromptPage(message: Common.UIString.LocalizedString, className: string): TemplateResult {
274
+ // clang-format off
275
+ return html`
276
+ <div class="widget vbox ${className}">
277
+ <div class="message">${message}</div>
278
+ <span class="message">
279
+ ${i18nTemplate(UIStrings.reloadPrompt, {PH1: html`
280
+ <devtools-button class="inline-button" ${bindToAction('inspector-main.reload')}></devtools-button>`})}
281
+ </span>
282
+ </div>`;
283
+ // clang-format on
284
+ }
285
+
286
+ export class CoverageView extends UI.Widget.VBox {
287
+ #model: CoverageModel|null;
288
+ #decorationManager: CoverageDecorationManager|null;
289
+ readonly #coverageTypeComboBoxSetting: Common.Settings.Setting<number>;
290
+ readonly #toggleRecordAction: UI.ActionRegistration.Action;
291
+ readonly #clearAction: UI.ActionRegistration.Action;
292
+ readonly #exportAction: UI.ActionRegistration.Action;
293
+ #textFilter: RegExp|null;
294
+ #typeFilter: number|null;
295
+ readonly #showContentScriptsSetting: Common.Settings.Setting<boolean>;
296
+
297
+ readonly #view: View;
298
+ #supportsRecordOnReload: boolean;
299
+ #needsReload: 'bfcache-page'|'prerender-page'|null = null;
300
+ #statusMessage = '';
301
+ #output: CoverageViewOutput = {focusResults: () => {}};
302
+ #coverageInfo: CoverageListItem[]|null = null;
303
+ #selectedUrl: Platform.DevToolsPath.UrlString|null = null;
304
+
305
+ constructor(view: View = DEFAULT_VIEW) {
306
+ super({
307
+ jslog: `${VisualLogging.panel('coverage').track({resize: true})}`,
308
+ useShadowDom: true,
309
+ delegatesFocus: true,
310
+ });
311
+ this.registerRequiredCSS(coverageViewStyles);
312
+ this.#view = view;
313
+
314
+ this.#model = null;
315
+ this.#decorationManager = null;
316
+
317
+ this.#coverageTypeComboBoxSetting =
318
+ Common.Settings.Settings.instance().createSetting('coverage-view-coverage-type', 0);
319
+
320
+ this.#toggleRecordAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.toggle-recording');
258
321
 
259
- this.coverageTypeComboBox.selectedIndex = this.coverageTypeComboBoxSetting.get();
260
- this.landingPage = this.buildLandingPage();
261
- this.bfcacheReloadPromptPage = this.buildReloadPromptPage(i18nString(UIStrings.bfcacheNoCapture), 'bfcache-page');
262
- this.activationReloadPromptPage =
263
- this.buildReloadPromptPage(i18nString(UIStrings.activationNoCapture), 'prerender-page');
264
- this.listView = new CoverageListView();
322
+ const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
323
+ this.#supportsRecordOnReload = Boolean(mainTarget?.model(SDK.ResourceTreeModel.ResourceTreeModel));
324
+ this.#clearAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.clear');
325
+ this.#clearAction.setEnabled(false);
326
+ this.#exportAction = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.export');
327
+ this.#exportAction.setEnabled(false);
328
+
329
+ this.#textFilter = null;
330
+
331
+ this.#typeFilter = null;
265
332
 
266
- this.landingPage.show(this.coverageResultsElement);
333
+ this.#showContentScriptsSetting = Common.Settings.Settings.instance().createSetting('show-content-scripts', false);
334
+ this.#showContentScriptsSetting.addChangeListener(this.#onFilterChanged, this);
335
+
336
+ this.requestUpdate();
337
+ }
338
+
339
+ override performUpdate(): void {
340
+ const input: CoverageViewInput = {
341
+ coverageType: this.#coverageTypeComboBoxSetting.get(),
342
+ recording: this.#toggleRecordAction.toggled(),
343
+ supportsRecordOnReload: this.#supportsRecordOnReload,
344
+ typeFilter: this.#typeFilter,
345
+ showContentScriptsSetting: this.#showContentScriptsSetting,
346
+ needsReload: this.#needsReload,
347
+ coverageInfo: this.#coverageInfo,
348
+ textFilter: this.#textFilter,
349
+ selectedUrl: this.#selectedUrl,
350
+ statusMessage: this.#statusMessage,
351
+ onCoverageTypeChanged: this.#onCoverageTypeChanged.bind(this),
352
+ onFilterChanged: (value: string) => {
353
+ this.#textFilter = value ? Platform.StringUtilities.createPlainTextSearchRegex(value, 'i') : null;
354
+ this.#onFilterChanged();
355
+ },
356
+ onTypeFilterChanged: this.#onTypeFilterChanged.bind(this),
357
+ };
358
+ this.#view(input, this.#output, this.contentElement);
267
359
  }
268
360
 
269
361
  static instance(): CoverageView {
@@ -277,68 +369,27 @@ export class CoverageView extends UI.Widget.VBox {
277
369
  coverageViewInstance = undefined;
278
370
  }
279
371
 
280
- private buildLandingPage(): UI.Widget.VBox {
281
- const widget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noCoverageData), '');
282
- widget.link = 'https://developer.chrome.com/docs/devtools/coverage' as Platform.DevToolsPath.UrlString;
283
- if (this.startWithReloadButton) {
284
- const action = UI.ActionRegistry.ActionRegistry.instance().getAction('coverage.start-with-reload');
285
- if (action) {
286
- widget.text = i18nString(UIStrings.clickTheReloadButtonSToReloadAnd, {PH1: i18nString(UIStrings.reloadPage)});
287
- const button = UI.UIUtils.createTextButton(
288
- i18nString(UIStrings.reloadPage), () => action.execute(),
289
- {jslogContext: action.id(), variant: Buttons.Button.Variant.TONAL});
290
- widget.contentElement.append(button);
291
- }
292
- } else {
293
- widget.text = i18nString(UIStrings.clickTheRecordButtonSToStart, {PH1: i18nString(UIStrings.startRecording)});
294
- const button = UI.UIUtils.createTextButton(
295
- i18nString(UIStrings.startRecording), () => this.toggleRecordAction.execute(),
296
- {jslogContext: this.toggleRecordAction.id(), variant: Buttons.Button.Variant.TONAL});
297
- widget.contentElement.append(button);
298
- }
299
- return widget;
300
- }
301
-
302
- private buildReloadPromptPage(message: Common.UIString.LocalizedString, className: string): UI.Widget.VBox {
303
- const widget = new UI.Widget.VBox();
304
- const reasonDiv = document.createElement('div');
305
- reasonDiv.classList.add('message');
306
- reasonDiv.textContent = message;
307
- widget.contentElement.appendChild(reasonDiv);
308
- this.inlineReloadButton =
309
- UI.UIUtils.createInlineButton(UI.Toolbar.Toolbar.createActionButton('inspector-main.reload'));
310
- const messageElement =
311
- i18n.i18n.getFormatLocalizedString(str_, UIStrings.reloadPrompt, {PH1: this.inlineReloadButton});
312
- messageElement.classList.add('message');
313
- widget.contentElement.appendChild(messageElement);
314
- widget.element.classList.add(className);
315
- return widget;
316
- }
317
-
318
372
  clear(): void {
319
- if (this.model) {
320
- this.model.reset();
373
+ if (this.#model) {
374
+ this.#model.reset();
321
375
  }
322
- this.reset();
376
+ this.#reset();
323
377
  }
324
378
 
325
- private reset(): void {
326
- if (this.decorationManager) {
327
- this.decorationManager.dispose();
328
- this.decorationManager = null;
379
+ #reset(): void {
380
+ if (this.#decorationManager) {
381
+ this.#decorationManager.dispose();
382
+ this.#decorationManager = null;
329
383
  }
330
- this.listView.reset();
331
- this.listView.detach();
332
- this.landingPage.show(this.coverageResultsElement);
333
- this.statusMessageElement.textContent = '';
334
- this.filterInput.disabled = true;
335
- this.filterByTypeComboBox.disabled = true;
336
- this.contentScriptsCheckbox.disabled = true;
337
- this.exportAction.setEnabled(false);
384
+ this.#needsReload = null;
385
+ this.#coverageInfo = null;
386
+ this.#statusMessage = '';
387
+ this.#exportAction.setEnabled(false);
388
+ this.requestUpdate();
338
389
  }
339
390
 
340
391
  toggleRecording(): void {
341
- const enable = !this.toggleRecordAction.toggled();
392
+ const enable = !this.#toggleRecordAction.toggled();
342
393
 
343
394
  if (enable) {
344
395
  void this.startRecording({reload: false, jsCoveragePerBlock: this.isBlockCoverageSelected()});
@@ -348,31 +399,22 @@ export class CoverageView extends UI.Widget.VBox {
348
399
  }
349
400
 
350
401
  isBlockCoverageSelected(): boolean {
351
- const option = this.coverageTypeComboBox.selectedOptions[0];
352
- const coverageType = Number(option ? option.value : Number.NaN);
353
402
  // Check that Coverage.CoverageType.JavaScriptPerFunction is not present.
354
- return coverageType === CoverageType.JAVA_SCRIPT;
403
+ return this.#coverageTypeComboBoxSetting.get() === CoverageType.JAVA_SCRIPT;
355
404
  }
356
405
 
357
- private selectCoverageType(jsCoveragePerBlock: boolean): void {
406
+ #selectCoverageType(jsCoveragePerBlock: boolean): void {
358
407
  const selectedIndex = jsCoveragePerBlock ? 1 : 0;
359
- this.coverageTypeComboBox.selectedIndex = selectedIndex;
408
+ this.#coverageTypeComboBoxSetting.set(selectedIndex);
360
409
  }
361
410
 
362
- private onCoverageTypeComboBoxSelectionChanged(): void {
363
- this.coverageTypeComboBoxSetting.set(this.coverageTypeComboBox.selectedIndex);
411
+ #onCoverageTypeChanged(newValue: number): void {
412
+ this.#coverageTypeComboBoxSetting.set(newValue);
364
413
  }
365
414
 
366
415
  async startRecording(options: {reload: (boolean|undefined), jsCoveragePerBlock: (boolean|undefined)}|null):
367
416
  Promise<void> {
368
- let hadFocus, reloadButtonFocused;
369
- if ((this.startWithReloadButton?.hasFocus()) || (this.inlineReloadButton?.hasFocus())) {
370
- reloadButtonFocused = true;
371
- } else if (this.hasFocus()) {
372
- hadFocus = true;
373
- }
374
-
375
- this.reset();
417
+ this.#reset();
376
418
  const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
377
419
  if (!mainTarget) {
378
420
  return;
@@ -380,77 +422,63 @@ export class CoverageView extends UI.Widget.VBox {
380
422
 
381
423
  const {reload, jsCoveragePerBlock} = {reload: false, jsCoveragePerBlock: false, ...options};
382
424
 
383
- if (!this.model || reload) {
384
- this.model = mainTarget.model(CoverageModel);
425
+ if (!this.#model || reload) {
426
+ this.#model = mainTarget.model(CoverageModel);
385
427
  }
386
- if (!this.model) {
428
+ if (!this.#model) {
387
429
  return;
388
430
  }
389
431
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.CoverageStarted);
390
432
  if (jsCoveragePerBlock) {
391
433
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.CoverageStartedPerBlock);
392
434
  }
393
- const success = await this.model.start(Boolean(jsCoveragePerBlock));
435
+ const success = await this.#model.start(Boolean(jsCoveragePerBlock));
394
436
  if (!success) {
395
437
  return;
396
438
  }
397
- this.selectCoverageType(Boolean(jsCoveragePerBlock));
398
- this.model.addEventListener(Events.CoverageUpdated, this.onCoverageDataReceived, this);
399
- this.model.addEventListener(Events.SourceMapResolved, this.updateListView, this);
439
+ this.#selectCoverageType(Boolean(jsCoveragePerBlock));
440
+ this.#model.addEventListener(Events.CoverageUpdated, this.#onCoverageDataReceived, this);
441
+ this.#model.addEventListener(Events.SourceMapResolved, this.#updateListView, this);
400
442
  const resourceTreeModel = mainTarget.model(SDK.ResourceTreeModel.ResourceTreeModel);
401
443
  SDK.TargetManager.TargetManager.instance().addModelListener(
402
444
  SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.PrimaryPageChanged,
403
- this.onPrimaryPageChanged, this);
404
- this.decorationManager = new CoverageDecorationManager(
405
- this.model, Workspace.Workspace.WorkspaceImpl.instance(),
445
+ this.#onPrimaryPageChanged, this);
446
+ this.#decorationManager = new CoverageDecorationManager(
447
+ this.#model, Workspace.Workspace.WorkspaceImpl.instance(),
406
448
  Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance(),
407
449
  Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance());
408
- this.toggleRecordAction.setToggled(true);
409
- this.clearAction.setEnabled(false);
410
- if (this.startWithReloadButton) {
411
- this.startWithReloadButton.disabled = true;
412
- this.startWithReloadButton.hidden = true;
413
- this.toggleRecordButton.disabled = false;
414
- this.toggleRecordButton.hidden = false;
415
- if (reloadButtonFocused) {
416
- this.toggleRecordButton.focus();
417
- }
418
- }
419
- this.coverageTypeComboBox.disabled = true;
420
- this.filterInput.disabled = false;
421
- this.filterByTypeComboBox.disabled = false;
422
- this.contentScriptsCheckbox.disabled = false;
423
- if (this.landingPage.isShowing()) {
424
- this.landingPage.detach();
425
- }
426
- this.listView.show(this.coverageResultsElement);
427
- if (hadFocus && !reloadButtonFocused) {
428
- this.listView.focus();
429
- }
450
+ this.#toggleRecordAction.setToggled(true);
451
+ this.#clearAction.setEnabled(false);
452
+ this.#coverageInfo = [];
453
+ this.#needsReload = null;
454
+ this.requestUpdate();
455
+ await this.updateComplete;
456
+
457
+ this.#output.focusResults();
430
458
  if (reload && resourceTreeModel) {
431
459
  resourceTreeModel.reloadPage();
432
460
  } else {
433
- void this.model.startPolling();
461
+ void this.#model.startPolling();
434
462
  }
435
463
  }
436
464
 
437
- private onCoverageDataReceived(event: Common.EventTarget.EventTargetEvent<CoverageInfo[]>): void {
465
+ #onCoverageDataReceived(event: Common.EventTarget.EventTargetEvent<CoverageInfo[]>): void {
438
466
  const data = event.data;
439
- this.updateViews(data);
467
+ this.#updateViews(data);
440
468
  }
441
469
 
442
- private updateListView(): void {
470
+ #updateListView(): void {
443
471
  const entries =
444
- (this.model?.entries() || [])
445
- .map(entry => this.toCoverageListItem(entry))
446
- .filter(info => this.isVisible(info))
472
+ (this.#model?.entries() || [])
473
+ .map(entry => this.#toCoverageListItem(entry))
474
+ .filter(info => this.#isVisible(info))
447
475
  .map(
448
476
  (entry: CoverageListItem) =>
449
- ({...entry, sources: entry.sources.filter((entry: CoverageListItem) => this.isVisible(entry))}));
450
- this.listView.update(entries, this.textFilterRegExp);
477
+ ({...entry, sources: entry.sources.filter((entry: CoverageListItem) => this.#isVisible(entry))}));
478
+ this.#coverageInfo = entries;
451
479
  }
452
480
 
453
- private toCoverageListItem(info: URLCoverageInfo): CoverageListItem {
481
+ #toCoverageListItem(info: URLCoverageInfo): CoverageListItem {
454
482
  return {
455
483
  url: info.url(),
456
484
  type: info.type(),
@@ -459,7 +487,7 @@ export class CoverageView extends UI.Widget.VBox {
459
487
  unusedSize: info.unusedSize(),
460
488
  usedPercentage: info.usedPercentage(),
461
489
  unusedPercentage: info.unusedPercentage(),
462
- sources: [...info.sourcesURLCoverageInfo.values()].map(this.toCoverageListItem, this),
490
+ sources: [...info.sourcesURLCoverageInfo.values()].map(this.#toCoverageListItem, this),
463
491
  isContentScript: info.isContentScript(),
464
492
  generatedUrl: info instanceof SourceURLCoverageInfo ? info.generatedURLCoverageInfo.url() : undefined,
465
493
  };
@@ -468,27 +496,18 @@ export class CoverageView extends UI.Widget.VBox {
468
496
  async stopRecording(): Promise<void> {
469
497
  SDK.TargetManager.TargetManager.instance().removeModelListener(
470
498
  SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.PrimaryPageChanged,
471
- this.onPrimaryPageChanged, this);
472
- if (this.hasFocus()) {
473
- this.listView.focus();
474
- }
499
+ this.#onPrimaryPageChanged, this);
475
500
  // Stopping the model triggers one last poll to get the final data.
476
- if (this.model) {
477
- await this.model.stop();
478
- this.model.removeEventListener(Events.CoverageUpdated, this.onCoverageDataReceived, this);
501
+ if (this.#model) {
502
+ await this.#model.stop();
503
+ this.#model.removeEventListener(Events.CoverageUpdated, this.#onCoverageDataReceived, this);
479
504
  }
480
- this.toggleRecordAction.setToggled(false);
481
- this.coverageTypeComboBox.disabled = false;
482
- if (this.startWithReloadButton) {
483
- this.startWithReloadButton.disabled = false;
484
- this.startWithReloadButton.hidden = false;
485
- this.toggleRecordButton.disabled = true;
486
- this.toggleRecordButton.hidden = true;
487
- }
488
- this.clearAction.setEnabled(true);
505
+ this.#toggleRecordAction.setToggled(false);
506
+ this.#clearAction.setEnabled(true);
507
+ this.requestUpdate();
489
508
  }
490
509
 
491
- private async onPrimaryPageChanged(
510
+ async #onPrimaryPageChanged(
492
511
  event: Common.EventTarget.EventTargetEvent<
493
512
  {frame: SDK.ResourceTreeModel.ResourceTreeFrame, type: SDK.ResourceTreeModel.PrimaryPageChangeType}>):
494
513
  Promise<void> {
@@ -498,71 +517,64 @@ export class CoverageView extends UI.Widget.VBox {
498
517
  return;
499
518
  }
500
519
  // If the primary page target has changed (due to MPArch activation), switch to new CoverageModel.
501
- if (this.model !== coverageModel) {
502
- if (this.model) {
503
- await this.model.stop();
504
- this.model.removeEventListener(Events.CoverageUpdated, this.onCoverageDataReceived, this);
520
+ if (this.#model !== coverageModel) {
521
+ if (this.#model) {
522
+ await this.#model.stop();
523
+ this.#model.removeEventListener(Events.CoverageUpdated, this.#onCoverageDataReceived, this);
505
524
  }
506
- this.model = coverageModel;
507
- const success = await this.model.start(this.isBlockCoverageSelected());
525
+ this.#model = coverageModel;
526
+ const success = await this.#model.start(this.isBlockCoverageSelected());
508
527
  if (!success) {
509
528
  return;
510
529
  }
511
530
 
512
- this.model.addEventListener(Events.CoverageUpdated, this.onCoverageDataReceived, this);
513
- this.decorationManager = new CoverageDecorationManager(
514
- this.model, Workspace.Workspace.WorkspaceImpl.instance(),
531
+ this.#model.addEventListener(Events.CoverageUpdated, this.#onCoverageDataReceived, this);
532
+ this.#decorationManager = new CoverageDecorationManager(
533
+ this.#model, Workspace.Workspace.WorkspaceImpl.instance(),
515
534
  Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance(),
516
535
  Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance());
517
536
  }
518
537
 
519
- if (this.bfcacheReloadPromptPage.isShowing()) {
520
- this.bfcacheReloadPromptPage.detach();
521
- this.listView.show(this.coverageResultsElement);
522
- }
523
- if (this.activationReloadPromptPage.isShowing()) {
524
- this.activationReloadPromptPage.detach();
525
- this.listView.show(this.coverageResultsElement);
526
- }
527
- if (frame.backForwardCacheDetails.restoredFromCache) {
528
- this.listView.detach();
529
- this.bfcacheReloadPromptPage.show(this.coverageResultsElement);
530
- }
531
538
  if (event.data.type === SDK.ResourceTreeModel.PrimaryPageChangeType.ACTIVATION) {
532
- this.listView.detach();
533
- this.activationReloadPromptPage.show(this.coverageResultsElement);
539
+ this.#needsReload = 'prerender-page';
540
+ } else if (frame.backForwardCacheDetails.restoredFromCache) {
541
+ this.#needsReload = 'bfcache-page';
542
+ } else {
543
+ this.#needsReload = null;
544
+ this.#coverageInfo = [];
534
545
  }
546
+ this.requestUpdate();
535
547
 
536
- this.model.reset();
537
- this.decorationManager?.reset();
538
- this.listView.reset();
539
- void this.model.startPolling();
548
+ this.#model.reset();
549
+ this.#decorationManager?.reset();
550
+ void this.#model.startPolling();
540
551
  }
541
552
 
542
- private updateViews(updatedEntries: CoverageInfo[]): void {
543
- this.updateStats();
544
- this.updateListView();
545
- this.exportAction.setEnabled(this.model !== null && this.model.entries().length > 0);
546
- this.decorationManager?.update(updatedEntries);
553
+ #updateViews(updatedEntries: CoverageInfo[]): void {
554
+ this.#updateStats();
555
+ this.#updateListView();
556
+ this.#exportAction.setEnabled(this.#model !== null && this.#model.entries().length > 0);
557
+ this.#decorationManager?.update(updatedEntries);
558
+ this.requestUpdate();
547
559
  }
548
560
 
549
- private updateStats(): void {
561
+ #updateStats(): void {
550
562
  const all = {total: 0, unused: 0};
551
563
  const filtered = {total: 0, unused: 0};
552
- const filterApplied = this.textFilterRegExp !== null;
553
- if (this.model) {
554
- for (const info of this.model.entries()) {
564
+ const filterApplied = this.#textFilter !== null;
565
+ if (this.#model) {
566
+ for (const info of this.#model.entries()) {
555
567
  all.total += info.size();
556
568
  all.unused += info.unusedSize();
557
- const listItem = this.toCoverageListItem(info);
558
- if (this.isVisible(listItem)) {
559
- if (this.textFilterRegExp?.test(info.url())) {
569
+ const listItem = this.#toCoverageListItem(info);
570
+ if (this.#isVisible(listItem)) {
571
+ if (this.#textFilter?.test(info.url())) {
560
572
  filtered.total += info.size();
561
573
  filtered.unused += info.unusedSize();
562
574
  } else {
563
575
  // If it doesn't match the filter, calculate the stats from visible children if there are any
564
576
  for (const childInfo of info.sourcesURLCoverageInfo.values()) {
565
- if (this.isVisible(this.toCoverageListItem(childInfo))) {
577
+ if (this.#isVisible(this.#toCoverageListItem(childInfo))) {
566
578
  filtered.total += childInfo.size();
567
579
  filtered.unused += childInfo.unusedSize();
568
580
  }
@@ -571,7 +583,7 @@ export class CoverageView extends UI.Widget.VBox {
571
583
  }
572
584
  }
573
585
  }
574
- this.statusMessageElement.textContent = filterApplied ?
586
+ this.#statusMessage = filterApplied ?
575
587
  i18nString(UIStrings.filteredSTotalS, {PH1: formatStat(filtered), PH2: formatStat(all)}) :
576
588
  formatStat(all);
577
589
 
@@ -587,51 +599,42 @@ export class CoverageView extends UI.Widget.VBox {
587
599
  }
588
600
  }
589
601
 
590
- private onFilterChanged(): void {
591
- if (!this.listView) {
592
- return;
593
- }
594
- const text = this.filterInput.value;
595
- this.textFilterRegExp = text ? Platform.StringUtilities.createPlainTextSearchRegex(text, 'i') : null;
596
- this.updateListView();
597
- this.updateStats();
602
+ #onFilterChanged(): void {
603
+ this.#updateListView();
604
+ this.#updateStats();
605
+ this.requestUpdate();
598
606
  }
599
607
 
600
- private onFilterByTypeChanged(): void {
601
- if (!this.listView) {
602
- return;
603
- }
604
-
608
+ #onTypeFilterChanged(typeFilter: number): void {
605
609
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.CoverageReportFiltered);
606
610
 
607
- const option = this.filterByTypeComboBox.selectedOptions[0];
608
- const type = option?.value;
609
- this.typeFilterValue = parseInt(type || '', 10) || null;
610
- this.updateListView();
611
- this.updateStats();
611
+ this.#typeFilter = typeFilter;
612
+ this.#updateListView();
613
+ this.#updateStats();
614
+ this.requestUpdate();
612
615
  }
613
616
 
614
- private isVisible(coverageInfo: CoverageListItem): boolean {
617
+ #isVisible(coverageInfo: CoverageListItem): boolean {
615
618
  const url = coverageInfo.url;
616
619
  if (url.startsWith(CoverageView.EXTENSION_BINDINGS_URL_PREFIX)) {
617
620
  return false;
618
621
  }
619
- if (coverageInfo.isContentScript && !this.showContentScriptsSetting.get()) {
622
+ if (coverageInfo.isContentScript && !this.#showContentScriptsSetting.get()) {
620
623
  return false;
621
624
  }
622
- if (this.typeFilterValue && !(coverageInfo.type & this.typeFilterValue)) {
625
+ if (this.#typeFilter && !(coverageInfo.type & this.#typeFilter)) {
623
626
  return false;
624
627
  }
625
628
  // If it's a parent, check if any children are visible
626
629
  if (coverageInfo.sources.length > 0) {
627
630
  for (const sourceURLCoverageInfo of coverageInfo.sources) {
628
- if (this.isVisible(sourceURLCoverageInfo)) {
631
+ if (this.#isVisible(sourceURLCoverageInfo)) {
629
632
  return true;
630
633
  }
631
634
  }
632
635
  }
633
636
 
634
- return !this.textFilterRegExp || this.textFilterRegExp.test(url);
637
+ return !this.#textFilter || this.#textFilter.test(url);
635
638
  }
636
639
 
637
640
  async exportReport(): Promise<void> {
@@ -642,11 +645,12 @@ export class CoverageView extends UI.Widget.VBox {
642
645
  if (!accepted) {
643
646
  return;
644
647
  }
645
- this.model && await this.model.exportReport(fos);
648
+ this.#model && await this.#model.exportReport(fos);
646
649
  }
647
650
 
648
651
  selectCoverageItemByUrl(url: string): void {
649
- this.listView.selectByUrl(url as Platform.DevToolsPath.UrlString);
652
+ this.#selectedUrl = url as Platform.DevToolsPath.UrlString;
653
+ this.requestUpdate();
650
654
  }
651
655
 
652
656
  static readonly EXTENSION_BINDINGS_URL_PREFIX = 'extensions::';
@@ -660,6 +664,10 @@ export class CoverageView extends UI.Widget.VBox {
660
664
  super.willHide();
661
665
  UI.Context.Context.instance().setFlavor(CoverageView, null);
662
666
  }
667
+
668
+ get model(): CoverageModel|null {
669
+ return this.#model;
670
+ }
663
671
  }
664
672
 
665
673
  export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {