chrome-devtools-frontend 1.0.1616061 → 1.0.1621064

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 (318) hide show
  1. package/AUTHORS +1 -0
  2. package/docs/checklist/README.md +8 -7
  3. package/eslint.config.mjs +7 -0
  4. package/front_end/core/common/Object.ts +11 -2
  5. package/front_end/core/dom_extension/DOMExtension.ts +11 -8
  6. package/front_end/core/host/AidaClient.ts +8 -0
  7. package/front_end/core/host/AidaGcaTranslation.ts +1 -0
  8. package/front_end/core/host/UserMetrics.ts +0 -1
  9. package/front_end/core/platform/api/HostRuntime.ts +2 -2
  10. package/front_end/core/platform/browser/HostRuntime.ts +4 -2
  11. package/front_end/core/platform/node/HostRuntime.ts +2 -2
  12. package/front_end/core/root/ExperimentNames.ts +0 -1
  13. package/front_end/core/sdk/NetworkManager.ts +30 -4
  14. package/front_end/core/sdk/NetworkRequest.ts +2 -10
  15. package/front_end/core/sdk/Resource.ts +2 -1
  16. package/front_end/core/sdk/ServerSentEventsProtocol.ts +1 -1
  17. package/front_end/core/sdk/TraceObject.ts +7 -2
  18. package/front_end/entrypoint_template.html +1 -2
  19. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +119 -15
  20. package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -2
  21. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +43 -33
  22. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +2 -1
  23. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +9 -6
  24. package/front_end/entrypoints/main/MainImpl.ts +0 -2
  25. package/front_end/generated/InspectorBackendCommands.ts +8 -7
  26. package/front_end/generated/SupportedCSSProperties.js +119 -100
  27. package/front_end/generated/protocol-mapping.d.ts +1 -9
  28. package/front_end/generated/protocol-proxy-api.d.ts +1 -9
  29. package/front_end/generated/protocol.ts +24 -1
  30. package/front_end/legacy/legacy-defs.d.ts +1 -1
  31. package/front_end/models/ai_assistance/AiConversation.ts +1 -0
  32. package/front_end/models/ai_assistance/AiHistoryStorage.ts +39 -0
  33. package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -0
  34. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +28 -16
  35. package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +512 -0
  36. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +112 -145
  37. package/front_end/models/ai_assistance/agents/README.md +0 -5
  38. package/front_end/models/ai_assistance/agents/StylingAgent.ts +9 -16
  39. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  40. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +19 -1
  41. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +48 -13
  42. package/front_end/models/bindings/SymbolizedError.ts +95 -8
  43. package/front_end/models/emulation/DeviceModeModel.ts +42 -13
  44. package/front_end/models/emulation/EmulatedDevices.ts +1 -1
  45. package/front_end/models/issues_manager/IssuesManager.ts +13 -6
  46. package/front_end/models/issues_manager/IssuesManagerEvents.ts +1 -0
  47. package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
  48. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +1 -0
  49. package/front_end/models/stack_trace/DetailedErrorStackParser.ts +49 -10
  50. package/front_end/models/stack_trace/ErrorStackParser.ts +18 -0
  51. package/front_end/models/stack_trace/StackTraceModel.ts +5 -1
  52. package/front_end/models/text_utils/ContentData.ts +71 -10
  53. package/front_end/models/trace/types/File.ts +8 -1
  54. package/front_end/models/web_mcp/WebMCPModel.ts +22 -0
  55. package/front_end/models/workspace/UISourceCode.ts +4 -4
  56. package/front_end/panels/accessibility/ARIAAttributesView.ts +4 -4
  57. package/front_end/panels/accessibility/AccessibilitySubPane.ts +3 -2
  58. package/front_end/panels/accessibility/SourceOrderView.ts +4 -4
  59. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  60. package/front_end/panels/ai_assistance/components/ChatInput.ts +66 -0
  61. package/front_end/panels/ai_assistance/components/ChatMessage.ts +144 -21
  62. package/front_end/panels/ai_assistance/components/ChatView.ts +43 -8
  63. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +1 -0
  64. package/front_end/panels/ai_assistance/components/WalkthroughUtils.ts +74 -0
  65. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +34 -5
  66. package/front_end/panels/ai_assistance/components/chatMessage.css +11 -0
  67. package/front_end/panels/ai_assistance/components/walkthroughView.css +7 -0
  68. package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
  69. package/front_end/panels/application/CookieItemsView.ts +8 -9
  70. package/front_end/panels/application/DOMStorageItemsView.ts +3 -3
  71. package/front_end/panels/application/DeviceBoundSessionsModel.ts +7 -0
  72. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +21 -0
  73. package/front_end/panels/application/DeviceBoundSessionsView.ts +2 -2
  74. package/front_end/panels/application/ExtensionStorageItemsView.ts +1 -1
  75. package/front_end/panels/application/KeyValueStorageItemsView.ts +32 -14
  76. package/front_end/panels/application/ResourcesPanel.ts +5 -5
  77. package/front_end/panels/application/StorageItemsToolbar.ts +0 -19
  78. package/front_end/panels/application/WebMCPView.ts +285 -86
  79. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +4 -4
  80. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +4 -4
  81. package/front_end/panels/application/webMCPView.css +261 -182
  82. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +9 -5
  83. package/front_end/panels/changes/ChangesSidebar.ts +2 -2
  84. package/front_end/panels/changes/ChangesView.ts +9 -14
  85. package/front_end/panels/console/ConsolePanel.ts +10 -3
  86. package/front_end/panels/console/ConsoleSidebar.ts +5 -5
  87. package/front_end/panels/console/ConsoleView.ts +11 -4
  88. package/front_end/panels/console/ConsoleViewMessage.ts +1 -19
  89. package/front_end/panels/coverage/CoverageView.ts +4 -5
  90. package/front_end/panels/elements/ElementsPanel.ts +9 -12
  91. package/front_end/panels/elements/ElementsSidebarPane.ts +4 -5
  92. package/front_end/panels/elements/ElementsTreeElement.ts +61 -0
  93. package/front_end/panels/elements/ElementsTreeOutline.ts +46 -0
  94. package/front_end/panels/elements/LayersWidget.ts +2 -2
  95. package/front_end/panels/elements/MetricsSidebarPane.ts +5 -4
  96. package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
  97. package/front_end/panels/elements/StylePropertyTreeElement.ts +11 -6
  98. package/front_end/panels/elements/StylesSidebarPane.ts +4 -1
  99. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +19 -20
  100. package/front_end/panels/elements/components/ElementsBreadcrumbsUtils.ts +29 -29
  101. package/front_end/panels/elements/components/QueryContainer.ts +5 -6
  102. package/front_end/panels/elements/components/components.ts +0 -2
  103. package/front_end/panels/emulation/MediaQueryInspector.ts +4 -7
  104. package/front_end/panels/layer_viewer/LayerDetailsView.ts +4 -7
  105. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -2
  106. package/front_end/panels/lighthouse/LighthouseStartView.ts +2 -2
  107. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +47 -66
  108. package/front_end/panels/network/NetworkConfigView.ts +11 -11
  109. package/front_end/panels/network/RequestConditionsDrawer.ts +6 -4
  110. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  111. package/front_end/panels/network/RequestDeviceBoundSessionsView.ts +2 -2
  112. package/front_end/panels/network/RequestHeadersView.ts +2 -2
  113. package/front_end/panels/network/components/DirectSocketConnectionView.ts +4 -5
  114. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -9
  115. package/front_end/panels/profiler/HeapProfileView.ts +29 -4
  116. package/front_end/panels/profiler/ProfilesPanel.ts +1 -1
  117. package/front_end/panels/protocol_monitor/JSONEditor.css +8 -1
  118. package/front_end/panels/protocol_monitor/JSONEditor.ts +7 -2
  119. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +6 -4
  120. package/front_end/panels/recorder/components/ControlButton.ts +4 -4
  121. package/front_end/panels/recorder/components/StepView.ts +6 -6
  122. package/front_end/panels/search/SearchView.ts +4 -7
  123. package/front_end/panels/sources/DebuggerPausedMessage.ts +18 -22
  124. package/front_end/panels/sources/SourcesView.ts +1 -1
  125. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -2
  126. package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -4
  127. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +24 -20
  128. package/front_end/panels/timeline/StatusDialog.ts +5 -8
  129. package/front_end/panels/timeline/ThirdPartyTreeView.ts +10 -0
  130. package/front_end/panels/timeline/TimelineLoader.ts +3 -4
  131. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +2 -2
  132. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +2 -0
  133. package/front_end/panels/timeline/components/TimelineSummary.ts +9 -1
  134. package/front_end/panels/timeline/components/timelineSummary.css +4 -0
  135. package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +2 -2
  136. package/front_end/panels/timeline/thirdPartyTreeView.css +8 -1
  137. package/front_end/panels/web_audio/WebAudioView.ts +5 -4
  138. package/front_end/panels/whats_new/ReleaseNoteText.ts +9 -9
  139. package/front_end/panels/whats_new/resources/WNDT.md +9 -6
  140. package/front_end/third_party/chromium/README.chromium +1 -1
  141. package/front_end/third_party/puppeteer/README.chromium +2 -2
  142. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +41 -2
  143. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Extension.d.ts +13 -1
  146. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Extension.d.ts.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Extension.js +21 -1
  148. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Extension.js.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  150. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js +1 -0
  151. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +2 -2
  153. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +5 -5
  155. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  157. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js +2 -2
  158. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
  159. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  160. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js +1 -0
  161. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js.map +1 -1
  162. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Extension.d.ts +1 -1
  163. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Extension.d.ts.map +1 -1
  164. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Extension.js +2 -2
  165. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Extension.js.map +1 -1
  166. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  168. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +52 -1
  169. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  170. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  171. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.js.map +1 -1
  172. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +25 -0
  173. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  174. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  175. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +2 -2
  177. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  179. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +0 -1
  180. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
  182. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
  183. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  184. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  185. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  186. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/urlpattern-polyfill/urlpattern-polyfill.d.ts +1 -0
  187. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/urlpattern-polyfill/urlpattern-polyfill.js +853 -0
  188. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +91 -11
  189. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +1046 -33
  190. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts +41 -2
  191. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  192. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  193. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Extension.d.ts +13 -1
  194. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Extension.d.ts.map +1 -1
  195. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Extension.js +21 -1
  196. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Extension.js.map +1 -1
  197. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  198. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js +1 -0
  199. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js.map +1 -1
  200. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +2 -2
  201. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  202. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +5 -5
  203. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  204. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js +2 -2
  206. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
  207. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  208. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js +1 -0
  209. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js.map +1 -1
  210. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Extension.d.ts +1 -1
  211. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Extension.d.ts.map +1 -1
  212. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Extension.js +2 -2
  213. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Extension.js.map +1 -1
  214. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
  215. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +52 -1
  217. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  219. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.js.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +25 -0
  221. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  222. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/injected.d.ts +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  224. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +2 -2
  225. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +0 -1
  228. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  229. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
  230. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
  231. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Mutex.d.ts +2 -2
  232. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  233. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  234. package/front_end/third_party/puppeteer/package/lib/esm/third_party/urlpattern-polyfill/urlpattern-polyfill.d.ts +1 -0
  235. package/front_end/third_party/puppeteer/package/lib/esm/third_party/urlpattern-polyfill/urlpattern-polyfill.js +805 -0
  236. package/front_end/third_party/puppeteer/package/lib/types.d.ts +91 -11
  237. package/front_end/third_party/puppeteer/package/package.json +3 -2
  238. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +53 -11
  239. package/front_end/third_party/puppeteer/package/src/api/Extension.ts +29 -1
  240. package/front_end/third_party/puppeteer/package/src/bidi/ElementHandle.ts +1 -0
  241. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +6 -0
  242. package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +2 -0
  243. package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +1 -0
  244. package/front_end/third_party/puppeteer/package/src/cdp/Extension.ts +9 -2
  245. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +59 -0
  246. package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +6 -1
  247. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +26 -0
  248. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +2 -0
  249. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +0 -1
  250. package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
  251. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  252. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +2 -1
  253. package/front_end/third_party/web-vitals/README.chromium +2 -2
  254. package/front_end/third_party/web-vitals/package/README.md +21 -10
  255. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +2 -4
  256. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +1 -2
  257. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +4 -0
  258. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +44 -39
  259. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +25 -19
  260. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +1 -2
  261. package/front_end/third_party/web-vitals/package/dist/modules/lib/doubleRAF.js +1 -1
  262. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -2
  263. package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.js +16 -18
  264. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +2 -1
  265. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +1 -1
  266. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +1 -1
  267. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.d.ts +1 -1
  268. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +1 -3
  269. package/front_end/third_party/web-vitals/package/dist/modules/lib/whenActivated.js +1 -1
  270. package/front_end/third_party/web-vitals/package/dist/modules/lib/whenIdleOrHidden.js +11 -7
  271. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +1 -1
  272. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +4 -0
  273. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +1 -2
  274. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  275. package/front_end/third_party/web-vitals/package/package.json +24 -27
  276. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +2 -7
  277. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +1 -2
  278. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +49 -43
  279. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +27 -24
  280. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +1 -2
  281. package/front_end/third_party/web-vitals/package/src/lib/doubleRAF.ts +1 -1
  282. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -2
  283. package/front_end/third_party/web-vitals/package/src/lib/getLoadState.ts +21 -20
  284. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +2 -3
  285. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +1 -1
  286. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +2 -4
  287. package/front_end/third_party/web-vitals/package/src/lib/whenActivated.ts +1 -1
  288. package/front_end/third_party/web-vitals/package/src/lib/whenIdleOrHidden.ts +13 -7
  289. package/front_end/third_party/web-vitals/package/src/onCLS.ts +1 -1
  290. package/front_end/third_party/web-vitals/package/src/types/inp.ts +4 -0
  291. package/front_end/third_party/web-vitals/package/src/types.ts +1 -2
  292. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +13 -74
  293. package/front_end/third_party/web-vitals/rebuild.sh +3 -3
  294. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +0 -1
  295. package/front_end/ui/components/icon_button/iconButton.css +1 -0
  296. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +6 -6
  297. package/front_end/ui/components/lists/list.css +4 -0
  298. package/front_end/ui/legacy/Dialog.ts +21 -2
  299. package/front_end/ui/legacy/SoftContextMenu.ts +3 -3
  300. package/front_end/ui/legacy/SplitWidget.ts +9 -9
  301. package/front_end/ui/legacy/TabbedPane.ts +12 -12
  302. package/front_end/ui/legacy/View.ts +24 -22
  303. package/front_end/ui/legacy/ViewManager.ts +12 -12
  304. package/front_end/ui/legacy/ViewRegistration.ts +2 -2
  305. package/front_end/ui/legacy/Widget.ts +165 -119
  306. package/front_end/ui/legacy/components/source_frame/ImageView.ts +10 -5
  307. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +9 -6
  308. package/front_end/ui/legacy/components/utils/Linkifier.ts +37 -11
  309. package/front_end/ui/legacy/components/utils/jsUtils.css +1 -0
  310. package/front_end/ui/legacy/inspectorCommon.css +0 -6
  311. package/front_end/ui/lit/render.ts +11 -9
  312. package/front_end/ui/visual_logging/KnownContextValues.ts +36 -0
  313. package/package.json +1 -1
  314. package/front_end/Images/src/dots-circle.svg +0 -10
  315. package/front_end/panels/elements/components/Helper.ts +0 -35
  316. package/front_end/third_party/web-vitals/package/dist/modules/types/polyfills.d.ts +0 -4
  317. package/front_end/third_party/web-vitals/package/dist/modules/types/polyfills.js +0 -16
  318. package/front_end/third_party/web-vitals/package/src/types/polyfills.ts +0 -24
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "web-vitals",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Easily measure performance metrics in JavaScript",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/"
7
+ },
5
8
  "type": "module",
