chrome-devtools-frontend 1.0.1538523 → 1.0.1539972

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 (347) hide show
  1. package/eslint.config.mjs +1 -1
  2. package/front_end/core/common/Debouncer.ts +2 -2
  3. package/front_end/core/common/Gzip.ts +1 -1
  4. package/front_end/core/common/Throttler.ts +3 -3
  5. package/front_end/core/host/GdpClient.ts +4 -0
  6. package/front_end/core/protocol_client/CDPConnection.ts +12 -10
  7. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +181 -0
  8. package/front_end/core/protocol_client/InspectorBackend.ts +55 -249
  9. package/front_end/core/protocol_client/protocol_client.ts +2 -2
  10. package/front_end/core/sdk/ChildTargetManager.ts +5 -41
  11. package/front_end/core/sdk/Connections.ts +9 -58
  12. package/front_end/core/sdk/DOMModel.ts +1 -0
  13. package/front_end/core/sdk/DebuggerModel.ts +3 -16
  14. package/front_end/core/sdk/RehydratingConnection.ts +1 -1
  15. package/front_end/core/sdk/RemoteObject.ts +4 -0
  16. package/front_end/core/sdk/Target.ts +3 -6
  17. package/front_end/core/sdk/TargetManager.ts +1 -2
  18. package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +13 -26
  19. package/front_end/entrypoints/node_app/{NodeConnectionsPanel.ts → app/NodeConnectionsPanel.ts} +8 -8
  20. package/front_end/entrypoints/node_app/{NodeMain.ts → app/NodeMain.ts} +12 -11
  21. package/front_end/entrypoints/node_app/app/app.ts +6 -0
  22. package/front_end/entrypoints/node_app/node_app.ts +4 -2
  23. package/front_end/generated/Deprecation.ts +8 -0
  24. package/front_end/generated/{InspectorBackendCommands.js → InspectorBackendCommands.ts} +18 -36
  25. package/front_end/generated/SupportedCSSProperties.js +50 -9
  26. package/front_end/generated/protocol.ts +2 -2
  27. package/front_end/models/ai_assistance/EvaluateAction.ts +88 -5
  28. package/front_end/models/ai_assistance/injected.ts +15 -2
  29. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  30. package/front_end/models/trace/Styles.ts +1 -1
  31. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +18 -3
  32. package/front_end/models/trace/types/TraceEvents.ts +19 -0
  33. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +49 -26
  34. package/front_end/panels/ai_assistance/PatchWidget.ts +22 -12
  35. package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -1
  36. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  37. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -135
  38. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +170 -0
  39. package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
  40. package/front_end/panels/ai_assistance/components/chatView.css +0 -31
  41. package/front_end/panels/ai_assistance/components/disabledWidget.css +45 -0
  42. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  43. package/front_end/panels/application/components/FrameDetailsView.ts +1 -1
  44. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +4 -4
  45. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +2 -2
  46. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  47. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  48. package/front_end/panels/elements/ElementsTreeElement.ts +123 -95
  49. package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
  50. package/front_end/panels/elements/NodeStackTraceWidget.ts +8 -2
  51. package/front_end/panels/elements/PropertiesWidget.ts +3 -2
  52. package/front_end/panels/event_listeners/EventListenersView.ts +9 -5
  53. package/front_end/panels/explain/components/ConsoleInsight.ts +2 -3
  54. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +57 -33
  55. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +2 -2
  56. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +1 -1
  57. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +12 -5
  58. package/front_end/panels/network/RequestInitiatorView.ts +1 -1
  59. package/front_end/panels/network/RequestPayloadView.ts +2 -1
  60. package/front_end/panels/network/RequestTimingView.ts +4 -2
  61. package/front_end/panels/network/components/EditableSpan.ts +1 -1
  62. package/front_end/panels/network/components/RequestHeadersView.ts +24 -17
  63. package/front_end/panels/protocol_monitor/JSONEditor.ts +2 -2
  64. package/front_end/panels/recorder/RecorderController.ts +6 -7
  65. package/front_end/panels/recorder/components/StepView.ts +1 -1
  66. package/front_end/panels/recorder/models/RecordingPlayer.ts +7 -6
  67. package/front_end/panels/settings/components/SyncSection.ts +1 -1
  68. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +4 -4
  69. package/front_end/panels/sources/BreakpointsView.ts +3 -3
  70. package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -3
  71. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
  72. package/front_end/panels/timeline/TimelineFlameChartView.ts +10 -10
  73. package/front_end/panels/timeline/TimelinePanel.ts +3 -3
  74. package/front_end/panels/timeline/TimelineUIUtils.ts +21 -24
  75. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +9 -5
  76. package/front_end/panels/timeline/components/LiveMetricsView.ts +20 -9
  77. package/front_end/panels/timeline/components/MetricCard.ts +4 -2
  78. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +3 -2
  79. package/front_end/panels/utils/utils.ts +4 -2
  80. package/front_end/services/puppeteer/PuppeteerConnection.ts +57 -53
  81. package/front_end/third_party/chromium/README.chromium +1 -1
  82. package/front_end/third_party/puppeteer/README.chromium +2 -2
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +3 -1
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js +4 -2
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts +3 -1
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +5 -0
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.js +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.js +4 -3
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.js.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.d.ts +2 -1
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js +3 -2
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +29 -9
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +11 -0
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +9 -2
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +1 -0
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +21 -0
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js +4 -2
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -2
  128. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.js +2 -1
  131. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.d.ts +6 -1
  133. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.d.ts.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.js +11 -2
  135. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.js.map +1 -1
  136. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.js +5 -1
  138. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +1 -0
  140. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +6 -0
  142. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +29 -27
  146. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +2 -0
  148. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +4 -3
  150. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +7 -0
  152. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  153. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +4 -0
  155. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +10 -4
  157. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  158. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  159. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  160. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +14 -3
  162. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +97 -43
  163. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +3 -1
  164. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  165. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js +4 -2
  166. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts +3 -1
  168. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
  169. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
  170. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +5 -0
  171. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  172. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  173. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  174. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.js +1 -1
  175. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
  177. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.js +4 -3
  178. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.js.map +1 -1
  179. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +1 -1
  180. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +1 -1
  182. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
  183. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.d.ts +2 -1
  184. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
  185. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js +3 -2
  186. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
  188. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  189. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +29 -9
  190. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
  192. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  193. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +11 -0
  194. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  195. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  196. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +9 -2
  197. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  198. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +1 -0
  199. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  200. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +21 -0
  201. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  202. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  203. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js +4 -2
  204. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +1 -1
  206. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  207. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -2
  208. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
  209. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  210. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.js +2 -1
  211. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.js.map +1 -1
  212. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.d.ts +6 -1
  213. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.d.ts.map +1 -1
  214. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.js +11 -2
  215. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.js.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  217. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.js +5 -1
  218. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  219. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +1 -0
  220. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  221. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +6 -0
  222. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
  224. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  225. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +30 -28
  226. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +2 -0
  228. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  229. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +4 -3
  230. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
  231. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +7 -0
  232. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  233. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +4 -0
  234. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  235. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +10 -4
  236. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  237. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  238. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  239. package/front_end/third_party/puppeteer/package/lib/types.d.ts +14 -3
  240. package/front_end/third_party/puppeteer/package/package.json +3 -3
  241. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +4 -2
  242. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +3 -1
  243. package/front_end/third_party/puppeteer/package/src/api/Page.ts +6 -0
  244. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +1 -0
  245. package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +8 -1
  246. package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +1 -1
  247. package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +4 -1
  248. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +38 -10
  249. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +13 -0
  250. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -2
  251. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +32 -0
  252. package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +4 -0
  253. package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +2 -2
  254. package/front_end/third_party/puppeteer/package/src/cdp/CdpSession.ts +2 -1
  255. package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +15 -1
  256. package/front_end/third_party/puppeteer/package/src/cdp/ExtensionTransport.ts +5 -1
  257. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +8 -0
  258. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +36 -43
  259. package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +7 -5
  260. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +8 -0
  261. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +22 -1
  262. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  263. package/front_end/ui/components/dialogs/ButtonDialog.ts +15 -5
  264. package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
  265. package/front_end/ui/components/helpers/helpers.ts +0 -2
  266. package/front_end/ui/components/menus/Menu.ts +5 -3
  267. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  268. package/front_end/ui/components/survey_link/SurveyLink.docs.ts +22 -0
  269. package/front_end/ui/components/switch/Switch.docs.ts +38 -0
  270. package/front_end/ui/components/tooltips/Tooltip.ts +69 -45
  271. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -2
  272. package/front_end/ui/legacy/SelectMenu.docs.ts +14 -0
  273. package/front_end/ui/legacy/Slider.docs.ts +49 -0
  274. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -1
  275. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +453 -347
  276. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +77 -5
  277. package/front_end/ui/legacy/components/utils/Linkifier.ts +62 -3
  278. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  279. package/package.json +1 -1
  280. package/front_end/core/protocol_client/NodeURL.ts +0 -42
  281. package/front_end/third_party/puppeteer/package/src/templates/version.ts.tmpl +0 -4
  282. package/front_end/ui/components/docs/color_swatch/basic.html +0 -32
  283. package/front_end/ui/components/docs/color_swatch/basic.ts +0 -38
  284. package/front_end/ui/components/docs/color_swatch/change-color.html +0 -24
  285. package/front_end/ui/components/docs/color_swatch/change-color.ts +0 -28
  286. package/front_end/ui/components/docs/combo_box/basic.html +0 -20
  287. package/front_end/ui/components/docs/combo_box/basic.ts +0 -49
  288. package/front_end/ui/components/docs/computed_style_property/basic.html +0 -25
  289. package/front_end/ui/components/docs/computed_style_property/basic.ts +0 -19
  290. package/front_end/ui/components/docs/computed_style_property/traceable.html +0 -25
  291. package/front_end/ui/components/docs/computed_style_property/traceable.ts +0 -16
  292. package/front_end/ui/components/docs/computed_style_trace/basic.html +0 -25
  293. package/front_end/ui/components/docs/computed_style_trace/basic.ts +0 -24
  294. package/front_end/ui/components/docs/console_insight/basic.html +0 -28
  295. package/front_end/ui/components/docs/console_insight/basic.ts +0 -103
  296. package/front_end/ui/components/docs/console_insight/error.html +0 -28
  297. package/front_end/ui/components/docs/console_insight/error.ts +0 -33
  298. package/front_end/ui/components/docs/console_insight/loading.html +0 -28
  299. package/front_end/ui/components/docs/console_insight/loading.ts +0 -47
  300. package/front_end/ui/components/docs/elements_breadcrumbs/basic.html +0 -43
  301. package/front_end/ui/components/docs/elements_breadcrumbs/basic.ts +0 -54
  302. package/front_end/ui/components/docs/elements_breadcrumbs/helpers.ts +0 -29
  303. package/front_end/ui/components/docs/elements_breadcrumbs/scroll-to-active-element.html +0 -38
  304. package/front_end/ui/components/docs/elements_breadcrumbs/scroll-to-active-element.ts +0 -90
  305. package/front_end/ui/components/docs/elements_breadcrumbs/scroll.html +0 -29
  306. package/front_end/ui/components/docs/elements_breadcrumbs/scroll.ts +0 -62
  307. package/front_end/ui/components/docs/icon_button/basic.html +0 -34
  308. package/front_end/ui/components/docs/icon_button/basic.ts +0 -67
  309. package/front_end/ui/components/docs/issue_counter/basic.html +0 -35
  310. package/front_end/ui/components/docs/issue_counter/basic.ts +0 -34
  311. package/front_end/ui/components/docs/issue_link_icon/basic.html +0 -31
  312. package/front_end/ui/components/docs/issue_link_icon/basic.ts +0 -26
  313. package/front_end/ui/components/docs/legacy_color_invert/basic.html +0 -77
  314. package/front_end/ui/components/docs/legacy_color_invert/basic.ts +0 -98
  315. package/front_end/ui/components/docs/linear_memory_inspector/basic.html +0 -26
  316. package/front_end/ui/components/docs/linear_memory_inspector/basic.ts +0 -44
  317. package/front_end/ui/components/docs/menu/basic.html +0 -28
  318. package/front_end/ui/components/docs/menu/basic.ts +0 -66
  319. package/front_end/ui/components/docs/recorder_control_button/basic.html +0 -20
  320. package/front_end/ui/components/docs/recorder_control_button/basic.ts +0 -15
  321. package/front_end/ui/components/docs/recorder_recording_list_view/basic.html +0 -20
  322. package/front_end/ui/components/docs/recorder_recording_list_view/basic.ts +0 -26
  323. package/front_end/ui/components/docs/recorder_select_button/basic.html +0 -20
  324. package/front_end/ui/components/docs/recorder_select_button/basic.ts +0 -81
  325. package/front_end/ui/components/docs/recorder_split_view/basic.html +0 -17
  326. package/front_end/ui/components/docs/recorder_split_view/basic.ts +0 -22
  327. package/front_end/ui/components/docs/request_link_icon/basic.html +0 -31
  328. package/front_end/ui/components/docs/request_link_icon/basic.ts +0 -21
  329. package/front_end/ui/components/docs/slider/basic.ts +0 -62
  330. package/front_end/ui/components/docs/style_property_editor/flex.html +0 -21
  331. package/front_end/ui/components/docs/style_property_editor/flex.ts +0 -52
  332. package/front_end/ui/components/docs/style_property_editor/grid.html +0 -22
  333. package/front_end/ui/components/docs/style_property_editor/grid.ts +0 -50
  334. package/front_end/ui/components/docs/style_property_editor/masonry.html +0 -21
  335. package/front_end/ui/components/docs/style_property_editor/masonry.ts +0 -50
  336. package/front_end/ui/components/docs/survey_link/basic.html +0 -20
  337. package/front_end/ui/components/docs/survey_link/basic.ts +0 -28
  338. package/front_end/ui/components/docs/switch/basic.ts +0 -51
  339. package/front_end/ui/components/docs/tree_outline/basic.html +0 -33
  340. package/front_end/ui/components/docs/tree_outline/basic.ts +0 -38
  341. package/front_end/ui/components/docs/tree_outline/custom-renderers.html +0 -32
  342. package/front_end/ui/components/docs/tree_outline/custom-renderers.ts +0 -61
  343. package/front_end/ui/components/docs/tree_outline/lazy-children.html +0 -32
  344. package/front_end/ui/components/docs/tree_outline/lazy-children.ts +0 -91
  345. package/front_end/ui/components/docs/tree_outline/sample-data.ts +0 -67
  346. package/front_end/ui/components/helpers/directives.ts +0 -38
  347. /package/front_end/entrypoints/node_app/{nodeConnectionsPanel.css → app/nodeConnectionsPanel.css} +0 -0
