chrome-devtools-frontend 1.0.1376716 → 1.0.1380117

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 (434) hide show
  1. package/config/gni/devtools_grd_files.gni +15 -7
  2. package/config/gni/devtools_image_files.gni +2 -0
  3. package/front_end/Images/src/animation.svg +3 -0
  4. package/front_end/Images/src/brush-2.svg +3 -0
  5. package/front_end/core/common/SettingRegistration.ts +1 -1
  6. package/front_end/core/host/AidaClient.ts +1 -0
  7. package/front_end/core/host/InspectorFrontendHost.ts +4 -0
  8. package/front_end/core/i18n/ByteUtilities.test.ts +34 -0
  9. package/front_end/core/i18n/ByteUtilities.ts +65 -0
  10. package/front_end/core/i18n/NumberFormatter.ts +75 -0
  11. package/front_end/core/i18n/i18n.ts +4 -0
  12. package/front_end/core/i18n/time-utilities.test.ts +20 -2
  13. package/front_end/core/i18n/time-utilities.ts +125 -86
  14. package/front_end/core/platform/NumberUtilities.test.ts +3 -26
  15. package/front_end/core/platform/NumberUtilities.ts +0 -20
  16. package/front_end/core/root/Runtime.ts +6 -3
  17. package/front_end/core/sdk/CPUThrottlingManager.ts +4 -0
  18. package/front_end/core/sdk/CSSContainerQuery.test.ts +10 -16
  19. package/front_end/core/sdk/CSSContainerQuery.ts +3 -15
  20. package/front_end/core/sdk/CSSMatchedStyles.test.ts +4 -0
  21. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -5
  22. package/front_end/core/sdk/CSSModel.ts +18 -0
  23. package/front_end/core/sdk/CSSPropertyParser.test.ts +16 -1
  24. package/front_end/core/sdk/CSSPropertyParser.ts +2 -2
  25. package/front_end/core/sdk/sdk-meta.ts +8 -0
  26. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +3 -3
  27. package/front_end/generated/ARIAProperties.js +4 -0
  28. package/front_end/generated/InspectorBackendCommands.js +8 -6
  29. package/front_end/generated/SupportedCSSProperties.js +17 -4
  30. package/front_end/generated/protocol-mapping.d.ts +15 -1
  31. package/front_end/generated/protocol-proxy-api.d.ts +14 -1
  32. package/front_end/generated/protocol.ts +26 -2
  33. package/front_end/models/extensions/ExtensionAPI.ts +9 -1
  34. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +2 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -21
  36. package/front_end/models/live-metrics/web-vitals-injected/{rollup.config.js → rollup.config.mjs} +1 -1
  37. package/front_end/models/persistence/EditFileSystemView.ts +19 -9
  38. package/front_end/models/persistence/WorkspaceSettingsTab.ts +50 -54
  39. package/front_end/models/persistence/editFileSystemView.css +35 -15
  40. package/front_end/models/persistence/workspaceSettingsTab.css +21 -87
  41. package/front_end/models/timeline_model/timeline_model.ts +0 -6
  42. package/front_end/models/trace/Processor.test.ts +18 -17
  43. package/front_end/models/trace/Processor.ts +10 -14
  44. package/front_end/models/trace/README.md +0 -1
  45. package/front_end/models/{timeline_model → trace/extras}/TimelineJSProfile.ts +19 -29
  46. package/front_end/models/{timeline_model/TimelineModelFilter.test.ts → trace/extras/TraceFilter.test.ts} +15 -17
  47. package/front_end/models/trace/extras/TraceFilter.ts +62 -0
  48. package/front_end/models/{timeline_model/TimelineProfileTree.test.ts → trace/extras/TraceTree.test.ts} +44 -43
  49. package/front_end/models/{timeline_model/TimelineProfileTree.ts → trace/extras/TraceTree.ts} +65 -59
  50. package/front_end/models/trace/extras/extras.ts +3 -0
  51. package/front_end/models/trace/handlers/AnimationHandler.ts +0 -8
  52. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -11
  53. package/front_end/models/trace/handlers/FramesHandler.test.ts +1 -6
  54. package/front_end/models/trace/handlers/FramesHandler.ts +1 -14
  55. package/front_end/models/trace/handlers/GPUHandler.test.ts +0 -2
  56. package/front_end/models/trace/handlers/GPUHandler.ts +1 -25
  57. package/front_end/models/trace/handlers/ImagePaintingHandler.ts +3 -0
  58. package/front_end/models/trace/handlers/InitiatorsHandler.test.ts +0 -1
  59. package/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -20
  60. package/front_end/models/trace/handlers/InvalidationsHandler.test.ts +0 -1
  61. package/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -18
  62. package/front_end/models/trace/handlers/LargestImagePaintHandler.test.ts +2 -2
  63. package/front_end/models/trace/handlers/LargestImagePaintHandler.ts +63 -3
  64. package/front_end/models/trace/handlers/LargestTextPaintHandler.ts +3 -0
  65. package/front_end/models/trace/handlers/LayerTreeHandler.test.ts +0 -2
  66. package/front_end/models/trace/handlers/LayerTreeHandler.ts +1 -18
  67. package/front_end/models/trace/handlers/LayoutShiftsHandler.test.ts +0 -3
  68. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -20
  69. package/front_end/models/trace/handlers/MemoryHandler.test.ts +0 -1
  70. package/front_end/models/trace/handlers/MemoryHandler.ts +3 -0
  71. package/front_end/models/trace/handlers/MetaHandler.test.ts +1 -32
  72. package/front_end/models/trace/handlers/MetaHandler.ts +2 -30
  73. package/front_end/models/trace/handlers/NetworkRequestsHandler.test.ts +0 -26
  74. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +4 -23
  75. package/front_end/models/trace/handlers/PageFramesHandler.ts +3 -0
  76. package/front_end/models/trace/handlers/RendererHandler.test.ts +0 -4
  77. package/front_end/models/trace/handlers/RendererHandler.ts +1 -24
  78. package/front_end/models/trace/handlers/SamplesHandler.test.ts +0 -5
  79. package/front_end/models/trace/handlers/SamplesHandler.ts +0 -26
  80. package/front_end/models/trace/handlers/ScreenshotsHandler.test.ts +0 -1
  81. package/front_end/models/trace/handlers/SelectorStatsHandler.ts +3 -0
  82. package/front_end/models/trace/handlers/ServerTimingsHandler.ts +1 -16
  83. package/front_end/models/trace/handlers/Threads.test.ts +1 -2
  84. package/front_end/models/trace/handlers/UserInteractionsHandler.test.ts +4 -27
  85. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +16 -25
  86. package/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -17
  87. package/front_end/models/trace/handlers/WorkersHandler.test.ts +0 -1
  88. package/front_end/models/trace/handlers/WorkersHandler.ts +0 -23
  89. package/front_end/models/trace/handlers/types.ts +1 -8
  90. package/front_end/models/trace/insights/{CumulativeLayoutShift.test.ts → CLSCulprits.test.ts} +21 -21
  91. package/front_end/models/trace/insights/{CumulativeLayoutShift.ts → CLSCulprits.ts} +24 -5
  92. package/front_end/models/trace/insights/Common.ts +5 -55
  93. package/front_end/models/trace/insights/DocumentLatency.test.ts +2 -2
  94. package/front_end/models/trace/insights/DocumentLatency.ts +26 -6
  95. package/front_end/models/trace/insights/FontDisplay.ts +24 -5
  96. package/front_end/models/trace/insights/InteractionToNextPaint.test.ts +1 -1
  97. package/front_end/models/trace/insights/InteractionToNextPaint.ts +26 -6
  98. package/front_end/models/trace/insights/LCPDiscovery.test.ts +58 -0
  99. package/front_end/models/trace/insights/LCPDiscovery.ts +101 -0
  100. package/front_end/models/trace/insights/{LargestContentfulPaint.test.ts → LCPPhases.test.ts} +6 -28
  101. package/front_end/models/trace/insights/{LargestContentfulPaint.ts → LCPPhases.ts} +37 -38
  102. package/front_end/models/trace/insights/{InsightRunners.ts → Models.ts} +4 -3
  103. package/front_end/models/trace/insights/RenderBlocking.test.ts +1 -1
  104. package/front_end/models/trace/insights/RenderBlocking.ts +33 -28
  105. package/front_end/models/trace/insights/SlowCSSSelector.ts +26 -5
  106. package/front_end/models/trace/insights/{ThirdPartyWeb.test.ts → ThirdParties.test.ts} +3 -3
  107. package/front_end/models/trace/insights/{ThirdPartyWeb.ts → ThirdParties.ts} +24 -5
  108. package/front_end/models/trace/insights/Viewport.test.ts +1 -1
  109. package/front_end/models/trace/insights/Viewport.ts +27 -9
  110. package/front_end/models/trace/insights/insights.ts +1 -1
  111. package/front_end/models/trace/insights/types.ts +11 -9
  112. package/front_end/models/trace/types/TraceEvents.ts +51 -22
  113. package/front_end/panels/application/SharedStorageItemsView.test.ts +3 -3
  114. package/front_end/panels/application/SharedStorageItemsView.ts +5 -3
  115. package/front_end/panels/application/StorageView.ts +3 -3
  116. package/front_end/panels/application/components/StorageMetadataView.ts +1 -2
  117. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +34 -31
  118. package/front_end/panels/coverage/CoverageView.ts +3 -3
  119. package/front_end/panels/elements/ComputedStyleModel.ts +9 -2
  120. package/front_end/panels/elements/ComputedStyleWidget.test.ts +72 -0
  121. package/front_end/panels/elements/ComputedStyleWidget.ts +12 -0
  122. package/front_end/panels/elements/ElementStatePaneWidget.test.ts +84 -30
  123. package/front_end/panels/elements/ElementStatePaneWidget.ts +42 -24
  124. package/front_end/panels/elements/ElementsTreeElement.ts +24 -11
  125. package/front_end/panels/elements/MetricsSidebarPane.ts +12 -7
  126. package/front_end/panels/elements/PropertyMatchers.ts +3 -0
  127. package/front_end/panels/elements/StylePropertiesSection.ts +15 -6
  128. package/front_end/panels/elements/StylePropertyTreeElement.test.ts +3 -1
  129. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
  130. package/front_end/panels/elements/stylePropertiesTreeOutline.css +2 -2
  131. package/front_end/panels/explain/components/ConsoleInsight.ts +8 -18
  132. package/front_end/panels/freestyler/AiAgent.test.ts +58 -1
  133. package/front_end/panels/freestyler/AiAgent.ts +58 -3
  134. package/front_end/panels/freestyler/DrJonesFileAgent.test.ts +99 -23
  135. package/front_end/panels/freestyler/DrJonesFileAgent.ts +53 -20
  136. package/front_end/panels/freestyler/DrJonesNetworkAgent.test.ts +15 -7
  137. package/front_end/panels/freestyler/DrJonesNetworkAgent.ts +36 -15
  138. package/front_end/panels/freestyler/DrJonesPerformanceAgent.test.ts +6 -6
  139. package/front_end/panels/freestyler/DrJonesPerformanceAgent.ts +48 -8
  140. package/front_end/panels/freestyler/FreestylerAgent.test.ts +15 -14
  141. package/front_end/panels/freestyler/FreestylerAgent.ts +52 -8
  142. package/front_end/panels/freestyler/FreestylerPanel.test.ts +539 -39
  143. package/front_end/panels/freestyler/FreestylerPanel.ts +349 -215
  144. package/front_end/panels/freestyler/components/FreestylerChatUi.test.ts +126 -34
  145. package/front_end/panels/freestyler/components/FreestylerChatUi.ts +320 -268
  146. package/front_end/panels/freestyler/components/UserActionRow.ts +156 -47
  147. package/front_end/panels/freestyler/components/freestylerChatUi.css +69 -34
  148. package/front_end/panels/freestyler/components/userActionRow.css +40 -67
  149. package/front_end/panels/freestyler/freestyler-meta.ts +3 -11
  150. package/front_end/panels/issues/components/HideIssuesMenu.ts +2 -11
  151. package/front_end/panels/layer_viewer/LayerDetailsView.ts +1 -2
  152. package/front_end/panels/layer_viewer/PaintProfilerView.ts +5 -5
  153. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +46 -0
  154. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +26 -17
  155. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +25 -19
  156. package/front_end/panels/network/BinaryResourceView.ts +6 -7
  157. package/front_end/panels/network/EventSourceMessagesView.ts +1 -1
  158. package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
  159. package/front_end/panels/network/NetworkLogView.ts +7 -8
  160. package/front_end/panels/network/RequestTimingView.test.ts +35 -1
  161. package/front_end/panels/network/RequestTimingView.ts +96 -0
  162. package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -2
  163. package/front_end/panels/network/networkTimingTable.css +2 -1
  164. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  165. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  166. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  167. package/front_end/panels/profiler/HeapTimelineOverview.ts +12 -12
  168. package/front_end/panels/profiler/IsolateSelector.ts +3 -4
  169. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +1 -1
  170. package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +7 -6
  171. package/front_end/panels/profiler/ProfileView.ts +1 -1
  172. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  173. package/front_end/panels/recorder/injected/{rollup.config.js → rollup.config.mjs} +1 -1
  174. package/front_end/panels/recorder/recorderController.css +0 -4
  175. package/front_end/panels/security/CookieReportTreeElement.ts +1 -9
  176. package/front_end/panels/security/CookieReportView.ts +120 -0
  177. package/front_end/panels/security/SecurityPanel.ts +8 -2
  178. package/front_end/panels/security/cookieReportView.css +46 -0
  179. package/front_end/panels/security/sidebar.css +1 -2
  180. package/front_end/panels/sensors/LocationsSettingsTab.ts +26 -11
  181. package/front_end/panels/sensors/locationsSettingsTab.css +18 -18
  182. package/front_end/panels/settings/AISettingsTab.ts +6 -15
  183. package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
  184. package/front_end/panels/settings/SettingsScreen.ts +61 -56
  185. package/front_end/panels/settings/aiSettingsTab.css +3 -14
  186. package/front_end/panels/settings/components/SyncSection.ts +1 -2
  187. package/front_end/panels/settings/components/syncSection.css +0 -10
  188. package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +3 -1
  189. package/front_end/panels/settings/keybindsSettingsTab.css +7 -10
  190. package/front_end/panels/settings/settingsScreen.css +27 -125
  191. package/front_end/panels/sources/DebuggerPlugin.ts +9 -4
  192. package/front_end/panels/sources/NavigatorView.ts +11 -13
  193. package/front_end/panels/timeline/ActiveFilters.ts +3 -4
  194. package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -2
  195. package/front_end/panels/timeline/CountersGraph.ts +2 -4
  196. package/front_end/panels/timeline/EventsTimelineTreeView.ts +7 -8
  197. package/front_end/panels/timeline/README.md +2 -1
  198. package/front_end/panels/timeline/TimelineController.ts +14 -4
  199. package/front_end/panels/timeline/TimelineEventOverview.ts +3 -4
  200. package/front_end/panels/timeline/TimelineFilters.ts +3 -4
  201. package/front_end/panels/timeline/TimelineFlameChartDataProvider.test.ts +1 -1
  202. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -10
  203. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -2
  204. package/front_end/panels/timeline/TimelineFlameChartView.ts +21 -12
  205. package/front_end/panels/timeline/TimelineLoader.test.ts +1 -2
  206. package/front_end/panels/timeline/TimelineLoader.ts +3 -4
  207. package/front_end/panels/timeline/TimelineMiniMap.ts +10 -0
  208. package/front_end/panels/timeline/TimelinePanel.ts +20 -8
  209. package/front_end/panels/timeline/TimelineTreeView.test.ts +12 -13
  210. package/front_end/panels/timeline/TimelineTreeView.ts +35 -40
  211. package/front_end/panels/timeline/TimelineUIUtils.test.ts +2 -2
  212. package/front_end/panels/timeline/TimelineUIUtils.ts +12 -14
  213. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +6 -7
  214. package/front_end/panels/timeline/components/LiveMetricsView.test.ts +3 -3
  215. package/front_end/panels/timeline/components/LiveMetricsView.ts +14 -26
  216. package/front_end/panels/timeline/components/MetricCard.test.ts +1 -1
  217. package/front_end/panels/timeline/components/MetricCard.ts +46 -0
  218. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +3 -4
  219. package/front_end/panels/timeline/components/SidebarSingleInsightSet.test.ts +2 -0
  220. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +41 -36
  221. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +19 -33
  222. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +29 -40
  223. package/front_end/panels/timeline/components/insights/FontDisplay.ts +17 -23
  224. package/front_end/panels/timeline/components/insights/Helpers.ts +12 -16
  225. package/front_end/panels/timeline/components/insights/InteractionToNextPaint.ts +14 -26
  226. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +25 -37
  227. package/front_end/panels/timeline/components/insights/LCPPhases.ts +20 -47
  228. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +19 -28
  229. package/front_end/panels/timeline/components/insights/SidebarInsight.ts +1 -2
  230. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +18 -31
  231. package/front_end/panels/timeline/components/insights/Table.ts +5 -3
  232. package/front_end/panels/timeline/components/insights/ThirdParties.ts +18 -25
  233. package/front_end/panels/timeline/components/insights/Viewport.ts +14 -25
  234. package/front_end/panels/timeline/components/liveMetricsView.css +5 -13
  235. package/front_end/panels/timeline/components/metricCard.css +11 -0
  236. package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
  237. package/front_end/panels/timeline/overlays/OverlaysImpl.test.ts +5 -5
  238. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +13 -12
  239. package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
  240. package/front_end/panels/timeline/utils/AICallTree.test.ts +105 -0
  241. package/front_end/panels/timeline/utils/AICallTree.ts +25 -24
  242. package/front_end/testing/EnvironmentHelpers.ts +5 -18
  243. package/front_end/testing/InsightHelpers.ts +4 -4
  244. package/front_end/testing/TraceHelpers.ts +1 -1
  245. package/front_end/third_party/puppeteer/README.chromium +2 -2
  246. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +2 -3
  247. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +14 -3
  250. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +16 -2
  252. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts +34 -5
  254. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js +51 -2
  256. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js.map +1 -1
  257. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  258. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js +10 -8
  259. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js.map +1 -1
  260. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
  262. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts +14 -4
  264. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js +57 -23
  266. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts +1 -1
  268. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js +13 -10
  270. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts +15 -4
  272. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js +55 -26
  274. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +0 -8
  276. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +2 -11
  278. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +2 -1
  280. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +5 -2
  282. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +7 -0
  284. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +9 -1
  286. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js +5 -3
  289. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js.map +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js +0 -3
  293. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js.map +1 -1
  294. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  296. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  298. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  299. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  300. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  301. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  303. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts +14 -0
  304. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  305. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js +18 -0
  306. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js.map +1 -0
  307. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +51 -10
  308. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +215 -97
  309. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +2 -3
  310. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  312. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts +14 -3
  313. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +16 -2
  315. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +34 -5
  317. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
  318. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js +51 -2
  319. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js.map +1 -1
  320. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js +10 -8
  322. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js.map +1 -1
  323. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  324. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
  325. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  326. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts +14 -4
  327. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts.map +1 -1
  328. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js +57 -23
  329. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js.map +1 -1
  330. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts +1 -1
  331. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  332. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js +13 -10
  333. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js.map +1 -1
  334. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts +15 -4
  335. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js +55 -26
  337. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js.map +1 -1
  338. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +0 -8
  339. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +1 -9
  341. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +2 -1
  343. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  344. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +5 -2
  345. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
  346. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +7 -0
  347. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
  348. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +7 -0
  349. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
  350. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.d.ts.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js +5 -3
  352. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js.map +1 -1
  353. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +1 -1
  354. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -1
  355. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +0 -3
  356. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  358. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  360. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  362. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  363. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  364. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts +14 -0
  365. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  366. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js +15 -0
  367. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js.map +1 -0
  368. package/front_end/third_party/puppeteer/package/lib/types.d.ts +51 -10
  369. package/front_end/third_party/puppeteer/package/package.json +4 -4
  370. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +2 -3
  371. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +21 -3
  372. package/front_end/third_party/puppeteer/package/src/api/Input.ts +57 -8
  373. package/front_end/third_party/puppeteer/package/src/bidi/ElementHandle.ts +9 -7
  374. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -0
  375. package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -31
  376. package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +14 -9
  377. package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +71 -26
  378. package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +1 -15
  379. package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +8 -1
  380. package/front_end/third_party/puppeteer/package/src/common/Errors.ts +7 -0
  381. package/front_end/third_party/puppeteer/package/src/common/WaitTask.ts +9 -9
  382. package/front_end/third_party/puppeteer/package/src/environment.ts +1 -4
  383. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  384. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  385. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  386. package/front_end/third_party/puppeteer/package/src/util/incremental-id-generator.ts +20 -0
  387. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
  388. package/front_end/ui/components/buttons/Button.test.ts +14 -0
  389. package/front_end/ui/components/buttons/Button.ts +27 -4
  390. package/front_end/ui/components/cards/card.css +7 -4
  391. package/front_end/ui/components/dialogs/Dialog.ts +2 -4
  392. package/front_end/ui/components/dialogs/ShortcutDialog.ts +15 -13
  393. package/front_end/ui/components/dialogs/dialog.css +2 -6
  394. package/front_end/ui/components/dialogs/shortcutDialog.css +33 -41
  395. package/front_end/ui/components/docs/freestyler/basic.ts +6 -8
  396. package/front_end/ui/components/docs/freestyler/empty_state.ts +6 -8
  397. package/front_end/ui/components/docs/performance_panel/track_example.html +1 -1
  398. package/front_end/ui/components/markdown_view/MarkdownView.test.ts +39 -17
  399. package/front_end/ui/components/markdown_view/MarkdownView.ts +77 -14
  400. package/front_end/ui/components/markdown_view/markdownView.css +15 -0
  401. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -2
  402. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  403. package/front_end/ui/legacy/InplaceEditor.ts +18 -14
  404. package/front_end/ui/legacy/TabbedPane.ts +0 -14
  405. package/front_end/ui/legacy/UIUtils.ts +0 -7
  406. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +7 -2
  407. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +8 -4
  408. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +20 -11
  409. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.test.ts +19 -0
  410. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +1 -1
  411. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
  412. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -22
  413. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +129 -100
  414. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +4 -2
  415. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.test.ts +9 -4
  416. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.ts +6 -6
  417. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +22 -4
  418. package/front_end/ui/legacy/components/perf_ui/flameChart.css +0 -2
  419. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.test.ts +49 -0
  420. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +23 -46
  421. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  422. package/front_end/ui/legacy/components/utils/ImagePreview.ts +1 -1
  423. package/front_end/ui/legacy/textPrompt.css +1 -1
  424. package/front_end/ui/legacy/toolbar.css +4 -5
  425. package/front_end/ui/visual_logging/KnownContextValues.ts +174 -0
  426. package/front_end/ui/visual_logging/LoggingConfig.ts +6 -2
  427. package/package.json +7 -6
  428. package/scripts/build/ninja/bundle.gni +3 -3
  429. package/scripts/build/{rollup.config.js → rollup.config.mjs} +4 -4
  430. package/scripts/devtools_paths.py +8 -4
  431. package/scripts/eslint_rules/tests/check_test_definitions_test.js +8 -3
  432. package/scripts/tools/update_goldens_v2.py +1 -1
  433. package/front_end/models/timeline_model/TimelineModelFilter.ts +0 -61
  434. /package/front_end/Images/{rollup.config.js → rollup.config.mjs} +0 -0
