chrome-devtools-frontend 1.0.1526630 → 1.0.1529186

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 (339) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/i18nImpl.ts +6 -1
  5. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  6. package/front_end/core/root/Runtime.ts +38 -4
  7. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  8. package/front_end/core/sdk/CSSRule.ts +35 -6
  9. package/front_end/core/sdk/Connections.ts +2 -1
  10. package/front_end/core/sdk/DOMModel.ts +4 -0
  11. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  12. package/front_end/core/sdk/NetworkManager.ts +267 -34
  13. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  14. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  15. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  16. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  17. package/front_end/core/sdk/SourceMap.ts +41 -11
  18. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  19. package/front_end/core/sdk/SourceMapScopesInfo.ts +49 -2
  20. package/front_end/core/sdk/TargetManager.ts +0 -22
  21. package/front_end/core/sdk/TraceObject.ts +8 -7
  22. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  23. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  24. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  25. package/front_end/entrypoints/main/MainImpl.ts +42 -28
  26. package/front_end/generated/InspectorBackendCommands.js +3 -2
  27. package/front_end/generated/SupportedCSSProperties.js +2 -0
  28. package/front_end/generated/protocol.ts +17 -3
  29. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  30. package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
  31. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  34. package/front_end/models/extensions/ExtensionView.ts +3 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +31 -27
  36. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  37. package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
  38. package/front_end/models/persistence/PersistenceImpl.ts +0 -5
  39. package/front_end/models/persistence/persistence-meta.ts +0 -31
  40. package/front_end/models/persistence/persistence.ts +0 -6
  41. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  42. package/front_end/models/stack_trace/Trie.ts +9 -0
  43. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  44. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  45. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  46. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  47. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  48. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  50. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  51. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  52. package/front_end/panels/application/CookieItemsView.ts +1 -0
  53. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  54. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  56. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  57. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  58. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  59. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  60. package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
  61. package/front_end/panels/common/common.ts +1 -0
  62. package/front_end/panels/console/ConsoleInsightTeaser.ts +369 -0
  63. package/front_end/panels/console/ConsolePanel.ts +2 -0
  64. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  65. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +12 -0
  67. package/front_end/panels/console/ConsoleViewMessage.ts +44 -0
  68. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  69. package/front_end/panels/console/console-meta.ts +14 -0
  70. package/front_end/panels/console/console.ts +6 -0
  71. package/front_end/panels/console/consoleInsightTeaser.css +83 -0
  72. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  73. package/front_end/panels/coverage/CoverageView.ts +292 -284
  74. package/front_end/panels/coverage/coverageView.css +17 -0
  75. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  76. package/front_end/panels/elements/LayoutPane.ts +1 -0
  77. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  79. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  80. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  81. package/front_end/panels/explain/ActionDelegate.ts +4 -2
  82. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  83. package/front_end/panels/explain/explain-meta.ts +7 -0
  84. package/front_end/panels/explain/explain.ts +0 -1
  85. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  86. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  87. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  88. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  89. package/front_end/panels/media/MainView.ts +1 -0
  90. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  91. package/front_end/panels/network/BlockedURLsPane.ts +237 -108
  92. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  93. package/front_end/panels/network/NetworkItemView.ts +1 -0
  94. package/front_end/panels/network/NetworkLogView.ts +9 -7
  95. package/front_end/panels/network/NetworkOverview.ts +1 -0
  96. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  97. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  98. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  99. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  100. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  101. package/front_end/panels/network/RequestResponseView.ts +1 -0
  102. package/front_end/panels/network/RequestTimingView.ts +2 -0
  103. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  104. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  105. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  106. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  107. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  108. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  109. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  110. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  111. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  112. package/front_end/panels/profiler/ProfileView.ts +1 -0
  113. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  114. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  115. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  116. package/front_end/panels/search/SearchView.ts +1 -0
  117. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  118. package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +3 -6
  119. package/front_end/panels/settings/WorkspaceSettingsTab.ts +4 -1
  120. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  121. package/front_end/panels/settings/settings.ts +2 -0
  122. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  123. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  124. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  125. package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
  126. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
  127. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  128. package/front_end/panels/sources/sources-meta.ts +15 -0
  129. package/front_end/panels/sources/sources.ts +2 -0
  130. package/front_end/panels/timeline/README.md +2 -2
  131. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  132. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  133. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  134. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  135. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  136. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  137. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  138. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  139. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  141. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  142. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  143. package/front_end/panels/utils/utils.ts +2 -1
  144. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/diff/diff_match_patch.js +1 -1
  147. package/front_end/third_party/lighthouse/README.chromium +2 -2
  148. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  149. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  150. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  151. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  156. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  158. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  159. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  160. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  161. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  163. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  164. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  167. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  169. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  172. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  174. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  176. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  178. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  179. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  180. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  181. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  182. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  183. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  184. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  185. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  186. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  187. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  188. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  189. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  190. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  191. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  192. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  193. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  194. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  195. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  196. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  197. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  198. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  199. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  200. package/front_end/third_party/web-vitals/README.chromium +5 -8
  201. package/front_end/third_party/web-vitals/package/README.md +191 -152
  202. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  203. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  204. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  205. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  206. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  207. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  208. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  209. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  210. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  211. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  212. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  215. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  219. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  220. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  221. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  222. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  223. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  224. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  225. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  226. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  227. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  228. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  229. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  230. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  231. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  232. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  233. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  234. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  235. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  236. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  237. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  238. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  239. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  240. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  241. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  242. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  243. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  244. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  245. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  246. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  247. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  248. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  249. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  250. package/front_end/third_party/web-vitals/package/package.json +4 -10
  251. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  252. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  253. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  254. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  255. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  256. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  257. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  258. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  259. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  260. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  261. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  262. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  263. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  264. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  265. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  266. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  267. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  268. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  269. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  270. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  271. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  272. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  273. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  274. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  275. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  276. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  277. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  278. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  279. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  280. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  281. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  282. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  283. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  284. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  285. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  286. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  287. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  288. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  289. package/front_end/ui/legacy/InspectorView.ts +2 -0
  290. package/front_end/ui/legacy/ListWidget.ts +2 -2
  291. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  292. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  293. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  294. package/front_end/ui/legacy/UIUtils.ts +8 -19
  295. package/front_end/ui/legacy/ViewManager.ts +1 -0
  296. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  297. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  298. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  299. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  300. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  301. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  302. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  303. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  304. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  305. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  306. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  307. package/front_end/ui/visual_logging/KnownContextValues.ts +25 -0
  308. package/mcp/README.md +7 -0
  309. package/mcp/mcp.ts +8 -0
  310. package/package.json +1 -1
  311. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  312. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  313. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  314. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  315. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  316. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  317. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  318. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  319. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  320. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  323. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  324. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  326. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  327. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  330. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  331. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  332. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  333. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  334. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  335. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  336. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  337. package/front_end/ui/legacy/inlineButton.css +0 -22
  338. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
  339. /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