6
9
  "typings": "dist/modules/index.d.ts",
7
10
  "main": "dist/web-vitals.umd.cjs",
@@ -88,7 +91,7 @@
88
91
  "release:beta": "npm version prerelease --preid=beta -m 'Release v%s' && npm publish --tag next",
89
92
  "release:rc": "npm version prerelease --preid=rc -m 'Release v%s' && npm publish --tag next",
90
93
  "test": "npm-run-all build test:unit -p -r test:e2e test:server",
91
- "test:e2e": "wdio wdio.conf.cjs",
94
+ "test:e2e": "wdio",
92
95
  "test:server": "node test/server.js",
93
96
  "test:unit": "node --test test/unit/*test.js",
94
97
  "start": "run-s build:ts test:server watch",
@@ -96,7 +99,7 @@
96
99
  "watch:ts": "tsc -b -w",
97
100
  "watch:js": "rollup -c -w",
98
101
  "version": "run-s build",
99
- "prepare": "husky install"
102
+ "prepare": "husky"
100
103
  },
101
104
  "keywords": [
102
105
  "crux",
@@ -134,35 +137,29 @@
134
137
  "singleQuote": true
135
138
  },
136
139
  "devDependencies": {
137
- "@babel/core": "^7.23.6",
138
- "@babel/preset-env": "^7.23.6",
139
- "@rollup/plugin-babel": "^6.0.4",
140
- "@rollup/plugin-replace": "^5.0.5",
140
+ "@babel/core": "^7.28.5",
141
+ "@babel/preset-env": "^7.28.5",
142
+ "@rollup/plugin-babel": "^6.1.0",
141
143
  "@rollup/plugin-terser": "^0.4.4",
142
- "@typescript-eslint/eslint-plugin": "^6.16.0",
143
- "@typescript-eslint/parser": "^6.16.0",
144
- "@wdio/cli": "^8.32.3",
145
- "@wdio/local-runner": "^8.32.3",
146
- "@wdio/mocha-framework": "^8.32.3",
147
- "@wdio/spec-reporter": "^8.32.2",
148
- "body-parser": "^1.20.2",
149
- "chromedriver": "^122.0.4",
150
- "eslint": "^8.56.0",
151
- "express": "^4.18.2",
152
- "fs-extra": "^11.2.0",
153
- "husky": "^8.0.3",
154
- "lint-staged": "^15.2.0",
144
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
145
+ "@typescript-eslint/parser": "^8.52.0",
146
+ "@wdio/cli": "^9.23.0",
147
+ "@wdio/local-runner": "^9.25.0",
148
+ "@wdio/mocha-framework": "^9.25.0",
149
+ "@wdio/spec-reporter": "^9.25.0",
150
+ "eslint": "^9.39.2",
151
+ "fs-extra": "^11.3.3",
152
+ "husky": "^9.1.7",
153
+ "lint-staged": "^16.2.7",
155
154
  "npm-run-all": "^4.1.5",
156
155
  "nunjucks": "^3.2.4",
157
- "prettier": "^3.1.1",
158
- "rollup": "^4.9.1",
159
- "selenium-standalone": "^9.3.1",
160
- "typescript": "^5.3.3",
161
- "wdio-chromedriver-service": "^8.1.1",
162
- "yargs": "^17.7.2"
156
+ "prettier": "^3.7.4",
157
+ "rollup": "^4.55.1",
158
+ "typescript": "^5.9.3",
159
+ "yargs": "^18.0.0"
163
160
  },