@@ -28,6 +28,7 @@ import type {
28
28
  KeyboardTypeOptions,
29
29
  KeyPressOptions,
30
30
  MouseClickOptions,
31
+ TouchHandle,
31
32
  } from './Input.js';
32
33
  import {JSHandle} from './JSHandle.js';
33
34
  import type {
@@ -997,19 +998,36 @@ export abstract class ElementHandle<
997
998
  await this.frame.page().touchscreen.tap(x, y);
998
999
  }
999
1000
 
1001
+ /**
1002
+ * This method scrolls the element into view if needed, and then
1003
+ * starts a touch in the center of the element.
1004
+ * @returns A {@link TouchHandle} representing the touch that was started
1005
+ */
1000
1006
  @throwIfDisposed()
1001
1007
  @bindIsolatedHandle
1002
- async touchStart(this: ElementHandle<Element>): Promise<void> {
1008
+ async touchStart(this: ElementHandle<Element>): Promise<TouchHandle> {
1003
1009
  await this.scrollIntoViewIfNeeded();
1004
1010
  const {x, y} = await this.clickablePoint();
1005
- await this.frame.page().touchscreen.touchStart(x, y);
1011
+ return await this.frame.page().touchscreen.touchStart(x, y);
1006
1012
  }
1007
1013
 
1014
+ /**
1015
+ * This method scrolls the element into view if needed, and then
1016
+ * moves the touch to the center of the element.
1017
+ * @param touch - An optional {@link TouchHandle}. If provided, this touch
1018
+ * will be moved. If not provided, the first active touch will be moved.
1019
+ */
1008
1020
  @throwIfDisposed()
1009
1021
  @bindIsolatedHandle
1010
- async touchMove(this: ElementHandle<Element>): Promise<void> {
1022
+ async touchMove(
1023
+ this: ElementHandle<Element>,
1024
+ touch?: TouchHandle,
1025
+ ): Promise<void> {
1011
1026
  await this.scrollIntoViewIfNeeded();
1012
1027
  const {x, y} = await this.clickablePoint();
1028
+ if (touch) {
1029
+ return await touch.move(x, y);
1030
+ }
1013
1031
  await this.frame.page().touchscreen.touchMove(x, y);
1014
1032
  }
1015
1033
 
@@ -6,7 +6,9 @@
6
6
 
7
7
  import type {Protocol} from 'devtools-protocol';
8
8
 
9
+ import {TouchError} from '../common/Errors.js';
9
10
  import type {KeyInput} from '../common/USKeyboardLayout.js';
11
+ import {createIncrementalIdGenerator} from '../util/incremental-id-generator.js';
10
12
 
11
13
  import type {Point} from './ElementHandle.js';
12
14
 
@@ -469,36 +471,71 @@ export abstract class Mouse {
469
471
  options?: {delay?: number},
470
472
  ): Promise<void>;
471
473
  }
472
-
474
+ /**
475
+ * The TouchHandle interface exposes methods to manipulate touches that have been started
476
+ * @public
477
+ */
478
+ export interface TouchHandle {
479
+ /**
480
+ * Dispatches a `touchMove` event for this touch.
481
+ * @param x - Horizontal position of the move.
482
+ * @param y - Vertical position of the move.
483
+ */
484
+ move(x: number, y: number): Promise<void>;
485
+ /**
486
+ * Dispatches a `touchend` event for this touch.
487
+ */
488
+ end(): Promise<void>;
489
+ }
473
490
  /**
474
491
  * The Touchscreen class exposes touchscreen events.
475
492
  * @public
476
493
  */
477
494
  export abstract class Touchscreen {
495
+ /**
496
+ * @internal
497
+ */
498
+ idGenerator = createIncrementalIdGenerator();
499
+ /**
500
+ * @internal
501
+ */
502
+ touches: TouchHandle[] = [];
478
503
  /**
479
504
  * @internal
480
505
  */
481
506
  constructor() {}
482
507
 
508
+ /**
509
+ * @internal
510
+ */
511
+ removeHandle(handle: TouchHandle): void {
512
+ const index = this.touches.indexOf(handle);
513
+ if (index === -1) {
514
+ return;
515
+ }
516
+ this.touches.splice(index, 1);
517
+ }
518
+
483
519
  /**
484
520
  * Dispatches a `touchstart` and `touchend` event.
485
521
  * @param x - Horizontal position of the tap.
486
522
  * @param y - Vertical position of the tap.
487
523
  */
488
524
  async tap(x: number, y: number): Promise<void> {
489
- await this.touchStart(x, y);
490
- await this.touchEnd();
525
+ const touch = await this.touchStart(x, y);
526
+ await touch.end();
491
527
  }
492
528
 
493
529
  /**
494
530
  * Dispatches a `touchstart` event.
495
531
  * @param x - Horizontal position of the tap.
496
532
  * @param y - Vertical position of the tap.
533
+ * @returns A handle for the touch that was started.
497
534
  */
498
- abstract touchStart(x: number, y: number): Promise<void>;
535
+ abstract touchStart(x: number, y: number): Promise<TouchHandle>;
499
536
 
500
537
  /**
501
- * Dispatches a `touchMove` event.
538
+ * Dispatches a `touchMove` event on the first touch that is active.
502
539
  * @param x - Horizontal position of the move.
503
540
  * @param y - Vertical position of the move.
504
541
  *
@@ -509,10 +546,22 @@ export abstract class Touchscreen {
509
546
  * {@link https://developer.chrome.com/blog/a-more-compatible-smoother-touch/#chromes-new-model-the-throttled-async-touchmove-model | throttles}
510
547
  * touch move events.
511
548
  */
512
- abstract touchMove(x: number, y: number): Promise<void>;
549
+ async touchMove(x: number, y: number): Promise<void> {
550
+ const touch = this.touches[0];
551
+ if (!touch) {
552
+ throw new TouchError('Must start a new Touch first');
553
+ }
554
+ return await touch.move(x, y);
555
+ }
513
556
 
514
557
  /**
515
- * Dispatches a `touchend` event.
558
+ * Dispatches a `touchend` event on the first touch that is active.
516
559
  */
517
- abstract touchEnd(): Promise<void>;
560
+ async touchEnd(): Promise<void> {
561
+ const touch = this.touches.shift();
562
+ if (!touch) {
563
+ throw new TouchError('Must start a new Touch first');
564
+ }
565
+ await touch.end();
566
+ }
518
567
  }
@@ -102,13 +102,15 @@ export class BidiElementHandle<
102
102
  ): Promise<void> {
103
103
  // Locate all files and confirm that they exist.
104
104
  const path = environment.value.path;
105
- files = files.map(file => {
106
- if (path.win32.isAbsolute(file) || path.posix.isAbsolute(file)) {
107
- return file;
108
- } else {
109
- return path.resolve(file);
110
- }
111
- });
105
+ if (path) {
106
+ files = files.map(file => {
107
+ if (path.win32.isAbsolute(file) || path.posix.isAbsolute(file)) {
108
+ return file;
109
+ } else {
110
+ return path.resolve(file);
111
+ }
112
+ });
113
+ }
112
114
  await this.frame.setFiles(this, files);
113
115
  }