@@ -165,6 +165,8 @@ export class NetworkManager extends SDKModel<EventTypes> {
165
165
 
166
166
  void this.#networkAgent.invoke_enable({
167
167
  maxPostDataSize: MAX_EAGER_POST_REQUEST_BODY_LENGTH,
168
+ enableDurableMessages: Root.Runtime.hostConfig.devToolsEnableDurableMessages?.enabled,
169
+ maxTotalBufferSize: MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH,
168
170
  reportDirectSocketTraffic: true,
169
171
  });
170
172
  void this.#networkAgent.invoke_setAttachDebugStack({enabled: true});
@@ -520,6 +522,7 @@ export const Fast4GConditions: Conditions = {
520
522
  };
521
523
 
522
524
  const MAX_EAGER_POST_REQUEST_BODY_LENGTH = 64 * 1024; // bytes
525
+ const MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH = 250 * 1024 * 1024; // bytes
523
526
 
524
527
  export class FetchDispatcher implements ProtocolProxyApi.FetchDispatcher {
525
528
  readonly #fetchAgent: ProtocolProxyApi.FetchApi;
@@ -1553,6 +1556,254 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1553
1556
  }
1554
1557
  }
1555
1558
 
1559
+ type RequestConditionsSetting = {
1560
+ url: string,
1561
+ enabled: boolean,
1562
+ }|{
1563
+ urlPattern: URLPatternConstructorString,
1564
+ enabled: boolean,
1565
+ };
1566
+
1567
+ declare global {
1568
+ // TS typedefs are not up to date
1569
+ interface URLPattern {
1570
+ hash: string;
1571
+ hostname: string;
1572
+ password: string;
1573
+ pathname: string;
1574
+ port: string;
1575
+ protocol: string;
1576
+ search: string;
1577
+ username: string;
1578
+ hasRegExpGroups: boolean;
1579
+ test(url: string): boolean;
1580
+ }
1581
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
1582
+ var URLPattern: {prototype: URLPattern, new (input: string): URLPattern};
1583
+ }
1584
+
1585
+ export type URLPatternConstructorString = Platform.Brand.Brand<string, 'URLPatternConstructorString'>;
1586
+
1587
+ export const enum RequestURLPatternValidity {
1588
+ VALID = 'valid',
1589
+ FAILED_TO_PARSE = 'failed-to-parse',
1590
+ HAS_REGEXP_GROUPS = 'has-regexp-groups',
1591
+ }
1592
+
1593
+ export class RequestURLPattern {
1594
+ private constructor(readonly constructorString: URLPatternConstructorString, readonly pattern: URLPattern) {
1595
+ if (pattern.hasRegExpGroups) {
1596
+ throw new Error('RegExp groups are not allowed');
1597
+ }
1598
+ }
1599
+
1600
+ static isValidPattern(pattern: string): RequestURLPatternValidity {
1601
+ try {
1602
+ const urlPattern = new URLPattern(pattern);
1603
+ return urlPattern.hasRegExpGroups ? RequestURLPatternValidity.HAS_REGEXP_GROUPS : RequestURLPatternValidity.VALID;
1604
+ } catch {
1605
+ return RequestURLPatternValidity.FAILED_TO_PARSE;
1606
+ }
1607
+ }
1608
+
1609
+ static create(constructorString: URLPatternConstructorString): RequestURLPattern|null {
1610
+ try {
1611
+ const urlPattern = new URLPattern(constructorString);
1612
+ return urlPattern.hasRegExpGroups ? null : new RequestURLPattern(constructorString, urlPattern);
1613
+ } catch {
1614
+ return null;
1615
+ }
1616
+ }
1617
+
1618
+ static upgradeFromWildcard(pattern: string): RequestURLPattern|null {
1619
+ const tryCreate = (constructorString: string): RequestURLPattern|null => {
1620
+ const result = this.create(constructorString as URLPatternConstructorString);
1621
+ if (result?.pattern.protocol === 'localhost' && result?.pattern.hostname === '') {
1622
+ // localhost:1234 parses as a valid pattern, do the right thing here instead
1623
+ return tryCreate(`*://${constructorString}`);
1624
+ }
1625
+ return result;
1626
+ };
1627
+
1628
+ return tryCreate(pattern) // try as is
1629
+ ??
1630
+ // Try to upgrade patterns created from the network panel, which either blocks the full url (sans
1631
+ // protocol) or just the domain name. In both cases the wildcard patterns had implicit wildcards at the end.
1632
+ // We explicitly add that here, which will match both domain names without path (implicitly setting pathname
1633
+ // to '*') and urls with path (appending * to the pathname).
1634
+ tryCreate(`*://${pattern}*`);
1635
+ }
1636
+ }
1637
+
1638
+ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<RequestCondition.EventTypes> {
1639
+ #pattern: RequestURLPattern|{wildcardURL: string, upgradedPattern?: RequestURLPattern};
1640
+ #enabled: boolean;
1641
+
1642
+ constructor(setting: RequestConditionsSetting) {
1643
+ super();
1644
+ if ('urlPattern' in setting) {
1645
+ this.#pattern = RequestURLPattern.create(setting.urlPattern) ?? {
1646
+ wildcardURL: setting.urlPattern,
1647
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.urlPattern) ?? undefined,
1648
+ };
1649
+ } else {
1650
+ this.#pattern = {
1651
+ wildcardURL: setting.url,
1652
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.url) ?? undefined
1653
+ };
1654
+ }
1655
+ this.#enabled = setting.enabled;
1656
+ }
1657
+
1658
+ get constructorString(): string|undefined {
1659
+ return this.#pattern instanceof RequestURLPattern ? this.#pattern.constructorString :
1660
+ this.#pattern.upgradedPattern?.constructorString;
1661
+ }
1662
+
1663
+ get wildcardURL(): string|undefined {
1664
+ return 'wildcardURL' in this.#pattern ? this.#pattern.wildcardURL : undefined;
1665
+ }
1666
+
1667
+ get constructorStringOrWildcardURL(): string {
1668
+ return this.#pattern instanceof RequestURLPattern ?
1669
+ this.#pattern.constructorString :
1670
+ (this.#pattern.upgradedPattern?.constructorString ?? this.#pattern.wildcardURL);
1671
+ }
1672
+
1673
+ set pattern(pattern: RequestURLPattern|string) {
1674
+ if (typeof pattern === 'string') {
1675
+ // TODO(pfaffe) Remove once the feature flag is no longer required
1676
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1677
+ throw new Error('Should not use wildcard urls');
1678
+ }
1679
+ this.#pattern = {
1680
+ wildcardURL: pattern,
1681
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(pattern) ?? undefined
1682
+ };
1683
+ } else {
1684
+ this.#pattern = pattern;
1685
+ }
1686
+ this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1687
+ }
1688
+
1689
+ get enabled(): boolean {
1690
+ return this.#enabled;
1691
+ }
1692
+
1693
+ set enabled(enabled: boolean) {
1694
+ this.#enabled = enabled;
1695
+ this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1696
+ }
1697
+
1698
+ toSetting(): RequestConditionsSetting {
1699
+ const enabled = this.enabled;
1700
+ return this.#pattern instanceof RequestURLPattern ? {enabled, urlPattern: this.#pattern.constructorString} :
1701
+ {enabled, url: this.#pattern.wildcardURL};
1702
+ }
1703
+
1704
+ get originalOrUpgradedURLPattern(): URLPattern|undefined {
1705
+ return this.#pattern instanceof RequestURLPattern ? this.#pattern.pattern : this.#pattern.upgradedPattern?.pattern;
1706
+ }
1707
+ }
1708
+
1709
+ export namespace RequestCondition {
1710
+ export const enum Events {
1711
+ REQUEST_CONDITION_CHANGED = 'request-condition-changed',
1712
+ }
1713
+
1714
+ export interface EventTypes {
1715
+ [Events.REQUEST_CONDITION_CHANGED]: void;
1716
+ }
1717
+ }
1718
+
1719
+ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<RequestConditions.EventTypes> {
1720
+ readonly #setting =
1721
+ Common.Settings.Settings.instance().createSetting<RequestConditionsSetting[]>('network-blocked-patterns', []);
1722
+ readonly #conditions: RequestCondition[];
1723
+
1724
+ constructor() {
1725
+ super();
1726
+ this.#conditions = this.#setting.get().map(condition => new RequestCondition(condition));
1727
+ for (const condition of this.#conditions) {
1728
+ condition.addEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1729
+ }
1730
+ }
1731
+
1732
+ get count(): number {
1733
+ return this.#conditions.length;
1734
+ }
1735
+
1736
+ findCondition(pattern: string): RequestCondition|undefined {
1737
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1738
+ return this.#conditions.find(condition => condition.constructorString === pattern);
1739
+ }
1740
+ return this.#conditions.find(condition => condition.wildcardURL === pattern);
1741
+ }
1742
+
1743
+ has(url: string): boolean {
1744
+ return Boolean(this.findCondition(url));
1745
+ }
1746
+
1747
+ add(...conditions: RequestCondition[]): void {
1748
+ this.#conditions.push(...conditions);
1749
+ this.#conditionsChanged();
1750
+ }
1751
+
1752
+ delete(condition: RequestCondition): void {
1753
+ const index = this.#conditions.indexOf(condition);
1754
+ if (index < 0) {
1755
+ return;
1756
+ }
1757
+ condition.removeEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1758
+ this.#conditions.splice(index);
1759
+ this.#conditionsChanged();
1760
+ }
1761
+
1762
+ clear(): void {
1763
+ this.#conditions.splice(0);
1764
+ this.#conditionsChanged();
1765
+ for (const condition of this.#conditions) {
1766
+ condition.removeEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1767
+ }
1768
+ }
1769
+
1770
+ #conditionsChanged(): void {
1771
+ this.#setting.set(this.#conditions.map(condition => condition.toSetting()));
1772
+ this.dispatchEventToListeners(RequestConditions.Events.REQUEST_CONDITIONS_CHANGED);
1773
+ }
1774
+
1775
+ get conditions(): IteratorObject<RequestCondition> {
1776
+ return this.#conditions.values();
1777
+ }
1778
+
1779
+ applyConditions(...agents: ProtocolProxyApi.NetworkApi[]): boolean {
1780
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1781
+ const urlPatterns = this.#conditions.filter(condition => condition.enabled && condition.constructorString)
1782
+ .map(condition => ({urlPattern: condition.constructorString as string, block: true}));
1783
+
1784
+ for (const agent of agents) {
1785
+ void agent.invoke_setBlockedURLs({urlPatterns});
1786
+ }
1787
+ return urlPatterns.length > 0;
1788
+ }
1789
+ const urls = this.#conditions.filter(condition => condition.enabled && condition.wildcardURL)
1790
+ .map(condition => condition.wildcardURL as string);
1791
+ for (const agent of agents) {
1792
+ void agent.invoke_setBlockedURLs({urls});
1793
+ }
1794
+ return urls.length > 0;
1795
+ }
1796
+ }
1797
+
1798
+ export namespace RequestConditions {
1799
+ export const enum Events {
1800
+ REQUEST_CONDITIONS_CHANGED = 'request-conditions-changed',
1801
+ }
1802
+ export interface EventTypes {
1803
+ [Events.REQUEST_CONDITIONS_CHANGED]: void;
1804
+ }
1805
+ }
1806
+
1556
1807
  let multiTargetNetworkManagerInstance: MultitargetNetworkManager|null;