164
161
  "lint-staged": {
165
- "**/*.{js,ts}": "eslint --fix --ignore-path .gitignore",
162
+ "**/*.{js,ts}": "eslint --fix",
166
163
  "**/*.{cjs,css,html,js,json,html,md,ts,yml,yaml}": "prettier --write --ignore-path .gitignore"
167
164
  }
168
165
  }
@@ -104,15 +104,10 @@ export const onCLS = (
104
104
  }
105
105
 
106
106
  // Use `Object.assign()` to ensure the original metric object is returned.
107
- const metricWithAttribution: CLSMetricWithAttribution = Object.assign(
108
- metric,
109
- {attribution},
110
- );
111
- return metricWithAttribution;
107
+ return Object.assign(metric, {attribution});
112
108
  };
113
109
 
114
110
  unattributedOnCLS((metric: CLSMetric) => {
115
- const metricWithAttribution = attributeCLS(metric);
116
- onReport(metricWithAttribution);
111
+ onReport(attributeCLS(metric));
117
112
  }, opts);
118
113
  };
@@ -70,7 +70,6 @@ export const onFCP = (
70
70
  opts: AttributionReportOpts = {},
71
71
  ) => {
72
72
  unattributedOnFCP((metric: FCPMetric) => {
73
- const metricWithAttribution = attributeFCP(metric);
74
- onReport(metricWithAttribution);
73
+ onReport(attributeFCP(metric));
75
74
  }, opts);
76
75
  };