114
116
 
@@ -193,6 +193,7 @@ export class BidiFrame extends Frame {
193
193
  text,
194
194
  args,
195
195
  getStackTraceLocations(entry.stackTrace),
196
+ this,
196
197
  ),
197
198
  );
198
199
  } else if (isJavaScriptLogEntry(entry)) {
@@ -12,6 +12,7 @@ import {
12
12
  Mouse,
13
13
  MouseButton,
14
14
  Touchscreen,
15
+ type TouchHandle,
15
16
  type KeyboardTypeOptions,
16
17
  type KeyDownOptions,
17
18
  type KeyPressOptions,
@@ -21,6 +22,7 @@ import {
21
22
  type MouseWheelOptions,
22
23
  } from '../api/Input.js';
23
24
  import {UnsupportedOperation} from '../common/Errors.js';
25
+ import {TouchError} from '../common/Errors.js';
24
26
  import type {KeyInput} from '../common/USKeyboardLayout.js';
25
27
 
26
28
  import type {BidiPage} from './Page.js';
@@ -613,79 +615,87 @@ export class BidiMouse extends Mouse {
613
615
  /**
614
616
  * @internal
615
617
  */
616
- export class BidiTouchscreen extends Touchscreen {
618
+ class BidiTouchHandle implements TouchHandle {
619
+ #started = false;
620
+ #x: number;
621
+ #y: number;
622
+ #bidiId: string;
617
623
  #page: BidiPage;
624
+ #touchScreen: BidiTouchscreen;
625
+ #properties: Bidi.Input.PointerCommonProperties;
618
626
 
619
- constructor(page: BidiPage) {
620
- super();
627
+ constructor(
628
+ page: BidiPage,
629
+ touchScreen: BidiTouchscreen,
630
+ id: number,
631
+ x: number,
632
+ y: number,
633
+ properties: Bidi.Input.PointerCommonProperties,
634
+ ) {
621
635
  this.#page = page;
636
+ this.#touchScreen = touchScreen;
637
+ this.#x = Math.round(x);
638
+ this.#y = Math.round(y);
639
+ this.#properties = properties;
640
+ this.#bidiId = `${InputId.Finger}_${id}`;
622
641
  }
623
642
 
624
- override async touchStart(
625
- x: number,
626
- y: number,
627
- options: BidiTouchMoveOptions = {},
628
- ): Promise<void> {
643
+ async start(options: BidiTouchMoveOptions = {}): Promise<void> {
644
+ if (this.#started) {
645
+ throw new TouchError('Touch has already started');
646
+ }
629
647
  await this.#page.mainFrame().browsingContext.performActions([
630
648
  {
631
649
  type: SourceActionsType.Pointer,
632
- id: InputId.Finger,
650
+ id: this.#bidiId,
633
651
  parameters: {
634
652
  pointerType: Bidi.Input.PointerType.Touch,
635
653
  },
636
654
  actions: [
637
655
  {
638
656
  type: ActionType.PointerMove,
639
- x: Math.round(x),
640
- y: Math.round(y),
657
+ x: this.#x,
658
+ y: this.#y,
641
659
  origin: options.origin,
642
660
  },
643
661
  {
662
+ ...this.#properties,
644
663
  type: ActionType.PointerDown,
645
664
  button: 0,
646
- width: 0.5 * 2, // 2 times default touch radius.
647
- height: 0.5 * 2, // 2 times default touch radius.
648
- pressure: 0.5,
649
- altitudeAngle: Math.PI / 2,
650
665
  },
651
666
  ],
652
667
  },
653
668
  ]);
669
+ this.#started = true;
654
670
  }
655
671
 
656
- override async touchMove(
657
- x: number,
658
- y: number,
659
- options: BidiTouchMoveOptions = {},
660
- ): Promise<void> {
661
- await this.#page.mainFrame().browsingContext.performActions([
672
+ move(x: number, y: number): Promise<void> {
673
+ const newX = Math.round(x);
674
+ const newY = Math.round(y);
675
+ return this.#page.mainFrame().browsingContext.performActions([
662
676
  {
663
677
  type: SourceActionsType.Pointer,
664
- id: InputId.Finger,
678
+ id: this.#bidiId,
665
679
  parameters: {
666
680
  pointerType: Bidi.Input.PointerType.Touch,
667
681
  },
668
682
  actions: [
669
683
  {
684
+ ...this.#properties,
670
685
  type: ActionType.PointerMove,
671
- x: Math.round(x),
672
- y: Math.round(y),
673
- origin: options.origin,
674
- width: 0.5 * 2, // 2 times default touch radius.
675
- height: 0.5 * 2, // 2 times default touch radius.
676
- pressure: 0.5,
677
- altitudeAngle: Math.PI / 2,
686
+ x: newX,
687
+ y: newY,
678
688
  },
679
689
  ],
680
690
  },
681
691
  ]);
682
692
  }
683
693
 
684
- override async touchEnd(): Promise<void> {
694
+ async end(): Promise<void> {
685
695
  await this.#page.mainFrame().browsingContext.performActions([
686
696
  {
687
697
  type: SourceActionsType.Pointer,
688
- id: InputId.Finger,
698
+ id: this.#bidiId,
689
699
  parameters: {
690
700
  pointerType: Bidi.Input.PointerType.Touch,
691
701
  },
@@ -697,5 +707,36 @@ export class BidiTouchscreen extends Touchscreen {
697
707
  ],
698
708
  },
699
709
  ]);
710
+ this.#touchScreen.removeHandle(this);
711
+ }
712
+ }
713
+ /**
714
+ * @internal
715
+ */
716
+ export class BidiTouchscreen extends Touchscreen {
717
+ #page: BidiPage;
718
+ declare touches: BidiTouchHandle[];
719
+
720
+ constructor(page: BidiPage) {
721
+ super();
722
+ this.#page = page;
723
+ }
724
+
725
+ override async touchStart(
726
+ x: number,
727
+ y: number,
728
+ options: BidiTouchMoveOptions = {},
729
+ ): Promise<TouchHandle> {
730
+ const id = this.idGenerator();
731
+ const properties: Bidi.Input.PointerCommonProperties = {
732
+ width: 0.5 * 2, // 2 times default touch radius.
733
+ height: 0.5 * 2, // 2 times default touch radius.
734
+ pressure: 0.5,
735
+ altitudeAngle: Math.PI / 2,
736
+ };
737
+ const touch = new BidiTouchHandle(this.#page, this, id, x, y, properties);
738
+ await touch.start(options);
739
+ this.touches.push(touch);
740
+ return touch;
700
741
  }
701
742
  }
@@ -101,25 +101,30 @@ export class CdpElementHandle<
101
101
  @bindIsolatedHandle
102
102
  override async uploadFile(
103
103
  this: CdpElementHandle<HTMLInputElement>,
104
- ...filePaths: string[]
104
+ ...files: string[]
105
105
  ): Promise<void> {
106
106
  const isMultiple = await this.evaluate(element => {
107
107
  return element.multiple;
108
108
  });
109
109
  assert(
110
- filePaths.length <= 1 || isMultiple,
110
+ files.length <= 1 || isMultiple,
111
111
  'Multiple file uploads only work with <input type=file multiple>',
112
112
  );
113
113
 
114
114
  // Locate all files and confirm that they exist.
115
115
  const path = environment.value.path;
116
- const files = filePaths.map(filePath => {
117
- if (path.win32.isAbsolute(filePath) || path.posix.isAbsolute(filePath)) {
118
- return filePath;
119
- } else {
120
- return path.resolve(filePath);
121
- }
122
- });
116
+ if (path) {
117
+ files = files.map(filePath => {
118
+ if (
119
+ path.win32.isAbsolute(filePath) ||
120
+ path.posix.isAbsolute(filePath)
121
+ ) {
122
+ return filePath;
123
+ } else {
124
+ return path.resolve(filePath);
125
+ }
126
+ });
127
+ }
123
128
 
124
129
  /**
125
130
  * The zero-length array is a special case, it seems that
@@ -13,6 +13,7 @@ import {
13
13
  Mouse,
14
14
  MouseButton,
15
15
  Touchscreen,
16
+ type TouchHandle,
16
17
  type KeyDownOptions,
17
18
  type KeyPressOptions,
18
19
  type KeyboardTypeOptions,
@@ -21,6 +22,7 @@ import {
21
22
  type MouseOptions,
22
23
  type MouseWheelOptions,
23
24
  } from '../api/Input.js';
25
+ import {TouchError} from '../common/Errors.js';
24
26
  import {
25
27
  _keyDefinitions,
26
28
  type KeyDefinition,
@@ -552,57 +554,100 @@ export class CdpMouse extends Mouse {
552
554
  /**
553
555
  * @internal
554
556
  */
555
- export class CdpTouchscreen extends Touchscreen {
557
+ class CdpTouchHandle implements TouchHandle {
558
+ #started = false;
559
+ #touchScreen: CdpTouchscreen;
560
+ #touchPoint: Protocol.Input.TouchPoint;
556
561
  #client: CDPSession;
557
562
  #keyboard: CdpKeyboard;
558
563
 
559
- constructor(client: CDPSession, keyboard: CdpKeyboard) {
560
- super();
564
+ constructor(
565
+ client: CDPSession,
566
+ touchScreen: CdpTouchscreen,
567
+ keyboard: CdpKeyboard,
568
+ touchPoint: Protocol.Input.TouchPoint,
569
+ ) {
561
570
  this.#client = client;
571
+ this.#touchScreen = touchScreen;
562
572
  this.#keyboard = keyboard;
573
+ this.#touchPoint = touchPoint;
563
574
  }
564
575
 
565
576
  updateClient(client: CDPSession): void {
566
577
  this.#client = client;
567
578
  }
568
579
 
569
- override async touchStart(x: number, y: number): Promise<void> {
580
+ async start(): Promise<void> {
581
+ if (this.#started) {
582
+ throw new TouchError('Touch has already started');
583
+ }
570
584
  await this.#client.send('Input.dispatchTouchEvent', {
571
585
  type: 'touchStart',
572
- touchPoints: [
573
- {
574
- x: Math.round(x),
575
- y: Math.round(y),
576
- radiusX: 0.5,
577
- radiusY: 0.5,
578
- force: 0.5,
579
- },
580
- ],
586
+ touchPoints: [this.#touchPoint],
581
587
  modifiers: this.#keyboard._modifiers,
582
588
  });
589
+ this.#started = true;
583
590
  }
584
591
 
585
- override async touchMove(x: number, y: number): Promise<void> {
586
- await this.#client.send('Input.dispatchTouchEvent', {
592
+ move(x: number, y: number): Promise<void> {
593
+ this.#touchPoint.x = Math.round(x);
594
+ this.#touchPoint.y = Math.round(y);
595
+ return this.#client.send('Input.dispatchTouchEvent', {
587
596
  type: 'touchMove',
588
- touchPoints: [
589
- {
590
- x: Math.round(x),
591
- y: Math.round(y),
592
- radiusX: 0.5,
593
- radiusY: 0.5,
594
- force: 0.5,
595
- },
596
- ],
597
+ touchPoints: [this.#touchPoint],
597
598
  modifiers: this.#keyboard._modifiers,
598
599
  });
599
600
  }
600
601
 
601
- override async touchEnd(): Promise<void> {
602
+ async end(): Promise<void> {
602
603
  await this.#client.send('Input.dispatchTouchEvent', {
603
604
  type: 'touchEnd',
604
- touchPoints: [],
605
+ touchPoints: [this.#touchPoint],
605
606
  modifiers: this.#keyboard._modifiers,
606
607
  });
608
+ this.#touchScreen.removeHandle(this);
609
+ }
610
+ }
611
+
612
+ /**
613
+ * @internal
614
+ */
615
+ export class CdpTouchscreen extends Touchscreen {
616
+ #client: CDPSession;
617
+ #keyboard: CdpKeyboard;
618
+ declare touches: CdpTouchHandle[];
619
+
620
+ constructor(client: CDPSession, keyboard: CdpKeyboard) {
621
+ super();
622
+ this.#client = client;
623
+ this.#keyboard = keyboard;
624
+ }
625
+
626
+ updateClient(client: CDPSession): void {
627
+ this.#client = client;
628
+ this.touches.forEach(t => {
629
+ t.updateClient(client);
630
+ });
631
+ }
632
+
633
+ override async touchStart(x: number, y: number): Promise<TouchHandle> {
634
+ const id = this.idGenerator();
635
+ const touchPoint: Protocol.Input.TouchPoint = {
636
+ x: Math.round(x),
637
+ y: Math.round(y),
638
+ radiusX: 0.5,
639
+ radiusY: 0.5,
640
+ force: 0.5,
641
+ id,
642
+ };
643
+ const touch = new CdpTouchHandle(
644
+ this.#client,
645
+ this,
646
+ this.#keyboard,
647
+ touchPoint,
648
+ );
649
+ await touch.start();
650
+ this.touches.push(touch);
651
+ return touch;
607
652
  }
608
653
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  import {Deferred} from '../util/Deferred.js';
8
8
  import {rewriteError} from '../util/ErrorLike.js';
9
+ import {createIncrementalIdGenerator} from '../util/incremental-id-generator.js';
9
10
 
10
11
  import {ProtocolError, TargetCloseError} from './Errors.js';
11
12
  import {debugError} from './util.js';
@@ -159,18 +160,3 @@ export class Callback {
159
160
  return this.#label;
160
161
  }
161
162
  }
162
-
163
- /**
164
- * @internal
165
- */
166
- export function createIncrementalIdGenerator(): GetIdFn {
167
- let id = 0;
168
- return (): number => {
169
- return ++id;
170
- };
171
- }
172
-
173
- /**
174
- * @internal
175
- */
176
- export type GetIdFn = () => number;
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import type {Frame} from '../api/Frame.js';
7
8
  import type {JSHandle} from '../api/JSHandle.js';
8
9
 
9
10
  /**
@@ -60,6 +61,7 @@ export class ConsoleMessage {
60
61
  #text: string;
61
62
  #args: JSHandle[];
62
63
  #stackTraceLocations: ConsoleMessageLocation[];
64
+ #frame?: Frame;
63
65
 
64
66
  /**
65
67
  * @internal
@@ -69,11 +71,13 @@ export class ConsoleMessage {
69
71
  text: string,
70
72
  args: JSHandle[],
71
73
  stackTraceLocations: ConsoleMessageLocation[],
74
+ frame?: Frame,
72
75
  ) {
73
76
  this.#type = type;
74
77
  this.#text = text;
75
78
  this.#args = args;
76
79
  this.#stackTraceLocations = stackTraceLocations;
80
+ this.#frame = frame;
77
81
  }
78
82
 
79
83
  /**
@@ -101,7 +105,10 @@ export class ConsoleMessage {
101
105
  * The location of the console message.
102
106
  */
103
107
  location(): ConsoleMessageLocation {
104
- return this.#stackTraceLocations[0] ?? {};
108
+ return (
109
+ this.#stackTraceLocations[0] ??
110
+ (this.#frame ? {url: this.#frame.url()} : {})
111
+ );
105
112
  }
106
113
 
107
114
  /**
@@ -38,6 +38,13 @@ export class PuppeteerError extends Error {
38
38
  */
39
39
  export class TimeoutError extends PuppeteerError {}
40
40
 
41
+ /**
42
+ * TouchError is thrown when an attempt is made to move or end a touch that does
43
+ * not exist.
44
+ * @public
45
+ */
46
+ export class TouchError extends PuppeteerError {}
47
+
41
48
  /**
42
49
  * ProtocolError is emitted whenever there is an error from the protocol.
43
50
  *
@@ -56,15 +56,9 @@ export class WaitTask<T = unknown> {
56
56
  this.#polling = options.polling;
57
57
  this.#root = options.root;
58
58
  this.#signal = options.signal;
59
- this.#signal?.addEventListener(
60
- 'abort',
61
- () => {
62
- void this.terminate(this.#signal?.reason);
63
- },
64
- {
65
- once: true,
66
- },
67
- );
59
+ this.#signal?.addEventListener('abort', this.#onAbortSignal, {
60
+ once: true,
61
+ });
68
62
 
69
63
  switch (typeof fn) {
70
64
  case 'string':
@@ -176,6 +170,8 @@ export class WaitTask<T = unknown> {
176
170
  async terminate(error?: Error): Promise<void> {
177
171
  this.#world.taskManager.delete(this);
178
172
 
173
+ this.#signal?.removeEventListener('abort', this.#onAbortSignal);
174
+
179
175
  clearTimeout(this.#timeout);
180
176
 
181
177
  if (error && !this.#result.finished()) {
@@ -242,6 +238,10 @@ export class WaitTask<T = unknown> {
242
238
  cause: error,
243
239
  });
244
240
  }
241
+
242
+ #onAbortSignal = () => {
243
+ void this.terminate(this.#signal?.reason);
244
+ };
245
245
  }
246
246
 
247
247
  /**
@@ -16,7 +16,7 @@ export const isNode = !!(typeof process !== 'undefined' && process.version);
16
16
 
17
17
  export interface EnvironmentDependencies {
18
18
  fs: typeof FS;
19
- path: typeof Path;
19
+ path?: typeof Path;
20
20
  ScreenRecorder: typeof ScreenRecorder;
21
21
  }
22
22
 
@@ -31,9 +31,6 @@ export const environment: {
31
31
  get fs(): typeof FS {
32
32
  throw new Error('fs is not available in this environment');
33
33
  },
34
- get path(): typeof Path {
35
- throw new Error('path is not available in this environment');
36
- },
37
34
  get ScreenRecorder(): typeof ScreenRecorder {
38
35
  throw new Error('ScreenRecorder is not available in this environment');
39
36
  },