1557
1808
 
1558
1809
  export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrapper<MultitargetNetworkManager.EventTypes>
@@ -1567,14 +1818,13 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1567
1818
  #updatingInterceptionPatternsPromise: Promise<void>|null = null;
1568
1819
  readonly #blockingEnabledSetting =
1569
1820
  Common.Settings.Settings.instance().moduleSetting<boolean>('request-blocking-enabled');
1570
- readonly #blockedPatternsSetting =
1571
- Common.Settings.Settings.instance().createSetting<BlockedPattern[]>('network-blocked-patterns', []);
1572
- #effectiveBlockedURLs: string[] = [];
1821
+ readonly #requestConditions = new RequestConditions();
1573
1822
  readonly #urlsForRequestInterceptor:
1574
1823
  Platform.MapUtilities.Multimap<(arg0: InterceptedRequest) => Promise<void>, InterceptionPattern> =
1575
1824
  new Platform.MapUtilities.Multimap();
1576
1825
  #extraHeaders?: Protocol.Network.Headers;
1577
1826
  #customUserAgent?: string;
1827
+ #isBlocking = false;
1578
1828
 
1579
1829
  constructor() {
1580
1830
  super();
@@ -1585,7 +1835,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1585
1835
  this.dispatchEventToListeners(MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED);
1586
1836
  };
