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
@@ -1553,6 +1553,200 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1553
1553
  }
1554
1554
  }
1555
1555
 
1556
+ interface RequestConditionsSetting {
1557
+ url: string;
1558
+ enabled: boolean;
1559
+ }
1560
+
1561
+ declare global {
1562
+ // TS typedefs are not up to date
1563
+ interface URLPattern {
1564
+ hash: string;
1565
+ hostname: string;
1566
+ password: string;
1567
+ pathname: string;
1568
+ port: string;
1569
+ protocol: string;
1570
+ search: string;
1571
+ username: string;
1572
+ hasRegExpGroups: boolean;
1573
+ test(url: string): boolean;
1574
+ }
1575
+ /* eslint-disable-next-line @typescript-eslint/naming-convention */
1576
+ var URLPattern: {prototype: URLPattern, new (input: string): URLPattern};
1577
+ }
1578
+
1579
+ export type URLPatternConstructorString = Platform.Brand.Brand<string, 'URLPatternConstructorString'>;
1580
+
1581
+ export const enum RequestURLPatternValidity {
1582
+ VALID = 'valid',
1583
+ FAILED_TO_PARSE = 'failed-to-parse',
1584
+ HAS_REGEXP_GROUPS = 'has-regexp-groups',
1585
+ }
1586
+
1587
+ export class RequestURLPattern {
1588
+ private constructor(readonly constructorString: URLPatternConstructorString, readonly pattern: URLPattern) {
1589
+ if (pattern.hasRegExpGroups) {
1590
+ throw new Error('RegExp groups are not allowed');
1591
+ }
1592
+ }
1593
+
1594
+ static isValidPattern(pattern: string): RequestURLPatternValidity {
1595
+ try {
1596
+ const urlPattern = new URLPattern(pattern);
1597
+ return urlPattern.hasRegExpGroups ? RequestURLPatternValidity.HAS_REGEXP_GROUPS : RequestURLPatternValidity.VALID;
1598
+ } catch {
1599
+ return RequestURLPatternValidity.FAILED_TO_PARSE;
1600
+ }
1601
+ }
1602
+
1603
+ static create(constructorString: URLPatternConstructorString): RequestURLPattern|null {
1604
+ try {
1605
+ const urlPattern = new URLPattern(constructorString);
1606
+ return urlPattern.hasRegExpGroups ? null : new RequestURLPattern(constructorString, urlPattern);
1607
+ } catch {
1608
+ return null;
1609
+ }
1610
+ }
1611
+
1612
+ static upgradeFromWildcard(pattern: string): RequestURLPattern|null {
1613
+ const tryCreate = (constructorString: string): RequestURLPattern|null => {
1614
+ const result = this.create(constructorString as URLPatternConstructorString);
1615
+ if (result?.pattern.protocol === 'localhost' && result?.pattern.hostname === '') {
1616
+ // localhost:1234 parses as a valid pattern, do the right thing here instead
1617
+ return tryCreate(`*://${constructorString}`);
1618
+ }
1619
+ return result;
1620
+ };
1621
+
1622
+ return tryCreate(pattern) // try as is
1623
+ ??
1624
+ // Try upgrade paths for patterns created from the network panel, which either blocks the full url (sans
1625
+ // protocol) or just the domain name. In both cases the wildcard patterns had implicit wildcards at the end.
1626
+ // The first case is the full url option, which we detect by the presence of '/'. the second case is the
1627
+ // domain name only option.
1628
+ (pattern.includes('/') // If the pattern includes a '/' we consider this the full-url case
1629
+ ?
1630
+ tryCreate(`*://${pattern}*`) // Append a wildcard, since the pathname will be parsed from the pattern.
1631
+ :
1632
+ tryCreate(`*://${pattern}`)); // The pathname is empty, which automatically makes it a wildcard.
1633
+ }
1634
+ }
1635
+
1636
+ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<RequestCondition.EventTypes> {
1637
+ #url: string;
1638
+ #enabled: boolean;
1639
+
1640
+ constructor(setting: RequestConditionsSetting) {
1641
+ super();
1642
+ this.#url = setting.url;
1643
+ this.#enabled = setting.enabled;
1644
+ }
1645
+
1646
+ get url(): string {
1647
+ return this.#url;
1648
+ }
1649
+
1650
+ set url(url: string) {
1651
+ this.#url = url;
1652
+ this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1653
+ }
1654
+
1655
+ get enabled(): boolean {
1656
+ return this.#enabled;
1657
+ }
1658
+
1659
+ set enabled(enabled: boolean) {
1660
+ this.#enabled = enabled;
1661
+ this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1662
+ }
1663
+
1664
+ toSetting(): RequestConditionsSetting {
1665
+ const {url, enabled} = this;
1666
+ return {url, enabled};
1667
+ }
1668
+ }
1669
+
1670
+ export namespace RequestCondition {
1671
+ export const enum Events {
1672
+ REQUEST_CONDITION_CHANGED = 'request-condition-changed',
1673
+ }
1674
+ export interface EventTypes {
1675
+ [Events.REQUEST_CONDITION_CHANGED]: void;
1676
+ }
1677
+ }
1678
+
1679
+ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<RequestConditions.EventTypes> {
1680
+ readonly #setting =
1681
+ Common.Settings.Settings.instance().createSetting<RequestConditionsSetting[]>('network-blocked-patterns', []);
1682
+ readonly #conditions: RequestCondition[];
1683
+
1684
+ constructor() {
1685
+ super();
1686
+ this.#conditions = this.#setting.get().map(condition => new RequestCondition(condition));
1687
+ for (const condition of this.#conditions) {
1688
+ condition.addEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1689
+ }
1690
+ }
1691
+
1692
+ get count(): number {
1693
+ return this.#conditions.length;
1694
+ }
1695
+
1696
+ has(url: string): boolean {
1697
+ return Boolean(this.#conditions.find(condition => condition.url === url));
1698
+ }
1699
+
1700
+ add(...conditions: RequestCondition[]): void {
1701
+ this.#conditions.push(...conditions);
1702
+ this.#conditionsChanged();
1703
+ }
1704
+
1705
+ delete(condition: RequestCondition): void {
1706
+ const index = this.#conditions.indexOf(condition);
1707
+ if (index < 0) {
1708
+ return;
1709
+ }
1710
+ condition.removeEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1711
+ this.#conditions.splice(index);
1712
+ this.#conditionsChanged();
1713
+ }
1714
+
1715
+ clear(): void {
1716
+ this.#conditions.splice(0);
1717
+ this.#conditionsChanged();
1718
+ for (const condition of this.#conditions) {
1719
+ condition.removeEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1720
+ }
1721
+ }
1722
+
1723
+ #conditionsChanged(): void {
1724
+ this.#setting.set(this.#conditions.map(condition => condition.toSetting()));
1725
+ this.dispatchEventToListeners(RequestConditions.Events.REQUEST_CONDITIONS_CHANGED);
1726
+ }
1727
+
1728
+ get conditions(): IteratorObject<RequestCondition> {
1729
+ return this.#conditions.values();
1730
+ }
1731
+
1732
+ * blockedURLPatterns(): Generator<string> {
1733
+ for (const condition of this.#conditions) {
1734
+ if (condition.enabled) {
1735
+ yield condition.url;
1736
+ }
1737
+ }
1738
+ }
1739
+ }
1740
+
1741
+ export namespace RequestConditions {
1742
+ export const enum Events {
1743
+ REQUEST_CONDITIONS_CHANGED = 'request-conditions-changed',
1744
+ }
1745
+ export interface EventTypes {
1746
+ [Events.REQUEST_CONDITIONS_CHANGED]: void;
1747
+ }
1748
+ }
1749
+
1556
1750
  let multiTargetNetworkManagerInstance: MultitargetNetworkManager|null;