@@ -34,6 +34,7 @@ import * as Host from '../../../../core/host/host.js';
34
34
  import * as i18n from '../../../../core/i18n/i18n.js';
35
35
  import * as Platform from '../../../../core/platform/platform.js';
36
36
  import * as SDK from '../../../../core/sdk/sdk.js';
37
+ import type * as Protocol from '../../../../generated/protocol.js';
37
38
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
38
39
  import * as uiI18n from '../../../../ui/i18n/i18n.js';
39
40
  import * as IconButton from '../../../components/icon_button/icon_button.js';
@@ -136,15 +137,214 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
136
137
  const EXPANDABLE_MAX_LENGTH = 50;
137
138
  const EXPANDABLE_MAX_DEPTH = 100;
138
139
 
139
- const parentMap = new WeakMap<SDK.RemoteObject.RemoteObjectProperty, SDK.RemoteObject.RemoteObject|null>();
140
140
  const objectPropertiesSectionMap = new WeakMap<Element, ObjectPropertiesSection>();
141
141
 
142
+ interface NodeChildren {
143
+ properties?: ObjectTreeNode[];
144
+ internalProperties?: ObjectTreeNode[];
145
+ arrayRanges?: ArrayGroupTreeNode[];
146
+ }
147
+
148
+ abstract class ObjectTreeNodeBase {
149
+ #children?: NodeChildren;
150
+ protected extraProperties: ObjectTreeNode[] = [];
151
+ constructor(
152
+ readonly parent?: ObjectTreeNodeBase,
153
+ readonly propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED) {
154
+ }
155
+
156
+ abstract get object(): SDK.RemoteObject.RemoteObject|undefined;
157
+
158
+ removeChildren(): void {
159
+ this.#children = undefined;
160
+ }
161
+
162
+ removeChild(child: ObjectTreeNodeBase): void {
163
+ remove(this.#children?.arrayRanges, child);
164
+ remove(this.#children?.internalProperties, child);
165
+ remove(this.#children?.properties, child);
166
+
167
+ function remove<T>(array: T[]|undefined, element: T): void {
168
+ if (!array) {
169
+ return;
170
+ }
171
+ const index = array.indexOf(element);
172
+ if (index >= 0) {
173
+ array.splice(index, 1);
174
+ }
175
+ }
176
+ }
177
+
178
+ protected selfOrParentIfInternal(): ObjectTreeNodeBase {
179
+ return this;
180
+ }
181
+
182
+ async children(): Promise<NodeChildren> {
183
+ if (!this.#children) {
184
+ this.#children = await this.populateChildren();
185
+ }
186
+ return this.#children;
187
+ }
188
+
189
+ protected async populateChildren(): Promise<NodeChildren> {
190
+ const object = this.object;
191
+ if (!object) {
192
+ return {};
193
+ }
194
+
195
+ const effectiveParent = this.selfOrParentIfInternal();
196
+
197
+ if (this.arrayLength > ARRAY_LOAD_THRESHOLD) {
198
+ const ranges = await arrayRangeGroups(object, 0, this.arrayLength - 1);
199
+ const arrayRanges = ranges?.ranges.map(
200
+ ([fromIndex, toIndex, count]) => new ArrayGroupTreeNode(object, {fromIndex, toIndex, count}));
201
+ if (!arrayRanges) {
202
+ return {};
203
+ }
204
+
205
+ const {properties: objectProperties, internalProperties: objectInternalProperties} =
206
+ await SDK.RemoteObject.RemoteObject.loadFromObjectPerProto(
207
+ this.object, true /* generatePreview */, true /* nonIndexedPropertiesOnly */);
208
+
209
+ const properties = objectProperties?.map(p => new ObjectTreeNode(p, undefined, effectiveParent, undefined));
210
+
211
+ const internalProperties =
212
+ objectInternalProperties?.map(p => new ObjectTreeNode(p, undefined, effectiveParent, undefined));
213
+ return {arrayRanges, properties, internalProperties};
214
+ }
215
+
216
+ let objectProperties: SDK.RemoteObject.RemoteObjectProperty[]|null = null;
217
+ let objectInternalProperties: SDK.RemoteObject.RemoteObjectProperty[]|null = null;
218
+ switch (this.propertiesMode) {
219
+ case ObjectPropertiesMode.ALL:
220
+ ({properties: objectProperties} =
221
+ await object.getAllProperties(false /* accessorPropertiesOnly */, true /* generatePreview */));
222
+ break;
223
+ case ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED:
224
+ ({properties: objectProperties, internalProperties: objectInternalProperties} =
225
+ await SDK.RemoteObject.RemoteObject.loadFromObjectPerProto(object, true /* generatePreview */));
226
+ break;
227
+ }
228
+
229
+ const properties = objectProperties?.map(p => new ObjectTreeNode(p, undefined, effectiveParent, undefined));
230
+ properties?.push(...this.extraProperties);
231
+
232
+ const internalProperties =
233
+ objectInternalProperties?.map(p => new ObjectTreeNode(p, undefined, effectiveParent, undefined));
234
+ return {properties, internalProperties};
235
+ }
236
+
237
+ get hasChildren(): boolean {
238
+ return this.object?.hasChildren ?? false;
239
+ }
240
+
241
+ get arrayLength(): number {
242
+ return this.object?.arrayLength() ?? 0;
243
+ }
244
+
245
+ // This is used in web tests
246
+ async setPropertyValue(name: string|Protocol.Runtime.CallArgument, value: string): Promise<string|undefined> {
247
+ return await this.object?.setPropertyValue(name, value);
248
+ }
249
+
250
+ addExtraProperties(...properties: SDK.RemoteObject.RemoteObjectProperty[]): void {
251
+ this.extraProperties.push(...properties.map(p => new ObjectTreeNode(p, undefined, this, undefined)));
252
+ }
253
+ }
254
+
255
+ export class ObjectTree extends ObjectTreeNodeBase {
256
+ readonly #object: SDK.RemoteObject.RemoteObject;
257
+
258
+ constructor(
259
+ object: SDK.RemoteObject.RemoteObject,
260
+ propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED) {
261
+ super(undefined, propertiesMode);
262
+ this.#object = object;
263
+ }
264
+ override get object(): SDK.RemoteObject.RemoteObject {
265
+ return this.#object;
266
+ }
267
+ }
268
+
269
+ class ArrayGroupTreeNode extends ObjectTreeNodeBase {
270
+ readonly #object: SDK.RemoteObject.RemoteObject;
271
+ readonly #range: {fromIndex: number, toIndex: number, count: number};
272
+ constructor(
273
+ object: SDK.RemoteObject.RemoteObject, range: {fromIndex: number, toIndex: number, count: number},
274
+ parent?: ObjectTreeNodeBase,
275
+ propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED) {
276
+ super(parent, propertiesMode);
277
+ this.#object = object;
278
+ this.#range = range;
279
+ }
280
+
281
+ protected override async populateChildren(): Promise<NodeChildren> {
282
+ if (this.#range.count > ArrayGroupingTreeElement.bucketThreshold) {
283
+ const ranges = await arrayRangeGroups(this.object, this.#range.fromIndex, this.#range.toIndex);
284
+ const arrayRanges = ranges?.ranges.map(
285
+ ([fromIndex, toIndex, count]) => new ArrayGroupTreeNode(this.object, {fromIndex, toIndex, count}));
286
+ return {arrayRanges};
287
+ }
288
+
289
+ const result = await this.#object.callFunction(buildArrayFragment, [
290
+ {value: this.#range.fromIndex},
291
+ {value: this.#range.toIndex},
292
+ {value: ArrayGroupingTreeElement.sparseIterationThreshold},
293
+ ]);
294
+ if (!result.object || result.wasThrown) {
295
+ return {};
296
+ }
297
+ const arrayFragment = result.object;
298
+ const allProperties =
299
+ await arrayFragment.getAllProperties(false /* accessorPropertiesOnly */, true /* generatePreview */);
300
+ arrayFragment.release();
301
+ const properties = allProperties.properties?.map(p => new ObjectTreeNode(p, this.propertiesMode, this, undefined));
302
+ properties?.push(...this.extraProperties);
303
+ properties?.sort(ObjectPropertiesSection.compareProperties);
304
+ return {properties};
305
+ }
306
+
307
+ get singular(): boolean {
308
+ return this.#range.fromIndex === this.#range.toIndex;
309
+ }
310
+
311
+ get range(): {fromIndex: number, toIndex: number, count: number} {
312
+ return this.#range;
313
+ }
314
+
315
+ override get object(): SDK.RemoteObject.RemoteObject {
316
+ return this.#object;
317
+ }
318
+ }
319
+
320
+ export class ObjectTreeNode extends ObjectTreeNodeBase {
321
+ constructor(
322
+ readonly property: SDK.RemoteObject.RemoteObjectProperty,
323
+ propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
324
+ parent?: ObjectTreeNodeBase,
325
+ readonly nonSyntheticParent?: SDK.RemoteObject.RemoteObject,
326
+ ) {
327
+ super(parent, propertiesMode);
328
+ }
329
+ override get object(): SDK.RemoteObject.RemoteObject|undefined {
330
+ return this.property.value;
331
+ }
332
+
333
+ get name(): string {
334
+ return this.property.name;
335
+ }
336
+
337
+ override selfOrParentIfInternal(): ObjectTreeNodeBase {
338
+ return this.name === '[[Prototype]]' ? (this.parent ?? this) : this;
339
+ }
340
+ }
341
+
142
342
  export const getObjectPropertiesSectionFrom = (element: Element): ObjectPropertiesSection|undefined => {
143
343
  return objectPropertiesSectionMap.get(element);
144
344
  };
145
345
 
146
346
  export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow {
147
- private readonly object: SDK.RemoteObject.RemoteObject;
347
+ private readonly root: ObjectTree;
148
348
  editable: boolean;
149
349
  readonly #objectTreeElement: RootElement;
150
350
  titleElement: Element;
@@ -153,14 +353,14 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
153
353
  object: SDK.RemoteObject.RemoteObject, title?: string|Element|null, linkifier?: Components.Linkifier.Linkifier,
154
354
  showOverflow?: boolean) {
155
355
  super();
156
- this.object = object;
356
+ this.root = new ObjectTree(object);
157
357
  this.editable = true;
158
358
  if (!showOverflow) {
159
359
  this.setHideOverflow(true);
160
360
  }
161
361
  this.setFocusable(true);
162
362
  this.setShowSelectionOnKeyboardFocus(true);
163
- this.#objectTreeElement = new RootElement(object, linkifier);
363
+ this.#objectTreeElement = new RootElement(this.root, linkifier);
164
364
  this.appendChild(this.#objectTreeElement);
165
365
  if (typeof title === 'string' || !title) {
166
366
  this.titleElement = this.element.createChild('span');
@@ -210,8 +410,16 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
210
410
  return objectPropertiesSection;
211
411
  }
212
412
 
413
+ // The RemoteObjectProperty overload is kept for web test compatibility for now.
213
414
  static compareProperties(
214
- propertyA: SDK.RemoteObject.RemoteObjectProperty, propertyB: SDK.RemoteObject.RemoteObjectProperty): number {
415
+ propertyA: ObjectTreeNode|SDK.RemoteObject.RemoteObjectProperty,
416
+ propertyB: ObjectTreeNode|SDK.RemoteObject.RemoteObjectProperty): number {
417
+ if (propertyA instanceof ObjectTreeNode) {
418
+ propertyA = propertyA.property;
419
+ }
420
+ if (propertyB instanceof ObjectTreeNode) {
421
+ propertyB = propertyB.property;
422
+ }
215
423
  if (!propertyA.synthetic && propertyB.synthetic) {
216
424
  return 1;
217
425
  }
@@ -558,8 +766,8 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
558
766
 
559
767
  private contextMenuEventFired(event: Event): void {
560
768
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
561
- contextMenu.appendApplicableItems(this.object);
562
- if (this.object instanceof SDK.RemoteObject.LocalJSONObject) {
769
+ contextMenu.appendApplicableItems(this.root);
770
+ if (this.root.object instanceof SDK.RemoteObject.LocalJSONObject) {
563
771
  contextMenu.viewSection().appendItem(
564
772
  i18nString(UIStrings.expandRecursively),
565
773
  this.#objectTreeElement.expandRecursively.bind(this.#objectTreeElement, EXPANDABLE_MAX_DEPTH),
@@ -604,27 +812,17 @@ export const enum ObjectPropertiesMode {
604
812
  }
605
813
 
606
814
  export class RootElement extends UI.TreeOutline.TreeElement {
607
- private readonly object: SDK.RemoteObject.RemoteObject;
815
+ private readonly object: ObjectTree;
608
816
  private readonly linkifier: Components.Linkifier.Linkifier|undefined;
609
817
  private readonly emptyPlaceholder: string|null|undefined;
610
- private readonly propertiesMode: ObjectPropertiesMode;
611
- private readonly extraProperties: SDK.RemoteObject.RemoteObjectProperty[];
612
- private readonly targetObject: SDK.RemoteObject.RemoteObject|undefined;
613
818
  override toggleOnClick: boolean;
614
- constructor(
615
- object: SDK.RemoteObject.RemoteObject, linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null,
616
- propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
617
- extraProperties: SDK.RemoteObject.RemoteObjectProperty[] = [],
618
- targetObject: SDK.RemoteObject.RemoteObject = object) {
819
+ constructor(object: ObjectTree, linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null) {
619
820
  const contentElement = document.createElement('slot');
620
821
  super(contentElement);
621
822
 
622
823
  this.object = object;
623
824
  this.linkifier = linkifier;
624
825
  this.emptyPlaceholder = emptyPlaceholder;
625
- this.propertiesMode = propertiesMode;
626
- this.extraProperties = extraProperties;
627
- this.targetObject = targetObject;
628
826
 
629
827
  this.setExpandable(true);
630
828
  this.selectable = true;
@@ -651,7 +849,7 @@ export class RootElement extends UI.TreeOutline.TreeElement {
651
849
 
652
850
  private onContextMenu(event: Event): void {
653
851
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
654
- contextMenu.appendApplicableItems(this.object);
852
+ contextMenu.appendApplicableItems(this.object.object);
655
853
 
656
854
  if (this.object instanceof SDK.RemoteObject.LocalJSONObject) {
657
855
  const {value} = this.object;
@@ -676,8 +874,7 @@ export class RootElement extends UI.TreeOutline.TreeElement {
676
874
  const treeOutline = (this.treeOutline as ObjectPropertiesSection | null);
677
875
  const skipProto = treeOutline ? Boolean(treeOutline.skipProtoInternal) : false;
678
876
  return await ObjectPropertyTreeElement.populate(
679
- this, this.object, skipProto, false, this.linkifier, this.emptyPlaceholder, this.propertiesMode,
680
- this.extraProperties, this.targetObject);
877
+ this, this.object, skipProto, false, this.linkifier, this.emptyPlaceholder);
681
878
  }
682
879
  }
683
880
 
@@ -688,7 +885,7 @@ export class RootElement extends UI.TreeOutline.TreeElement {
688
885
  export const InitialVisibleChildrenLimit = 200;
689
886
 
690
887
  export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
691
- property: SDK.RemoteObject.RemoteObjectProperty;
888
+ property: ObjectTreeNode;
692
889
  override toggleOnClick: boolean;
693
890
  private highlightChanges: UI.UIUtils.HighlightChange[];
694
891
  private linkifier: Components.Linkifier.Linkifier|undefined;
@@ -701,7 +898,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
701
898
  private editableDiv!: HTMLElement;
702
899
  propertyValue?: ObjectPropertyValue;
703
900
  expandedValueElement?: Element|null;
704
- constructor(property: SDK.RemoteObject.RemoteObjectProperty, linkifier?: Components.Linkifier.Linkifier) {
901
+ constructor(property: ObjectTreeNode, linkifier?: Components.Linkifier.Linkifier) {
705
902
  // Pass an empty title, the title gets made later in onattach.
706
903
  super();
707
904
 
@@ -716,52 +913,30 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
716
913
  }
717
914
 
718
915
  static async populate(
719
- treeElement: UI.TreeOutline.TreeElement, value: SDK.RemoteObject.RemoteObject, skipProto: boolean,
720
- skipGettersAndSetters: boolean, linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null,
721
- propertiesMode: ObjectPropertiesMode = ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
722
- extraProperties?: SDK.RemoteObject.RemoteObjectProperty[],
723
- targetValue?: SDK.RemoteObject.RemoteObject): Promise<void> {
724
- if (value.arrayLength() > ARRAY_LOAD_THRESHOLD) {
725
- treeElement.removeChildren();
726
- void ArrayGroupingTreeElement.populateArray(treeElement, value, 0, value.arrayLength() - 1, linkifier);
727
- return;
728
- }
729
-
730
- let properties, internalProperties = null;
731
- switch (propertiesMode) {
732
- case ObjectPropertiesMode.ALL:
733
- ({properties} = await value.getAllProperties(false /* accessorPropertiesOnly */, true /* generatePreview */));
734
- break;
735
- case ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED:
736
- ({properties, internalProperties} =
737
- await SDK.RemoteObject.RemoteObject.loadFromObjectPerProto(value, true /* generatePreview */));
738
- break;
739
- }
740
- treeElement.removeChildren();
741
- if (!properties) {
742
- return;
743
- }
744
-
745
- if (extraProperties !== undefined) {
746
- properties.push(...extraProperties);
916
+ treeElement: UI.TreeOutline.TreeElement,
917
+ value: ObjectTreeNodeBase,
918
+ skipProto: boolean,
919
+ skipGettersAndSetters: boolean,
920
+ linkifier?: Components.Linkifier.Linkifier,
921
+ emptyPlaceholder?: string|null,
922
+ ): Promise<void> {
923
+ const properties = await value.children();
924
+ if (properties.arrayRanges) {
925
+ await ArrayGroupingTreeElement.populate(treeElement, properties, linkifier);
926
+ } else {
927
+ ObjectPropertyTreeElement.populateWithProperties(
928
+ treeElement, properties, skipProto, skipGettersAndSetters, linkifier, emptyPlaceholder);
747
929
  }
748
-
749
- ObjectPropertyTreeElement.populateWithProperties(
750
- treeElement, properties, internalProperties, skipProto, skipGettersAndSetters, targetValue || value, linkifier,
751
- emptyPlaceholder);
752
930
  }
753
931
 
754
932
  static populateWithProperties(
755
- treeNode: UI.TreeOutline.TreeElement, properties: SDK.RemoteObject.RemoteObjectProperty[],
756
- internalProperties: SDK.RemoteObject.RemoteObjectProperty[]|null, skipProto: boolean,
757
- skipGettersAndSetters: boolean, value: SDK.RemoteObject.RemoteObject|null,
758
- linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null): void {
759
- properties.sort(ObjectPropertiesSection.compareProperties);
760
- internalProperties = internalProperties || [];
761
-
762
- const entriesProperty = internalProperties.find(property => property.name === '[[Entries]]');
933
+ treeNode: UI.TreeOutline.TreeElement, {properties, internalProperties}: NodeChildren, skipProto: boolean,
934
+ skipGettersAndSetters: boolean, linkifier?: Components.Linkifier.Linkifier,
935
+ emptyPlaceholder?: string|null): void {
936
+ properties?.sort(ObjectPropertiesSection.compareProperties);
937
+
938
+ const entriesProperty = internalProperties?.find(({property}) => property.name === '[[Entries]]');
763
939
  if (entriesProperty) {
764
- parentMap.set(entriesProperty, value);
765
940
  const treeElement = new ObjectPropertyTreeElement(entriesProperty, linkifier);
766
941
  treeElement.setExpandable(true);
767
942
  treeElement.expand();
@@ -769,34 +944,30 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
769
944
  }
770
945
 
771
946
  const tailProperties = [];
772
- for (let i = 0; i < properties.length; ++i) {
773
- const property = properties[i];
774
- parentMap.set(property, value);
775
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
776
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
777
- if (!ObjectPropertiesSection.isDisplayableProperty(property, (treeNode as any).property)) {
947
+ for (const property of properties ?? []) {
948
+ if (treeNode instanceof ObjectPropertyTreeElement &&
949
+ !ObjectPropertiesSection.isDisplayableProperty(property.property, treeNode.property?.property)) {
778
950
  continue;
779
951
  }
780
952
 
781
- if (property.isOwn && !skipGettersAndSetters) {
782
- if (property.getter) {
783
- const getterProperty =
784
- new SDK.RemoteObject.RemoteObjectProperty('get ' + property.name, property.getter, false);
785
- parentMap.set(getterProperty, value);
786
- tailProperties.push(getterProperty);
953
+ // FIXME move into node
954
+ if (property.property.isOwn && !skipGettersAndSetters) {
955
+ if (property.property.getter) {
956
+ const getterProperty = new SDK.RemoteObject.RemoteObjectProperty(
957
+ 'get ' + property.property.name, property.property.getter, false);
958
+ tailProperties.push(new ObjectTreeNode(getterProperty, property.propertiesMode, property.parent));
787
959
  }
788
- if (property.setter) {
789
- const setterProperty =
790
- new SDK.RemoteObject.RemoteObjectProperty('set ' + property.name, property.setter, false);
791
- parentMap.set(setterProperty, value);
792
- tailProperties.push(setterProperty);
960
+ if (property.property.setter) {
961
+ const setterProperty = new SDK.RemoteObject.RemoteObjectProperty(
962
+ 'set ' + property.property.name, property.property.setter, false);
963
+ tailProperties.push(new ObjectTreeNode(setterProperty, property.propertiesMode, property.parent));
793
964
  }
794
965
  }
795
966
 
796
- const canShowProperty = property.getter || !property.isAccessorProperty();
967
+ const canShowProperty = property.property.getter || !property.property.isAccessorProperty();
797
968
  if (canShowProperty) {
798
969
  const element = new ObjectPropertyTreeElement(property, linkifier);
799
- if (property.name === 'memories' && property.value?.className === 'Memories') {
970
+ if (property.property.name === 'memories' && property.object?.className === 'Memories') {
800
971
  element.updateExpandable();
801
972
  if (element.isExpandable()) {
802
973
  element.expand();
@@ -809,13 +980,12 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
809
980
  treeNode.appendChild(new ObjectPropertyTreeElement(tailProperties[i], linkifier));
810
981
  }
811
982
 
812
- for (const property of internalProperties) {
813
- parentMap.set(property, value);
983
+ for (const property of internalProperties ?? []) {
814
984
  const treeElement = new ObjectPropertyTreeElement(property, linkifier);
815
- if (property.name === '[[Entries]]') {
985
+ if (property.property.name === '[[Entries]]') {
816
986
  continue;
817
987
  }
818
- if (property.name === '[[Prototype]]' && skipProto) {
988
+ if (property.property.name === '[[Prototype]]' && skipProto) {
819
989
  continue;
820
990
  }
821
991
  treeNode.appendChild(treeElement);
@@ -877,8 +1047,8 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
877
1047
  this.revertHighlightChanges();
878
1048
 
879
1049
  this.applySearch(regex, this.nameElement, cssClasses);
880
- if (this.property.value) {
881
- const valueType = this.property.value.type;
1050
+ if (this.property.object) {
1051
+ const valueType = this.property.object.type;
882
1052
  if (valueType !== 'object') {
883
1053
  this.applySearch(regex, this.valueElement, cssClasses);
884
1054
  }
@@ -929,14 +1099,13 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
929
1099
  }
930
1100
 
931
1101
  override async onpopulate(): Promise<void> {
932
- const propertyValue = (this.property.value as SDK.RemoteObject.RemoteObject);
933
- console.assert(typeof propertyValue !== 'undefined');
934
1102
  const treeOutline = (this.treeOutline as ObjectPropertiesSection | null);
935
1103
  const skipProto = treeOutline ? Boolean(treeOutline.skipProtoInternal) : false;
936
- const targetValue = this.property.name !== '[[Prototype]]' ? propertyValue : parentMap.get(this.property);
937
- if (targetValue) {
938
- await ObjectPropertyTreeElement.populate(
939
- this, propertyValue, skipProto, false, this.linkifier, undefined, undefined, undefined, targetValue);
1104
+ this.removeChildren();
1105
+ this.property.removeChildren();
1106
+
1107
+ if (this.property.object) {
1108
+ await ObjectPropertyTreeElement.populate(this, this.property, skipProto, false, this.linkifier);
940
1109
  if (this.childCount() > this.maxNumPropertiesToShow) {
941
1110
  this.createShowAllPropertiesButton();
942
1111
  }
@@ -947,16 +1116,16 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
947
1116
  const target = (event.target as HTMLElement);
948
1117
  const inEditableElement = target.isSelfOrDescendant(this.valueElement) ||
949
1118
  (this.expandedValueElement && target.isSelfOrDescendant(this.expandedValueElement));
950
- if (this.property.value && !this.property.value.customPreview() && inEditableElement &&
951
- (this.property.writable || this.property.setter)) {
1119
+ if (this.property.object && !this.property.object.customPreview() && inEditableElement &&
1120
+ (this.property.property.writable || this.property.property.setter)) {
952
1121
  this.startEditing();
953
1122
  }
954
1123
  return false;
955
1124
  }
956
1125
 
957
1126
  override onenter(): boolean {
958
- if (this.property.value && !this.property.value.customPreview() &&
959
- (this.property.writable || this.property.setter)) {
1127
+ if (this.property.object && !this.property.object.customPreview() &&
1128
+ (this.property.property.writable || this.property.property.setter)) {
960
1129
  this.startEditing();
961
1130
  return true;
962
1131
  }
@@ -1011,46 +1180,47 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1011
1180
 
1012
1181
  update(): void {
1013
1182
  this.nameElement =
1014
- (ObjectPropertiesSection.createNameElement(this.property.name, this.property.private) as HTMLElement);
1015
- if (!this.property.enumerable) {
1183
+ (ObjectPropertiesSection.createNameElement(this.property.name, this.property.property.private) as HTMLElement);
1184
+ if (!this.property.property.enumerable) {
1016
1185
  this.nameElement.classList.add('object-properties-section-dimmed');
1017
1186
  }
1018
- if (this.property.isOwn) {
1187
+ if (this.property.property.isOwn) {
1019
1188
  this.nameElement.classList.add('own-property');
1020
1189
  }
1021
- if (this.property.synthetic) {
1190
+ if (this.property.property.synthetic) {
1022
1191
  this.nameElement.classList.add('synthetic-property');
1023
1192
  }
1024
1193
 
1025
1194
  this.updatePropertyPath();
1026
1195
 
1027
- const isInternalEntries = this.property.synthetic && this.property.name === '[[Entries]]';
1196
+ const isInternalEntries = this.property.property.synthetic && this.property.name === '[[Entries]]';
1028
1197
  if (isInternalEntries) {
1029
1198
  this.valueElement = document.createElement('span');
1030
1199
  this.valueElement.classList.add('value');
1031
- } else if (this.property.value) {
1200
+ } else if (this.property.object) {
1032
1201
  const showPreview = this.property.name !== '[[Prototype]]';
1033
1202
  this.propertyValue = ObjectPropertiesSection.createPropertyValueWithCustomSupport(
1034
- this.property.value, this.property.wasThrown, showPreview, this.linkifier, this.property.synthetic,
1035
- this.path() /* variableName */);
1203
+ this.property.object, this.property.property.wasThrown, showPreview, this.linkifier,
1204
+ this.property.property.synthetic, this.path() /* variableName */);
1036
1205
  this.valueElement = (this.propertyValue.element as HTMLElement);
1037
- } else if (this.property.getter) {
1206
+ } else if (this.property.property.getter) {
1038
1207
  this.valueElement = document.createElement('span');
1039
1208
  const element = this.valueElement.createChild('span');
1040
1209
  element.textContent = i18nString(UIStrings.dots);
1041
1210
  element.classList.add('object-value-calculate-value-button');
1042
1211
  UI.Tooltip.Tooltip.install(element, i18nString(UIStrings.invokePropertyGetter));
1043
- const object = parentMap.get(this.property) as SDK.RemoteObject.RemoteObject;
1044
- const getter = this.property.getter;
1212
+ const getter = this.property.property.getter;
1045
1213
  element.addEventListener('click', (event: Event) => {
1046
1214
  event.consume();
1047
1215
  const invokeGetter = `
1048
1216
  function invokeGetter(getter) {
1049
1217
  return Reflect.apply(getter, this, []);
1050
1218
  }`;
1051
- // @ts-expect-error No way to teach TypeScript to preserve the Function-ness of `getter`.
1052
1219
  // Also passing a string instead of a Function to avoid coverage implementation messing with it.
1053
- void object.callFunction(invokeGetter, [SDK.RemoteObject.RemoteObject.toCallArgument(getter)])
1220
+ void this.property.parent
1221
+ ?.object
1222
+ // @ts-expect-error No way to teach TypeScript to preserve the Function-ness of `getter`.
1223
+ ?.callFunction(invokeGetter, [SDK.RemoteObject.RemoteObject.toCallArgument(getter)])
1054
1224
  .then(this.onInvokeGetterClick.bind(this));
1055
1225
  }, false);
1056
1226
  } else {
@@ -1061,8 +1231,9 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1061
1231
  }
1062
1232
 
1063
1233
  const valueText = this.valueElement.textContent;
1064
- if (this.property.value && valueText && !this.property.wasThrown) {
1065
- this.expandedValueElement = this.createExpandedValueElement(this.property.value, this.property.synthetic);
1234
+ if (this.property.object && valueText && !this.property.property.wasThrown) {
1235
+ this.expandedValueElement =
1236
+ this.createExpandedValueElement(this.property.object, this.property.property.synthetic);
1066
1237
  }
1067
1238
 
1068
1239
  const adorner: Element|string = '';
@@ -1091,7 +1262,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1091
1262
 
1092
1263
  const name = this.property.name;
1093
1264
 
1094
- if (this.property.synthetic) {
1265
+ if (this.property.property.synthetic) {
1095
1266
  UI.Tooltip.Tooltip.install(this.nameElement, name);
1096
1267
  return;
1097
1268
  }
@@ -1101,11 +1272,11 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1101
1272
  const isInteger = /^(?:0|[1-9]\d*)$/;
1102
1273
 
1103
1274
  const parentPath = (this.parent instanceof ObjectPropertyTreeElement && this.parent.nameElement &&
1104
- !this.parent.property.synthetic) ?
1275
+ !this.parent.property.property.synthetic) ?
1105
1276
  this.parent.nameElement.title :
1106
1277
  '';
1107
1278
 
1108
- if (this.property.private || useDotNotation.test(name)) {
1279
+ if (this.property.property.private || useDotNotation.test(name)) {
1109
1280
  UI.Tooltip.Tooltip.install(this.nameElement, parentPath ? `${parentPath}.${name}` : name);
1110
1281
  } else if (isInteger.test(name)) {
1111
1282
  UI.Tooltip.Tooltip.install(this.nameElement, `${parentPath}[${name}]`);
@@ -1117,14 +1288,14 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1117
1288
  private contextMenuFired(event: Event): void {
1118
1289
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
1119
1290
  contextMenu.appendApplicableItems(this);
1120
- if (this.property.symbol) {
1121
- contextMenu.appendApplicableItems(this.property.symbol);
1122
- }
1123
- if (this.property.value) {
1124
- contextMenu.appendApplicableItems(this.property.value);
1125
- if (parentMap.get(this.property) instanceof SDK.RemoteObject.LocalJSONObject) {
1126
- const {value: {value}} = this.property;
1127
- const propertyValue = typeof value === 'object' ? JSON.stringify(value, null, 2) : value;
1291
+ if (this.property.property.symbol) {
1292
+ contextMenu.appendApplicableItems(this.property.property.symbol);
1293
+ }
1294
+ if (this.property.object) {
1295
+ contextMenu.appendApplicableItems(this.property.object);
1296
+ if (this.property.parent?.object instanceof SDK.RemoteObject.LocalJSONObject) {
1297
+ const propertyValue = typeof this.property.object === 'object' ? JSON.stringify(this.property.object, null, 2) :
1298
+ this.property.object;
1128
1299
  const copyValueHandler = (): void => {
1129
1300
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.NetworkPanelCopyValue);
1130
1301
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText((propertyValue as string | undefined));
@@ -1133,13 +1304,13 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1133
1304
  i18nString(UIStrings.copyValue), copyValueHandler, {jslogContext: 'copy-value'});
1134
1305
  }
1135
1306
  }
1136
- if (!this.property.synthetic && this.nameElement?.title) {
1307
+ if (!this.property.property.synthetic && this.nameElement?.title) {
1137
1308
  const copyPathHandler = Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText.bind(
1138
1309
  Host.InspectorFrontendHost.InspectorFrontendHostInstance, this.nameElement.title);
1139
1310
  contextMenu.clipboardSection().appendItem(
1140
1311
  i18nString(UIStrings.copyPropertyPath), copyPathHandler, {jslogContext: 'copy-property-path'});
1141
1312
  }
1142
- if (parentMap.get(this.property) instanceof SDK.RemoteObject.LocalJSONObject) {
1313
+ if (this.property.parent?.object instanceof SDK.RemoteObject.LocalJSONObject) {
1143
1314
  contextMenu.viewSection().appendItem(
1144
1315
  i18nString(UIStrings.expandRecursively), this.expandRecursively.bind(this, EXPANDABLE_MAX_DEPTH),
1145
1316
  {jslogContext: 'expand-recursively'});
@@ -1160,9 +1331,9 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1160
1331
  }
1161
1332
  this.editableDiv = this.rowContainer.createChild('span', 'editable-div');
1162
1333
 
1163
- if (this.property.value) {
1164
- let text: string|(string | undefined) = this.property.value.description;
1165
- if (this.property.value.type === 'string' && typeof text === 'string') {
1334
+ if (this.property.object) {
1335
+ let text: string|(string | undefined) = this.property.object.description;
1336
+ if (this.property.object.type === 'string' && typeof text === 'string') {
1166
1337
  text = `"${text}"`;
1167
1338
  }
1168
1339
 
@@ -1233,13 +1404,13 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1233
1404
  }
1234
1405
 
1235
1406
  private async applyExpression(expression: string): Promise<void> {
1236
- const property = SDK.RemoteObject.RemoteObject.toCallArgument(this.property.symbol || this.property.name);
1407
+ const property = SDK.RemoteObject.RemoteObject.toCallArgument(this.property.property.symbol || this.property.name);
1237
1408
  expression = JavaScriptREPL.wrapObjectLiteral(expression.trim());
1238
1409
 
1239
- if (this.property.synthetic) {
1410
+ if (this.property.property.synthetic) {
1240
1411
  let invalidate = false;
1241
1412
  if (expression) {
1242
- invalidate = await this.property.setSyntheticValue(expression);
1413
+ invalidate = await this.property.property.setSyntheticValue(expression);
1243
1414
  }
1244
1415
  if (invalidate) {
1245
1416
  const parent = this.parent;
@@ -1253,7 +1424,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1253
1424
  return;
1254
1425
  }
1255
1426
 
1256
- const parentObject = (parentMap.get(this.property) as SDK.RemoteObject.RemoteObject);
1427
+ const parentObject = this.property.parent?.object as SDK.RemoteObject.RemoteObject;
1257
1428
  const errorPromise =
1258
1429
  expression ? parentObject.setPropertyValue(property, expression) : parentObject.deleteProperty(property);
1259
1430
  const error = await errorPromise;
@@ -1265,11 +1436,13 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1265
1436
  if (!expression) {
1266
1437
  // The property was deleted, so remove this tree element.
1267
1438
  this.parent?.removeChild(this);
1439
+ this.property.parent?.removeChild(this.property);
1268
1440
  } else {
1269
1441
  // Call updateSiblings since their value might be based on the value that just changed.
1270
1442
  const parent = this.parent;
1271
1443
  if (parent) {
1272
1444
  parent.invalidateChildren();
1445
+ this.property.parent?.removeChildren();
1273
1446
  void parent.onpopulate();
1274
1447
  }
1275
1448
  }
@@ -1279,8 +1452,8 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1279
1452
  if (!result.object) {
1280
1453
  return;
1281
1454
  }
1282
- this.property.value = result.object;
1283
- this.property.wasThrown = result.wasThrown || false;
1455
+ this.property.property.value = result.object;
1456
+ this.property.property.wasThrown = result.wasThrown || false;
1284
1457
 
1285
1458
  this.update();
1286
1459
  this.invalidateChildren();
@@ -1288,9 +1461,10 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1288
1461
  }
1289
1462
 
1290
1463
  private updateExpandable(): void {
1291
- if (this.property.value) {
1464
+ if (this.property.object) {
1292
1465
  this.setExpandable(
1293
- !this.property.value.customPreview() && this.property.value.hasChildren && !this.property.wasThrown);
1466
+ !this.property.object.customPreview() && this.property.object.hasChildren &&
1467
+ !this.property.property.wasThrown);
1294
1468
  } else {
1295
1469
  this.setExpandable(false);
1296
1470
  }
@@ -1301,249 +1475,185 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1301
1475
  }
1302
1476
  }
1303
1477
 
1304
- export class ArrayGroupingTreeElement extends UI.TreeOutline.TreeElement {
1305
- override toggleOnClick: boolean;
1306
- private readonly fromIndex: number;
1307
- private readonly toIndex: number;
1308
- private readonly object: SDK.RemoteObject.RemoteObject;
1309
- private readonly propertyCount: number;
1310
- private readonly linkifier: Components.Linkifier.Linkifier|undefined;
1311
- constructor(
1312
- object: SDK.RemoteObject.RemoteObject, fromIndex: number, toIndex: number, propertyCount: number,
1313
- linkifier?: Components.Linkifier.Linkifier) {
1314
- super(Platform.StringUtilities.sprintf('[%d … %d]', fromIndex, toIndex), true);
1315
- this.toggleOnClick = true;
1316
- this.fromIndex = fromIndex;
1317
- this.toIndex = toIndex;
1318
- this.object = object;
1319
- this.propertyCount = propertyCount;
1320
- this.linkifier = linkifier;
1321
- }
1322
-
1323
- static async populateArray(
1324
- treeNode: UI.TreeOutline.TreeElement, object: SDK.RemoteObject.RemoteObject, fromIndex: number, toIndex: number,
1325
- linkifier?: Components.Linkifier.Linkifier): Promise<void> {
1326
- await ArrayGroupingTreeElement.populateRanges(treeNode, object, fromIndex, toIndex, true, linkifier);
1327
- }
1478
+ async function arrayRangeGroups(object: SDK.RemoteObject.RemoteObject, fromIndex: number, toIndex: number):
1479
+ Promise<{ranges: number[][]}|null|undefined> {
1480
+ return await object.callFunctionJSON(packArrayRanges, [
1481
+ {value: fromIndex},
1482
+ {value: toIndex},
1483
+ {value: ArrayGroupingTreeElement.bucketThreshold},
1484
+ {value: ArrayGroupingTreeElement.sparseIterationThreshold},
1485
+ ]);
1328
1486
 
1329
- private static async populateRanges(
1330
- treeNode: UI.TreeOutline.TreeElement, object: SDK.RemoteObject.RemoteObject, fromIndex: number, toIndex: number,
1331
- topLevel: boolean, linkifier?: Components.Linkifier.Linkifier): Promise<void> {
1332
- const jsonValue = await object.callFunctionJSON(packRanges, [
1333
- {value: fromIndex},
1334
- {value: toIndex},
1335
- {value: ArrayGroupingTreeElement.bucketThreshold},
1336
- {value: ArrayGroupingTreeElement.sparseIterationThreshold},
1337
- ]);
1487
+ /**
1488
+ * This function is called on the RemoteObject.
1489
+ * Note: must declare params as optional.
1490
+ */
1491
+ function packArrayRanges(
1492
+ this: Object, fromIndex?: number, toIndex?: number, bucketThreshold?: number,
1493
+ sparseIterationThreshold?: number): {
1494
+ ranges: number[][],
1495
+ }|undefined {
1496
+ if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined ||
1497
+ bucketThreshold === undefined) {
1498
+ return;
1499
+ }
1500
+ let ownPropertyNames: string[]|null = null;
1501
+ const consecutiveRange = (toIndex - fromIndex >= sparseIterationThreshold) && ArrayBuffer.isView(this);
1338
1502
 
1339
- await callback(jsonValue);
1340
-
1341
- /**
1342
- * Note: must declare params as optional.
1343
- */
1344
- function packRanges(
1345
- this: Object, fromIndex?: number, toIndex?: number, bucketThreshold?: number,
1346
- sparseIterationThreshold?: number): {
1347
- ranges: number[][],
1348
- }|undefined {
1349
- if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined ||
1350
- bucketThreshold === undefined) {
1503
+ function* arrayIndexes(object: Object): Generator<number, void, unknown> {
1504
+ if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined) {
1351
1505
  return;
1352
1506
  }
1353
- let ownPropertyNames: string[]|null = null;
1354
- const consecutiveRange = (toIndex - fromIndex >= sparseIterationThreshold) && ArrayBuffer.isView(this);
1355
1507
 
1356
- function* arrayIndexes(object: Object): Generator<number, void, unknown> {
1357
- if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined) {
1358
- return;
1508
+ if (toIndex - fromIndex < sparseIterationThreshold) {
1509
+ for (let i = fromIndex; i <= toIndex; ++i) {
1510
+ if (i in object) {
1511
+ yield i;
1512
+ }
1359
1513
  }
1514
+ } else {
1515
+ ownPropertyNames = ownPropertyNames || Object.getOwnPropertyNames(object);
1516
+ for (let i = 0; i < ownPropertyNames.length; ++i) {
1517
+ const name = ownPropertyNames[i];
1360
1518
 
1361
- if (toIndex - fromIndex < sparseIterationThreshold) {
1362
- for (let i = fromIndex; i <= toIndex; ++i) {
1363
- if (i in object) {
1364
- yield i;
1365
- }
1366
- }
1367
- } else {
1368
- ownPropertyNames = ownPropertyNames || Object.getOwnPropertyNames(object);
1369
- for (let i = 0; i < ownPropertyNames.length; ++i) {
1370
- const name = ownPropertyNames[i];
1371
-
1372
- const index = Number(name) >>> 0;
1373
- if ((String(index)) === name && fromIndex <= index && index <= toIndex) {
1374
- yield index;
1375
- }
1519
+ const index = Number(name) >>> 0;
1520
+ if ((String(index)) === name && fromIndex <= index && index <= toIndex) {
1521
+ yield index;
1376
1522
  }
1377
1523
  }
1378
1524
  }
1525
+ }
1379
1526
 
1380
- let count = 0;
1381
- if (consecutiveRange) {
1382
- count = toIndex - fromIndex + 1;
1383
- } else {
1384
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1385
- for (const ignored of arrayIndexes(this)) {
1386
- ++count;
1387
- }
1527
+ let count = 0;
1528
+ if (consecutiveRange) {
1529
+ count = toIndex - fromIndex + 1;
1530
+ } else {
1531
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1532
+ for (const ignored of arrayIndexes(this)) {
1533
+ ++count;
1388
1534
  }
1535
+ }
1389
1536
 
1390
- let bucketSize: number = count;
1391
- if (count <= bucketThreshold) {
1392
- bucketSize = count;
1393
- } else {
1394
- bucketSize = Math.pow(bucketThreshold, Math.ceil(Math.log(count) / Math.log(bucketThreshold)) - 1);
1395
- }
1537
+ let bucketSize: number = count;
1538
+ if (count <= bucketThreshold) {
1539
+ bucketSize = count;
1540
+ } else {
1541
+ bucketSize = Math.pow(bucketThreshold, Math.ceil(Math.log(count) / Math.log(bucketThreshold)) - 1);
1542
+ }
1396
1543
 
1397
- const ranges = [];
1398
- if (consecutiveRange) {
1399
- for (let i = fromIndex; i <= toIndex; i += bucketSize) {
1400
- const groupStart = i;
1401
- let groupEnd: number = groupStart + bucketSize - 1;
1402
- if (groupEnd > toIndex) {
1403
- groupEnd = toIndex;
1404
- }
1405
- ranges.push([groupStart, groupEnd, groupEnd - groupStart + 1]);
1544
+ const ranges = [];
1545
+ if (consecutiveRange) {
1546
+ for (let i = fromIndex; i <= toIndex; i += bucketSize) {
1547
+ const groupStart = i;
1548
+ let groupEnd: number = groupStart + bucketSize - 1;
1549
+ if (groupEnd > toIndex) {
1550
+ groupEnd = toIndex;
1406
1551
  }
1407
- } else {
1408
- count = 0;
1409
- let groupStart = -1;
1410
- let groupEnd = 0;
1411
- for (const i of arrayIndexes(this)) {
1412
- if (groupStart === -1) {
1413
- groupStart = i;
1414
- }
1415
- groupEnd = i;
1416
- if (++count === bucketSize) {
1417
- ranges.push([groupStart, groupEnd, count]);
1418
- count = 0;
1419
- groupStart = -1;
1420
- }
1552
+ ranges.push([groupStart, groupEnd, groupEnd - groupStart + 1]);
1553
+ }
1554
+ } else {
1555
+ count = 0;
1556
+ let groupStart = -1;
1557
+ let groupEnd = 0;
1558
+ for (const i of arrayIndexes(this)) {
1559
+ if (groupStart === -1) {
1560
+ groupStart = i;
1421
1561
  }
1422
- if (count > 0) {
1562
+ groupEnd = i;
1563
+ if (++count === bucketSize) {
1423
1564
  ranges.push([groupStart, groupEnd, count]);
1565
+ count = 0;
1566
+ groupStart = -1;
1424
1567
  }
1425
1568
  }
1426
-
1427
- return {ranges};
1569
+ if (count > 0) {
1570
+ ranges.push([groupStart, groupEnd, count]);
1571
+ }
1428
1572
  }
1429
1573
 
1430
- async function callback(result: {ranges: number[][]}|undefined|null): Promise<void> {
1431
- if (!result) {
1432
- return;
1433
- }
1434
- const ranges = (result.ranges);
1435
- if (ranges.length === 1) {
1436
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1437
- // @ts-expect-error
1438
- await ArrayGroupingTreeElement.populateAsFragment(treeNode, object, ranges[0][0], ranges[0][1], linkifier);
1439
- } else {
1440
- for (let i = 0; i < ranges.length; ++i) {
1441
- const fromIndex = ranges[i][0];
1442
- const toIndex = ranges[i][1];
1443
- const count = ranges[i][2];
1444
- if (fromIndex === toIndex) {
1445
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1446
- // @ts-expect-error
1447
- await ArrayGroupingTreeElement.populateAsFragment(treeNode, object, fromIndex, toIndex, linkifier);
1448
- } else {
1449
- treeNode.appendChild(new ArrayGroupingTreeElement(object, fromIndex, toIndex, count, linkifier));
1450
- }
1451
- }
1574
+ return {ranges};
1575
+ }
1576
+ }
1577
+
1578
+ /**
1579
+ * This function is called on the RemoteObject.
1580
+ */
1581
+ function buildArrayFragment(
1582
+ this: Record<number, Object>,
1583
+ fromIndex?: number,
1584
+ toIndex?: number,
1585
+ sparseIterationThreshold?: number,
1586
+ ): unknown {
1587
+ const result = Object.create(null);
1588
+
1589
+ if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined) {
1590
+ return;
1591
+ }
1592
+
1593
+ if (toIndex - fromIndex < sparseIterationThreshold) {
1594
+ for (let i = fromIndex; i <= toIndex; ++i) {
1595
+ if (i in this) {
1596
+ result[i] = this[i];
1452
1597
  }
1453
- if (topLevel) {
1454
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1455
- // @ts-expect-error
1456
- await ArrayGroupingTreeElement.populateNonIndexProperties(treeNode, object, linkifier);
1598
+ }
1599
+ } else {
1600
+ const ownPropertyNames = Object.getOwnPropertyNames(this);
1601
+ for (let i = 0; i < ownPropertyNames.length; ++i) {
1602
+ const name = ownPropertyNames[i];
1603
+ const index = Number(name) >>> 0;
1604
+ if (String(index) === name && fromIndex <= index && index <= toIndex) {
1605
+ result[index] = this[index];
1457
1606
  }
1458
1607
  }
1459
1608
  }
1609
+ return result;
1610
+ }
1460
1611
 
1461
- private static async populateAsFragment(
1462
- this: ArrayGroupingTreeElement, treeNode: UI.TreeOutline.TreeElement, object: SDK.RemoteObject.RemoteObject,
1463
- fromIndex: number, toIndex: number, linkifier?: Components.Linkifier.Linkifier): Promise<void> {
1464
- const result = await object.callFunction(
1465
- buildArrayFragment,
1466
- [{value: fromIndex}, {value: toIndex}, {value: ArrayGroupingTreeElement.sparseIterationThreshold}]);
1467
- if (!result.object || result.wasThrown) {
1468
- return;
1469
- }
1470
- const arrayFragment = result.object;
1471
- const allProperties =
1472
- await arrayFragment.getAllProperties(false /* accessorPropertiesOnly */, true /* generatePreview */);
1473
- arrayFragment.release();
1474
- const properties = allProperties.properties;
1475
- if (!properties) {
1612
+ export class ArrayGroupingTreeElement extends UI.TreeOutline.TreeElement {
1613
+ override toggleOnClick: boolean;
1614
+ private readonly linkifier: Components.Linkifier.Linkifier|undefined;
1615
+ readonly #child: ArrayGroupTreeNode;
1616
+ constructor(child: ArrayGroupTreeNode, linkifier?: Components.Linkifier.Linkifier) {
1617
+ super(Platform.StringUtilities.sprintf('[%d … %d]', child.range.fromIndex, child.range.toIndex), true);
1618
+ this.#child = child;
1619
+ this.toggleOnClick = true;
1620
+ this.linkifier = linkifier;
1621
+ }
1622
+
1623
+ static async populate(
1624
+ treeNode: UI.TreeOutline.TreeElement, children: NodeChildren,
1625
+ linkifier?: Components.Linkifier.Linkifier): Promise<void> {
1626
+ if (!children.arrayRanges) {
1476
1627
  return;
1477
1628
  }
1478
- properties.sort(ObjectPropertiesSection.compareProperties);
1479
- for (let i = 0; i < properties.length; ++i) {
1480
- parentMap.set(properties[i], this.object);
1481
- const childTreeElement = new ObjectPropertyTreeElement(properties[i], linkifier);
1482
- childTreeElement.readOnly = true;
1483
- treeNode.appendChild(childTreeElement);
1484
- }
1485
-
1486
- function buildArrayFragment(
1487
- this: Record<number, Object>,
1488
- fromIndex?: number,
1489
- toIndex?: number,
1490
- sparseIterationThreshold?: number,
1491
- ): unknown {
1492
- const result = Object.create(null);
1493
-
1494
- if (fromIndex === undefined || toIndex === undefined || sparseIterationThreshold === undefined) {
1495
- return;
1496
- }
1497
-
1498
- if (toIndex - fromIndex < sparseIterationThreshold) {
1499
- for (let i = fromIndex; i <= toIndex; ++i) {
1500
- if (i in this) {
1501
- result[i] = this[i];
1502
- }
1503
- }
1504
- } else {
1505
- const ownPropertyNames = Object.getOwnPropertyNames(this);
1506
- for (let i = 0; i < ownPropertyNames.length; ++i) {
1507
- const name = ownPropertyNames[i];
1508
- const index = Number(name) >>> 0;
1509
- if (String(index) === name && fromIndex <= index && index <= toIndex) {
1510
- result[index] = this[index];
1511
- }
1629
+ if (children.arrayRanges.length === 1) {
1630
+ await ObjectPropertyTreeElement.populate(treeNode, children.arrayRanges[0], false, false, linkifier);
1631
+ } else {
1632
+ for (const child of children.arrayRanges) {
1633
+ if (child.singular) {
1634
+ await ObjectPropertyTreeElement.populate(treeNode, child, false, false, linkifier);
1635
+ } else {
1636
+ treeNode.appendChild(new ArrayGroupingTreeElement(child, linkifier));
1512
1637
  }
1513
1638
  }
1514
- return result;
1515
1639
  }
1516
- }
1517
1640
 
1518
- private static async populateNonIndexProperties(
1519
- this: ArrayGroupingTreeElement, treeNode: UI.TreeOutline.TreeElement, object: SDK.RemoteObject.RemoteObject,
1520
- linkifier?: Components.Linkifier.Linkifier): Promise<void> {
1521
- const {properties, internalProperties} = await SDK.RemoteObject.RemoteObject.loadFromObjectPerProto(
1522
- object, true /* generatePreview */, true /* nonIndexedPropertiesOnly */);
1523
- if (!properties) {
1524
- return;
1525
- }
1526
- ObjectPropertyTreeElement.populateWithProperties(
1527
- treeNode, properties, internalProperties, false, false, object, linkifier);
1641
+ ObjectPropertyTreeElement.populateWithProperties(treeNode, children, false, false, linkifier);
1528
1642
  }
1529
1643
 
1530
1644
  override async onpopulate(): Promise<void> {
1531
- if (this.propertyCount >= ArrayGroupingTreeElement.bucketThreshold) {
1532
- await ArrayGroupingTreeElement.populateRanges(
1533
- this, this.object, this.fromIndex, this.toIndex, false, this.linkifier);
1534
- return;
1535
- }
1536
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1537
- // @ts-expect-error
1538
- await ArrayGroupingTreeElement.populateAsFragment(this, this.object, this.fromIndex, this.toIndex, this.linkifier);
1645
+ this.removeChildren();
1646
+ this.#child.removeChildren();
1647
+ await ObjectPropertyTreeElement.populate(this, this.#child, false, false, this.linkifier);
1539
1648
  }
1540
1649
 
1541
1650
  override onattach(): void {
1542
1651
  this.listItemElement.classList.add('object-properties-section-name');
1543
1652
  }
1544
1653
 
1545
- private static bucketThreshold = 100;
1546
- private static sparseIterationThreshold = 250000;
1654
+ // These should be module constants but they are modified by layout tests.
1655
+ static bucketThreshold = 100;
1656
+ static sparseIterationThreshold = 250000;
1547
1657
  }
1548
1658
 
1549
1659
  export class ObjectPropertyPrompt extends UI.TextPrompt.TextPrompt {
@@ -1614,12 +1724,8 @@ export class ObjectPropertiesSectionsTreeExpandController {
1614
1724
  let result;
1615
1725
  while (current !== rootElement) {
1616
1726
  let currentName = '';
1617
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1618
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1619
- if ((current as any).property) {
1620
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1621
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1622
- currentName = (current as any).property.name;
1727
+ if (current instanceof ObjectPropertyTreeElement) {
1728
+ currentName = current.property.name;
1623
1729
  } else {
1624
1730
  currentName = typeof current.title === 'string' ? current.title : current.title.textContent || '';
1625
1731
  }