1587
1837
  this.#blockingEnabledSetting.addChangeListener(blockedPatternChanged);
1588
- this.#blockedPatternsSetting.addChangeListener(blockedPatternChanged);
1838
+ this.#requestConditions.addEventListener(
1839
+ RequestConditions.Events.REQUEST_CONDITIONS_CHANGED, blockedPatternChanged);
1589
1840
  this.updateBlockedPatterns();
1590
1841
 
1591
1842
  TargetManager.instance().observeModels(NetworkManager, this);
@@ -1653,9 +1904,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1653
1904
  void networkAgent.invoke_setUserAgentOverride(
1654
1905
  {userAgent: this.currentUserAgent(), userAgentMetadata: this.#userAgentMetadataOverride || undefined});
1655
1906
  }
1656
- if (this.#effectiveBlockedURLs.length) {
1657
- void networkAgent.invoke_setBlockedURLs({urls: this.#effectiveBlockedURLs});
1658
- }
1907
+ this.#requestConditions.applyConditions(networkAgent);
1659
1908
  if (this.isIntercepting()) {
1660
1909
  void fetchAgent.invoke_enable({patterns: this.#urlsForRequestInterceptor.valuesArray()});
1661
1910
  }
@@ -1795,9 +2044,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1795
2044
  }
1796
2045
  }
1797
2046
 
1798
- // TODO(allada) Move all request blocking into interception and let view manage blocking.
1799
- blockedPatterns(): BlockedPattern[] {
1800
- return this.#blockedPatternsSetting.get().slice();
2047
+ get requestConditions(): RequestConditions {
2048
+ return this.#requestConditions;
1801
2049
  }
1802
2050
 
1803
2051
  blockingEnabled(): boolean {
@@ -1805,11 +2053,16 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1805
2053
  }
1806
2054
 
1807
2055
  isBlocking(): boolean {
1808
- return Boolean(this.#effectiveBlockedURLs.length);
2056
+ return this.#isBlocking && this.blockingEnabled();
1809
2057
  }
1810
2058
 
1811
- setBlockedPatterns(patterns: BlockedPattern[]): void {
1812
- this.#blockedPatternsSetting.set(patterns);
2059
+ /**
2060
+ * @deprecated Kept for layout tests
2061
+ * TODO(pfaffe) remove
2062
+ */
2063
+ private setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
2064
+ this.requestConditions.clear();
2065
+ this.requestConditions.add(...patterns.map(pattern => new RequestCondition(pattern)));
1813
2066
  }
1814
2067
 
1815
2068
  setBlockingEnabled(enabled: boolean): void {
@@ -1820,22 +2073,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1820
2073
  }
1821
2074
 
1822
2075
  private updateBlockedPatterns(): void {
1823
- const urls = [];
1824
- if (this.#blockingEnabledSetting.get()) {
1825
- for (const pattern of this.#blockedPatternsSetting.get()) {
1826
- if (pattern.enabled) {
1827
- urls.push(pattern.url);
1828
- }
1829
- }
1830
- }
1831
-
1832
- if (!urls.length && !this.#effectiveBlockedURLs.length) {
1833
- return;
1834
- }
1835
- this.#effectiveBlockedURLs = urls;
1836
- for (const agent of this.#networkAgents) {
1837
- void agent.invoke_setBlockedURLs({urls: this.#effectiveBlockedURLs});
1838
- }
2076
+ this.#isBlocking = this.#requestConditions.applyConditions(...this.#networkAgents);
1839
2077
  }
1840
2078
 
1841
2079
  isIntercepting(): boolean {
@@ -2318,11 +2556,6 @@ export interface Conditions {
2318
2556
  targetLatency?: number;
2319
2557
  }
2320
2558
 
2321
- export interface BlockedPattern {
2322
- url: string;
2323
- enabled: boolean;
2324
- }
2325
-
2326
2559
  export interface Message {
2327
2560
  message: string;
2328
2561
  requestId: string;
@@ -300,15 +300,33 @@ export class PreloadingModel extends SDKModel<EventTypes> {
300
300
  onPrerenderStatusUpdated(event: Protocol.Preload.PrerenderStatusUpdatedEvent): void {
301
301
  const loaderId = event.key.loaderId;
302
302
  this.ensureDocumentPreloadingData(loaderId);
303
- const attempt: PrerenderAttemptInternal = {
304
- action: Protocol.Preload.SpeculationAction.Prerender,
305
- key: event.key,
306
- pipelineId: event.pipelineId,
307
- status: convertPreloadingStatus(event.status),
308
- prerenderStatus: event.prerenderStatus || null,
309
- disallowedMojoInterface: event.disallowedMojoInterface || null,
310
- mismatchedHeaders: event.mismatchedHeaders || null,
311
- };
303
+ let attempt: PrerenderAttemptInternal|PrerenderUntilScriptAttemptInternal;
304
+ switch (event.key.action) {
305
+ case Protocol.Preload.SpeculationAction.Prerender:
306
+ attempt = {
307
+ action: event.key.action,
308
+ key: event.key,
309
+ pipelineId: event.pipelineId,
310
+ status: convertPreloadingStatus(event.status),
311
+ prerenderStatus: event.prerenderStatus || null,
312
+ disallowedMojoInterface: event.disallowedMojoInterface || null,
313
+ mismatchedHeaders: event.mismatchedHeaders || null,
314
+ };
315
+ break;
316
+ case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
317
+ attempt = {
318
+ action: event.key.action,
319
+ key: event.key,
320
+ pipelineId: event.pipelineId,
321
+ status: convertPreloadingStatus(event.status),
322
+ prerenderStatus: event.prerenderStatus || null,
323
+ disallowedMojoInterface: event.disallowedMojoInterface || null,
324
+ mismatchedHeaders: event.mismatchedHeaders || null,
325
+ };
326
+ break;
327
+ default:
328
+ throw new Error(`unreachable: event.key.action: ${event.key.action}`);
329
+ }
312
330
  this.documents.get(loaderId)?.preloadingAttempts.upsert(attempt);
313
331
  this.dispatchEventToListeners(Events.MODEL_UPDATED);
314
332
  }
@@ -458,7 +476,7 @@ function convertPreloadingStatus(status: Protocol.Preload.PreloadingStatus): Pre
458
476
 
459
477
  export type PreloadingAttemptId = string;
460
478
 
461
- export type PreloadingAttempt = PrefetchAttempt|PrerenderAttempt;
479
+ export type PreloadingAttempt = PrefetchAttempt|PrerenderAttempt|PrerenderUntilScriptAttempt;
462
480
 
463
481
  export interface PrefetchAttempt {
464
482
  action: Protocol.Preload.SpeculationAction.Prefetch;
@@ -483,7 +501,20 @@ export interface PrerenderAttempt {
483
501
  nodeIds: Protocol.DOM.BackendNodeId[];
484
502
  }
485
503
 
486
- export type PreloadingAttemptInternal = PrefetchAttemptInternal|PrerenderAttemptInternal;
504
+ export interface PrerenderUntilScriptAttempt {
505
+ action: Protocol.Preload.SpeculationAction.PrerenderUntilScript;
506
+ key: Protocol.Preload.PreloadingAttemptKey;
507
+ pipelineId: Protocol.Preload.PreloadPipelineId|null;
508
+ status: PreloadingStatus;
509
+ prerenderStatus: Protocol.Preload.PrerenderFinalStatus|null;
510
+ disallowedMojoInterface: string|null;
511
+ mismatchedHeaders: Protocol.Preload.PrerenderMismatchedHeaders[]|null;
512
+ ruleSetIds: Protocol.Preload.RuleSetId[];
513
+ nodeIds: Protocol.DOM.BackendNodeId[];
514
+ }
515
+
516
+ export type PreloadingAttemptInternal =
517
+ PrefetchAttemptInternal|PrerenderAttemptInternal|PrerenderUntilScriptAttemptInternal;
487
518
 
488
519
  export interface PrefetchAttemptInternal {
489
520
  action: Protocol.Preload.SpeculationAction.Prefetch;
@@ -504,6 +535,16 @@ export interface PrerenderAttemptInternal {
504
535
  mismatchedHeaders: Protocol.Preload.PrerenderMismatchedHeaders[]|null;
505
536
  }
506
537
 
538
+ export interface PrerenderUntilScriptAttemptInternal {
539
+ action: Protocol.Preload.SpeculationAction.PrerenderUntilScript;
540
+ key: Protocol.Preload.PreloadingAttemptKey;
541
+ pipelineId: Protocol.Preload.PreloadPipelineId|null;
542
+ status: PreloadingStatus;
543
+ prerenderStatus: Protocol.Preload.PrerenderFinalStatus|null;
544
+ disallowedMojoInterface: string|null;
545
+ mismatchedHeaders: Protocol.Preload.PrerenderMismatchedHeaders[]|null;
546
+ }
547
+
507
548
  function makePreloadingAttemptId(key: Protocol.Preload.PreloadingAttemptKey): PreloadingAttemptId {
508
549
  let action;
509
550
  switch (key.action) {
@@ -513,6 +554,9 @@ function makePreloadingAttemptId(key: Protocol.Preload.PreloadingAttemptKey): Pr
513
554
  case Protocol.Preload.SpeculationAction.Prerender:
514
555
  action = 'Prerender';
515
556
  break;
557
+ case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
558
+ action = 'PrerenderUntilScript';
559
+ break;
516
560
  }
517
561
 
518
562
  let targetHint;
@@ -551,7 +595,7 @@ export class PreloadPipeline {
551
595
  }
552
596
 
553
597
  getOriginallyTriggered(): PreloadingAttempt {
554
- const attempt = this.getPrerender() || this.getPrefetch();
598
+ const attempt = this.getPrerender() || this.getPrerenderUntilScript() || this.getPrefetch();
555
599
  assertNotNullOrUndefined(attempt);
556
600
  return attempt;
557
601
  }
@@ -564,7 +608,11 @@ export class PreloadPipeline {
564
608
  return this.inner.get(Protocol.Preload.SpeculationAction.Prerender) || null;
565
609
  }
566
610
 
567
- // Returns attempts in the order: prefetch < prerender.
611
+ getPrerenderUntilScript(): PreloadingAttempt|null {
612
+ return this.inner.get(Protocol.Preload.SpeculationAction.PrerenderUntilScript) || null;
613
+ }
614
+
615
+ // Returns attempts in the order: prefetch < prerender_until_script < prerender.
568
616
  // Currently unused.
569
617
  getAttempts(): PreloadingAttempt[] {
570
618
  const ret = [];
@@ -579,6 +627,11 @@ export class PreloadPipeline {
579
627
  ret.push(prerender);
580
628
  }
581
629
 
630
+ const prerenderUntilScript = this.getPrerenderUntilScript();
631
+ if (prerenderUntilScript !== null) {
632
+ ret.push(prerenderUntilScript);
633
+ }
634
+
582
635
  if (ret.length === 0) {
583
636
  throw new Error('unreachable');
584
637
  }
@@ -615,7 +668,9 @@ class PreloadingAttemptRegistry {
615
668
  //
616
669
  // In some cases, browsers automatically triggers preloads. For example, Chrome triggers prefetch
617
670
  // ahead of prerender to prevent multiple fetches in case that the prerender failed due to, e.g.
618
- // use of forbidden mojo APIs. Such prefetch and prerender sit in the same preload pipeline.
671
+ // use of forbidden mojo APIs. Also, a prerender-until-script attempt triggers prefetch as well,
672
+ // and can upgrade to prerender. Such prefetch, prerender-until-script, and prerender sit in the
673
+ // same preload pipeline.
619
674
  //
620
675
  // We regard them as not representative and only show the representative ones to represent
621
676
  // pipelines.
@@ -624,9 +679,9 @@ class PreloadingAttemptRegistry {
624
679
  switch (action) {
625
680
  case Protocol.Preload.SpeculationAction.Prefetch:
626
681
  return 0;
627
- case Protocol.Preload.SpeculationAction.Prerender:
628
- return 1;
629
682
  case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
683
+ return 1;
684
+ case Protocol.Preload.SpeculationAction.Prerender:
630
685
  return 2;
631
686
  }
632
687
  }
@@ -738,7 +793,6 @@ class PreloadingAttemptRegistry {
738
793
  };
739
794
  break;
740
795
  case Protocol.Preload.SpeculationAction.Prerender:
741
- case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
742
796
  attempt = {
743
797
  action: Protocol.Preload.SpeculationAction.Prerender,
744
798
  key,
@@ -749,6 +803,17 @@ class PreloadingAttemptRegistry {
749
803
  mismatchedHeaders: null,
750
804
  };
751
805
  break;
806
+ case Protocol.Preload.SpeculationAction.PrerenderUntilScript:
807
+ attempt = {
808
+ action: Protocol.Preload.SpeculationAction.PrerenderUntilScript,
809
+ key,
810
+ pipelineId: null,
811
+ status: PreloadingStatus.NOT_TRIGGERED,
812
+ prerenderStatus: null,
813
+ disallowedMojoInterface: null,
814
+ mismatchedHeaders: null,
815
+ };
816
+ break;
752
817
  }
753
818
  this.map.set(id, attempt);
754
819
  }
@@ -420,7 +420,7 @@ Content:
420
420
  "url": "https://www.paulirish.com/javascripts/firebase-performance-standalone.js",
421
421
  "hasSourceURL": false,
422
422
  "sourceURL": "",
423
- "sourceMapURL": "firebase-performance-standalone.js.map",
423
+ "sourceMapURL": "data:application/json;charset=utf-8,%7B%22version%22%3A3%2C%22file%22%3A%22firebase-performance-standalone.js%22%2C%22sources%22%3A%5B%22..%2F..%2Fnode_modules%2Ftslib%2Ftslib.es6.js%22%2C%22..%2Futil…",
424
424
  "pid": 97964,
425
425
  "sourceText": "!function(e,t){\"obje…",
426
426
  "length": 48248,
@@ -28,6 +28,7 @@ import * as Common from '../common/common.js';
28
28
  import * as i18n from '../i18n/i18n.js';
29
29
  import type * as Platform from '../platform/platform.js';
30
30
  import type * as ProtocolClient from '../protocol_client/protocol_client.js';
31
+ import * as Root from '../root/root.js';
31
32
 
32
33
  import * as EnhancedTraces from './EnhancedTracesParser.js';
33
34
  import type {
@@ -69,14 +70,38 @@ export class RehydratingConnection implements ProtocolClient.InspectorBackend.Co
69
70
  trace: TraceObject|null = null;
70
71
  sessions = new Map<number, RehydratingSessionBase>();
71
72
  #onConnectionLost: (message: Platform.UIString.LocalizedString) => void;
72
- #rehydratingWindow: Window&typeof globalThis;
73
+ #rehydratingWindow = window;
73
74
  #onReceiveHostWindowPayloadBound = this.onReceiveHostWindowPayload.bind(this);
74
75
 
75
76
  constructor(onConnectionLost: (message: Platform.UIString.LocalizedString) => void) {
76
- // If we're invoking this class, we're in the rehydrating pop-up window. Rename window for clarity.
77
77
  this.#onConnectionLost = onConnectionLost;
78
- this.#rehydratingWindow = window;
79
- this.#setupMessagePassing();
78
+ if (!this.#maybeHandleLoadingFromUrl()) {
79
+ this.#setupMessagePassing();
80
+ }
81
+ }
82
+
83
+ /** Returns true if found a trace URL. */
84
+ #maybeHandleLoadingFromUrl(): boolean {
85
+ let traceUrl = Root.Runtime.Runtime.queryParam('traceURL');
86
+
87
+ if (!traceUrl) {
88
+ // For compatibility, handle the older loadTimelineFromURL.
89
+ const timelineUrl = Root.Runtime.Runtime.queryParam('loadTimelineFromURL');
90
+ if (timelineUrl) {
91
+ // It was double-URI encoded for some reason.
92
+ traceUrl = decodeURIComponent(timelineUrl);
93
+ }
94
+ }
95
+
96
+ if (traceUrl) {
97
+ void fetch(traceUrl).then(r => r.arrayBuffer()).then(b => Common.Gzip.arrayBufferToString(b)).then(traceJson => {
98
+ const trace = new TraceObject(JSON.parse(traceJson));
99
+ void this.startHydration(trace);
100
+ });
101
+ return true;
102
+ }
103
+
104
+ return false;
80
105
  }
81
106
 
82
107
  #setupMessagePassing(): void {
@@ -8,19 +8,23 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
8
8
  import type {Script} from './Script.js';
9
9
 
10
10
  type ScopeTreeNode = Formatter.FormatterWorkerPool.ScopeTreeNode;
11
+ type Text = TextUtils.Text.Text;
11
12
 
12
13
  /** If a script failed to parse, we stash null in order to prevent unnecessary re-parsing */
13
- const scopeTrees = new WeakMap<Script, Promise<ScopeTreeNode|null>>();
14
+ const scopeTrees = new WeakMap<Script, Promise<{scopeTree: ScopeTreeNode, text: Text}|null>>();
14
15
 
15
16
  /**
16
17
  * Computes and caches the scope tree for `script`.
17
18
  *
18
19
  * We use {@link Script} as a key to uniquely identify scripts.
19
20
  * {@link Script} boils down to "target" + "script ID". This
20
- * duplicates work in case of identitical script running on multiple targets
21
+ * duplicates work in case of identical script running on multiple targets
21
22
  * (e.g. workers).
23
+ *
24
+ * We also return a {@link TextUtils.Text.Text} instance. The scope tree uses offsets
25
+ * and the text allows conversion from/to line/column numbers.
22
26
  */
23
- export function scopeTreeForScript(script: Script): Promise<ScopeTreeNode|null> {
27
+ export function scopeTreeForScript(script: Script): Promise<{scopeTree: ScopeTreeNode, text: Text}|null> {
24
28
  let promise = scopeTrees.get(script);
25
29
  if (promise === undefined) {
26
30
  promise = script.requestContentData().then(content => {
@@ -31,6 +35,7 @@ export function scopeTreeForScript(script: Script): Promise<ScopeTreeNode|null>
31
35
  const sourceType = script.isModule ? 'module' : 'script';
32
36
  return Formatter.FormatterWorkerPool.formatterWorkerPool()
33
37
  .javaScriptScopeTree(content.text, sourceType)
38
+ .then(scopeTree => scopeTree ? ({scopeTree, text: content.textObj}) : null)
34
39
  .catch(() => null);
35
40
  });
36
41
  scopeTrees.set(script, promise);