1557
1751
 
1558
1752
  export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrapper<MultitargetNetworkManager.EventTypes>
@@ -1567,14 +1761,13 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1567
1761
  #updatingInterceptionPatternsPromise: Promise<void>|null = null;
1568
1762
  readonly #blockingEnabledSetting =
1569
1763
  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[] = [];
1764
+ readonly #requestConditions = new RequestConditions();
1573
1765
  readonly #urlsForRequestInterceptor:
1574
1766
  Platform.MapUtilities.Multimap<(arg0: InterceptedRequest) => Promise<void>, InterceptionPattern> =
1575
1767
  new Platform.MapUtilities.Multimap();
1576
1768
  #extraHeaders?: Protocol.Network.Headers;
1577
1769
  #customUserAgent?: string;
1770
+ #isBlocking = false;
1578
1771
 
1579
1772
  constructor() {
1580
1773
  super();
@@ -1585,7 +1778,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1585
1778
  this.dispatchEventToListeners(MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED);
1586
1779
  };
1587
1780
  this.#blockingEnabledSetting.addChangeListener(blockedPatternChanged);
1588
- this.#blockedPatternsSetting.addChangeListener(blockedPatternChanged);
1781
+ this.#requestConditions.addEventListener(
1782
+ RequestConditions.Events.REQUEST_CONDITIONS_CHANGED, blockedPatternChanged);
1589
1783
  this.updateBlockedPatterns();