@@ -43,8 +43,8 @@ interface pendingEntriesGroup {
43
43
  // frame data is needed to determine various bits of INP attribution once all
44
44
  // the frame-related data has come in.
45
45
  // In most cases this out-of-order data is only off by a frame or two, so
46
- // keeping the most recent 50 should be more than sufficient.
47
- const MAX_PREVIOUS_FRAMES = 50;
46
+ // keeping the most recent 10 should be more than sufficient.
47
+ const MAX_PENDING_FRAMES = 10;
48
48
 
49
49
  /**
50
50
  * Calculates the [INP](https://web.dev/articles/inp) value for the current
@@ -61,6 +61,10 @@ const MAX_PREVIOUS_FRAMES = 50;
61
61
  * less than 40 (well below the recommended
62
62
  * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
63
63
  *
64
+ * A custom `includeProcessedEventEntries` configuration option can optionally
65
+ * be passed to control whether the `processedEventEntries` array in the
66
+ * attribution object is populated. The default value is `true`.
67
+ *
64
68
  * If the `reportAllChanges` configuration option is set to `true`, the
65
69
  * `callback` function will be called as soon as the value is initially
66
70
  * determined as well as any time the value changes throughout the page
@@ -146,6 +150,8 @@ export const onINP = (
146
150
  const renderTime = entry.startTime + entry.duration;
147
151
  let group;
148
152
 
153
+ // Update `latestProcessingEnd` to correspond to the `processingEnd`
154
+ // value of the most recently dispatched `event` entry.
149
155
  latestProcessingEnd = Math.max(latestProcessingEnd, entry.processingEnd);
150
156
 
151
157
  // Iterate over all previous render times in reverse order to find a match.
@@ -166,11 +172,11 @@ export const onINP = (
166
172
  entry.processingEnd,
167
173
  group.processingEnd,
168
174
  );
169
- // Entries are not needed in DevTools since we're only displaying the
170
- // summary information, and also emitting events as they come in. Stop
171
- // holding a reference to avoid memory issues.
172
- // See https://crbug.com/484342204
173
- // group.entries.push(entry);
175
+ // processedEventEntries can be quite large, so only include them if
176
+ // the user explicitly requests them (default is to include).
177
+ if (opts.includeProcessedEventEntries !== false) {
178
+ group.entries.push(entry);
179
+ }
174
180
 
175
181
  break;
176
182
  }
@@ -183,12 +189,9 @@ export const onINP = (
183
189
  processingStart: entry.processingStart,
184
190
  processingEnd: entry.processingEnd,
185
191
  renderTime,
186
- // Entries are not needed in DevTools since we're only displaying the
187
- // summary information, and also emiting events as they come in. Stop
188
- // holding a reference to avoid memory issues.
189
- // See https://crbug.com/484342204
190
- // entries: [entry],
191
- entries: [],
192
+ // processedEventEntries can be quite large, so only include them if
193
+ // the user explicitly requests them (default is to include).
194
+ entries: opts.includeProcessedEventEntries !== false ? [entry] : [],
192
195
  };
193
196
 
194
197
  pendingEntriesGroups.push(group);
@@ -211,39 +214,47 @@ export const onINP = (
211
214
  };
212
215
 
213
216
  const cleanupEntries = () => {
214
- // Keep all render times that are part of a pending INP candidate or
215
- // that occurred within the 50 most recently-dispatched groups of events.
216
- const longestInteractionGroups =
217
+ // Create a set of entries groups that are part of the longest
218
+ // interactions (for faster lookup below).
219
+ const longestInteractionGroups = new Set(
217
220
  interactionManager._longestInteractionList.map((i) => {
218
221
  return entryToEntriesGroupMap.get(i.entries[0]);
219
- });
220
- const minIndex = pendingEntriesGroups.length - MAX_PREVIOUS_FRAMES;
221
- pendingEntriesGroups = pendingEntriesGroups.filter((group, index) => {
222
- if (index >= minIndex) return true;
223
- return longestInteractionGroups.includes(group);
222
+ }),
223
+ );
224
+
225
+ // Clean up the `pendingEntriesGroups` list so it doesn't grow endlessly.
226
+ // Keep any groups that:
227
+ // 1) Correspond to one of the current longest interactions, OR
228
+ // 2) Are part of one of the most recent set of frames (which is
229
+ // determined by checking if the index in the group is within
230
+ // `MAX_PENDING_FRAMES` of the group's length).
231
+ const minIndexToKeep = pendingEntriesGroups.length - MAX_PENDING_FRAMES;
232
+ pendingEntriesGroups = pendingEntriesGroups.filter((group, i) => {
233
+ // Check index first because it's faster.
234
+ return i >= minIndexToKeep || longestInteractionGroups.has(group);
224
235
  });
225
236
 
226
- // Keep all pending LoAF entries that either:
227
- // 1) intersect with entries in the newly cleaned up `pendingEntriesGroups`
228
- // 2) occur after the most recently-processed event entry (for up to MAX_PREVIOUS_FRAMES)
229
- const loafsToKeep: Set<PerformanceLongAnimationFrameTiming> = new Set();
237
+ // Create a set of LoAF entries that intersect with entries in the newly
238
+ // cleaned up `pendingEntriesGroups` (for faster lookup below).
239
+ const intersectingLoAFs: Set<PerformanceLongAnimationFrameTiming> =
240
+ new Set();
241
+
230
242
  for (const group of pendingEntriesGroups) {
231
243
  const loafs = getIntersectingLoAFs(group.startTime, group.processingEnd);
232
244
  for (const loaf of loafs) {
233
- loafsToKeep.add(loaf);
245
+ intersectingLoAFs.add(loaf);
234
246
  }
235
247
  }
236
- const prevFrameIndexCutoff = pendingLoAFs.length - 1 - MAX_PREVIOUS_FRAMES;
237
- // Filter `pendingLoAFs` to preserve LoAF order.
238
- pendingLoAFs = pendingLoAFs.filter((loaf, index) => {
239
- if (
240
- loaf.startTime > latestProcessingEnd &&
241
- index > prevFrameIndexCutoff
242
- ) {
243
- return true;
244
- }
245
248
 
246
- return loafsToKeep.has(loaf);
249
+ // Clean up the `pendingLoAFs` list so it doesn't grow endlessly.
250
+ // Keep all LoAFs that either:
251
+ // 1) Intersect with one of the above pending entries groups, OR
252
+ // 2) Occurred more recently than the most recently process event entry.
253
+ pendingLoAFs = pendingLoAFs.filter((loaf) => {
254
+ return (
255
+ // Compare times first because it's faster.
256
+ loaf.startTime > latestProcessingEnd || intersectingLoAFs.has(loaf)
257
+ );
247
258
  });
248
259
 
249
260
  cleanupPending = false;
@@ -454,18 +465,13 @@ export const onINP = (
454
465
  attributeLoAFDetails(attribution);
455
466
 
456
467
  // Use `Object.assign()` to ensure the original metric object is returned.
457
- const metricWithAttribution: INPMetricWithAttribution = Object.assign(
458
- metric,
459
- {attribution},
460
- );
461
- return metricWithAttribution;
468
+ return Object.assign(metric, {attribution});
462
469
  };
463
470
 
464
471
  // Start observing LoAF entries for attribution.
465
472
  observe('long-animation-frame', handleLoAFEntries);
466
473
 
467
474
  unattributedOnINP((metric: INPMetric) => {
468
- const metricWithAttribution = attributeINP(metric);
469
- onReport(metricWithAttribution);
475
+ onReport(attributeINP(metric));
470
476
  }, opts);
471
477
  };
@@ -57,6 +57,10 @@ export const onLCP = (
57
57
  if (node) {
58
58
  const customTarget = opts.generateTarget?.(node) ?? getSelector(node);
59
59
  lcpTargetMap.set(entry, customTarget);
60
+ } else if (entry.id) {
61
+ // Use the LargestContentfulPaint.id property when the element has been
62
+ // removed from the DOM (and so node is null), but still has an ID.
63
+ lcpTargetMap.set(entry, `#${entry.id}`);
60
64
  }
61
65
  };
62
66
 
@@ -70,16 +74,29 @@ export const onLCP = (
70
74
  };
71
75
 
72
76
  if (metric.entries.length) {
77
+ // The `metric.entries.length` check ensures there will be an entry.
78
+ const lcpEntry = metric.entries.at(-1)!;
79
+ const lcpResourceEntry =
80
+ lcpEntry.url &&
81
+ performance
82
+ .getEntriesByType('resource')
83
+ .find((e) => e.name === lcpEntry.url);
84
+
85
+ attribution.target = lcpTargetMap.get(lcpEntry);
86
+ attribution.lcpEntry = lcpEntry;
87
+ // Only attribute the URL and resource entry if they exist.
88
+ if (lcpEntry.url) {
89
+ attribution.url = lcpEntry.url;
90
+ }
91
+ if (lcpResourceEntry) {
92
+ attribution.lcpResourceEntry = lcpResourceEntry;
93
+ }
94
+
95
+ // Get subparts from navigation entry. Do this last as occasionally
96
+ // Safari seems to fail to find a navigation entry.
73
97
  const navigationEntry = getNavigationEntry();
74
98
  if (navigationEntry) {
75
99
  const activationStart = navigationEntry.activationStart || 0;
76
- // The `metric.entries.length` check ensures there will be an entry.
77
- const lcpEntry = metric.entries.at(-1)!;
78
- const lcpResourceEntry =
79
- lcpEntry.url &&
80
- performance
81
- .getEntriesByType('resource')
82
- .filter((e) => e.name === lcpEntry.url)[0];
83
100
 
84
101
  const ttfb = Math.max(
85
102
  0,
@@ -106,35 +123,21 @@ export const onLCP = (
106
123
  );
107
124
 
108
125
  attribution = {
109
- target: lcpTargetMap.get(lcpEntry),
126
+ ...attribution,
110
127
  timeToFirstByte: ttfb,
111
128
  resourceLoadDelay: lcpRequestStart - ttfb,
112
129
  resourceLoadDuration: lcpResponseEnd - lcpRequestStart,
113
130
  elementRenderDelay: metric.value - lcpResponseEnd,
114
131
  navigationEntry,
115
- lcpEntry,
116
132
  };
117
-
118
- // Only attribute the URL and resource entry if they exist.
119
- if (lcpEntry.url) {
120
- attribution.url = lcpEntry.url;
121
- }
122
- if (lcpResourceEntry) {
123
- attribution.lcpResourceEntry = lcpResourceEntry;
124
- }
125
133
  }
126
134
  }
127
135
 
128
136
  // Use `Object.assign()` to ensure the original metric object is returned.
129
- const metricWithAttribution: LCPMetricWithAttribution = Object.assign(
130
- metric,
131
- {attribution},
132
- );
133
- return metricWithAttribution;
137
+ return Object.assign(metric, {attribution});
134
138
  };
135
139
 
136
140
  unattributedOnLCP((metric: LCPMetric) => {
137
- const metricWithAttribution = attributeLCP(metric);
138
- onReport(metricWithAttribution);
141
+ onReport(attributeLCP(metric));
139
142
  }, opts);
140
143
  };
@@ -101,7 +101,6 @@ export const onTTFB = (
101
101
  opts: AttributionReportOpts = {},
102
102
  ) => {
103
103
  unattributedOnTTFB((metric: TTFBMetric) => {
104
- const metricWithAttribution = attributeTTFB(metric);
105
- onReport(metricWithAttribution);
104
+ onReport(attributeTTFB(metric));
106
105
  }, opts);
107
106
  };
@@ -15,5 +15,5 @@
15
15
  */
16
16
 
17
17
  export const doubleRAF = (cb: () => unknown) => {
18
- requestAnimationFrame(() => requestAnimationFrame(() => cb()));
18
+ requestAnimationFrame(() => requestAnimationFrame(cb));
19
19
  };
@@ -17,6 +17,5 @@
17
17
  import {getNavigationEntry} from './getNavigationEntry.js';
18
18
 
19
19
  export const getActivationStart = (): number => {
20
- const navEntry = getNavigationEntry();
21
- return navEntry?.activationStart ?? 0;
20
+ return getNavigationEntry()?.activationStart ?? 0;
22
21
  };
@@ -22,26 +22,27 @@ export const getLoadState = (timestamp: number): LoadState => {
22
22
  // If the `readyState` is 'loading' there's no need to look at timestamps
23
23
  // since the timestamp has to be the current time or earlier.
24
24
  return 'loading';
25
- } else {
26
- const navigationEntry = getNavigationEntry();
27
- if (navigationEntry) {
28
- if (timestamp < navigationEntry.domInteractive) {
29
- return 'loading';
30
- } else if (
31
- navigationEntry.domContentLoadedEventStart === 0 ||
32
- timestamp < navigationEntry.domContentLoadedEventStart
33
- ) {
34
- // If the `domContentLoadedEventStart` timestamp has not yet been
35
- // set, or if the given timestamp is less than that value.
36
- return 'dom-interactive';
37
- } else if (
38
- navigationEntry.domComplete === 0 ||
39
- timestamp < navigationEntry.domComplete
40
- ) {
41
- // If the `domComplete` timestamp has not yet been
42
- // set, or if the given timestamp is less than that value.
43
- return 'dom-content-loaded';
44
- }
25
+ }
26
+ const navigationEntry = getNavigationEntry();
27
+ if (navigationEntry) {
28
+ if (timestamp < navigationEntry.domInteractive) {
29
+ return 'loading';
30
+ }
31
+ if (
32
+ navigationEntry.domContentLoadedEventStart === 0 ||
33
+ timestamp < navigationEntry.domContentLoadedEventStart
34
+ ) {
35
+ // If the `domContentLoadedEventStart` timestamp has not yet been
36
+ // set, or if the given timestamp is less than that value.
37
+ return 'dom-interactive';
38
+ }
39
+ if (
40
+ navigationEntry.domComplete === 0 ||
41
+ timestamp < navigationEntry.domComplete
42
+ ) {
43
+ // If the `domComplete` timestamp has not yet been
44
+ // set, or if the given timestamp is less than that value.
45
+ return 'dom-content-loaded';
45
46
  }
46
47
  }
47
48
  // If any of the above fail, default to loaded. This could really only
@@ -68,9 +68,8 @@ export const getVisibilityWatcher = () => {
68
68
  const firstVisibilityStateHiddenTime = !document.prerendering
69
69
  ? globalThis.performance
70
70
  .getEntriesByType('visibility-state')
71
- .filter(
72
- (e) => e.name === 'hidden' && e.startTime > activationStart,
73
- )[0]?.startTime
71
+ .find((e) => e.name === 'hidden' && e.startTime >= activationStart)
72
+ ?.startTime
74
73
  : undefined;
75
74
  /* eslint-enable indent */
76
75
 
@@ -44,7 +44,7 @@ export const observe = <K extends keyof PerformanceEntryMap>(
44
44
  // Delay by a microtask to workaround a bug in Safari where the
45
45
  // callback is invoked immediately, rather than in a separate task.
46
46
  // See: https://github.com/GoogleChrome/web-vitals/issues/277
47
- Promise.resolve().then(() => {
47
+ queueMicrotask(() => {
48
48
  callback(list.getEntries() as PerformanceEntryMap[K]);
49
49
  });
50
50
  });
@@ -18,7 +18,7 @@ import {observe} from '../observe.js';
18
18
 
19
19
  declare global {
20
20
  interface Performance {
21
- interactionCount: number;
21
+ readonly interactionCount: number;
22
22
  }
23
23
  }
24
24
 
@@ -52,7 +52,7 @@ let po: PerformanceObserver | undefined;
52
52
  * or the polyfill estimate in this module.
53
53
  */
54
54
  export const getInteractionCount = () => {
55
- return po ? interactionCountEstimate : performance.interactionCount ?? 0;
55
+ return po ? interactionCountEstimate : (performance.interactionCount ?? 0);
56
56
  };
57
57
 
58
58
  /**
@@ -62,8 +62,6 @@ export const initInteractionCountPolyfill = () => {
62
62
  if ('interactionCount' in performance || po) return;
63
63
 
64
64
  po = observe('event', updateEstimate, {
65
- type: 'event',
66
- buffered: true,
67
65
  durationThreshold: 0,
68
66
  } as PerformanceObserverInit);
69
67
  };
@@ -16,7 +16,7 @@
16
16
 
17
17
  export const whenActivated = (callback: () => void) => {
18
18
  if (document.prerendering) {
19
- addEventListener('prerenderingchange', () => callback(), true);
19
+ addEventListener('prerenderingchange', callback, true);
20
20
  } else {
21
21
  callback();
22
22
  }
@@ -22,19 +22,25 @@ import {runOnce} from './runOnce.js';
22
22
  */
23
23
  export const whenIdleOrHidden = (cb: () => void) => {
24
24
  const rIC = globalThis.requestIdleCallback || setTimeout;
25
+ const cIC = globalThis.cancelIdleCallback || clearTimeout;
25
26
 
26
27
  // If the document is hidden, run the callback immediately, otherwise
27
28
  // race an idle callback with the next `visibilitychange` event.
28
29
  if (document.visibilityState === 'hidden') {
29
30
  cb();
30
31
  } else {
31
- cb = runOnce(cb);
32
- addEventListener('visibilitychange', cb, {once: true, capture: true});
33
- rIC(() => {
34
- cb();
35
- // Remove the above event listener since no longer required.
36
- // See: https://github.com/GoogleChrome/web-vitals/issues/622
37
- removeEventListener('visibilitychange', cb, {capture: true});
32
+ const wrappedCb = runOnce(cb);
33
+
34
+ let idleHandle = -1;
35
+ const onHidden = () => {
36
+ cIC(idleHandle);
37
+ wrappedCb();
38
+ };
39
+
40
+ addEventListener('visibilitychange', onHidden, {once: true, capture: true});
41
+ idleHandle = rIC(() => {
42
+ removeEventListener('visibilitychange', onHidden, {capture: true});
43
+ wrappedCb();
38
44
  });
39
45
  }
40
46
  };
@@ -104,7 +104,7 @@ export const onCLS = (
104
104
  opts!.reportAllChanges,
105
105
  );
106
106
 
107
- doubleRAF(() => report());
107
+ doubleRAF(report);
108
108
  });
109
109
 
110
110
  // Queue a task to report (if nothing else triggers a report first).
@@ -27,6 +27,7 @@ export interface INPReportOpts extends ReportOpts {
27
27
 
28
28
  export interface INPAttributionReportOpts extends AttributionReportOpts {
29
29
  durationThreshold?: number;
30
+ includeProcessedEventEntries?: boolean;
30
31
  onEachInteraction?: (interaction: INPMetricWithAttribution) => void;
31
32
  }
32
33
 
@@ -95,6 +96,9 @@ export interface INPAttribution {
95
96
  /**
96
97
  * An array of Event Timing entries that were processed within the same
97
98
  * animation frame as the INP candidate interaction.
99
+ * This array can be quite large so it will be empty if the
100
+ * `includeProcessedEventEntries` configuration option is set to `false` to
101
+ * conserve memory if these entries are not required.
98
102
  */
99
103
  processedEventEntries: PerformanceEventTiming[];
100
104
  /**
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  export * from './types/base.js';
18
- export * from './types/polyfills.js';
19
18
 
20
19
  export * from './types/cls.js';
21
20
  export * from './types/fcp.js';
@@ -61,7 +60,7 @@ declare global {
61
60
  // https://wicg.github.io/event-timing/#sec-performance-event-timing
62
61
  interface PerformanceEventTiming extends PerformanceEntry {
63
62
  duration: DOMHighResTimeStamp;
64
- interactionId: number;
63
+ readonly interactionId: number;
65
64
  }
66
65
 
67
66
  // https://wicg.github.io/layout-instability/#sec-layout-shift-attribution