1590
1784
 
1591
1785
  TargetManager.instance().observeModels(NetworkManager, this);
@@ -1653,8 +1847,9 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1653
1847
  void networkAgent.invoke_setUserAgentOverride(
1654
1848
  {userAgent: this.currentUserAgent(), userAgentMetadata: this.#userAgentMetadataOverride || undefined});
1655
1849
  }
1656
- if (this.#effectiveBlockedURLs.length) {
1657
- void networkAgent.invoke_setBlockedURLs({urls: this.#effectiveBlockedURLs});
1850
+ const blockedURLs = this.#requestConditions.blockedURLPatterns().toArray();
1851
+ if (blockedURLs.length) {
1852
+ void networkAgent.invoke_setBlockedURLs({urls: blockedURLs});
1658
1853
  }
1659
1854
  if (this.isIntercepting()) {
1660
1855
  void fetchAgent.invoke_enable({patterns: this.#urlsForRequestInterceptor.valuesArray()});
@@ -1795,9 +1990,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1795
1990
  }
1796
1991
  }
1797
1992
 
1798
- // TODO(allada) Move all request blocking into interception and let view manage blocking.
1799
- blockedPatterns(): BlockedPattern[] {
1800
- return this.#blockedPatternsSetting.get().slice();
1993
+ get requestConditions(): RequestConditions {
1994
+ return this.#requestConditions;
1801
1995
  }
1802
1996
 
1803
1997
  blockingEnabled(): boolean {
@@ -1805,11 +1999,16 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1805
1999
  }
1806
2000
 
1807
2001
  isBlocking(): boolean {
1808
- return Boolean(this.#effectiveBlockedURLs.length);
2002
+ return this.#isBlocking && this.blockingEnabled();
1809
2003
  }
1810
2004
 
1811
- setBlockedPatterns(patterns: BlockedPattern[]): void {
1812
- this.#blockedPatternsSetting.set(patterns);
2005
+ /**
2006
+ * @deprecated Kept for layout tests
2007
+ * TODO(pfaffe) remove
2008
+ */
2009
+ setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
2010
+ this.requestConditions.clear();
2011
+ this.requestConditions.add(...patterns.map(pattern => new RequestCondition(pattern)));
1813
2012
  }
1814
2013
 
1815
2014
  setBlockingEnabled(enabled: boolean): void {
@@ -1820,21 +2019,10 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1820
2019
  }
1821
2020
 
1822
2021
  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;
2022
+ const urls = this.#requestConditions.blockedURLPatterns().toArray();
2023
+ this.#isBlocking = urls.length > 0;
1836
2024
  for (const agent of this.#networkAgents) {
1837
- void agent.invoke_setBlockedURLs({urls: this.#effectiveBlockedURLs});
2025
+ void agent.invoke_setBlockedURLs({urls});
1838
2026
  }
1839
2027
  }
1840
2028
 
@@ -2318,11 +2506,6 @@ export interface Conditions {
2318
2506
  targetLatency?: number;
2319
2507
  }
2320
2508
 
2321
- export interface BlockedPattern {
2322
- url: string;
2323
- enabled: boolean;
2324
- }
2325
-
2326
2509
  export interface Message {
2327
2510
  message: string;
2328
2511
  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);