chrome-devtools-frontend 1.0.1538310 → 1.0.1539728
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.
- package/eslint.config.mjs +1 -1
- package/front_end/core/protocol_client/CDPConnection.ts +12 -10
- package/front_end/core/protocol_client/InspectorBackend.ts +74 -101
- package/front_end/core/protocol_client/NodeURL.ts +1 -3
- package/front_end/core/sdk/ChildTargetManager.ts +5 -41
- package/front_end/core/sdk/Connections.ts +9 -58
- package/front_end/core/sdk/DOMModel.ts +1 -0
- package/front_end/core/sdk/RehydratingConnection.ts +1 -1
- package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +15 -26
- package/front_end/entrypoints/node_app/{NodeConnectionsPanel.ts → app/NodeConnectionsPanel.ts} +8 -8
- package/front_end/entrypoints/node_app/{NodeMain.ts → app/NodeMain.ts} +11 -11
- package/front_end/entrypoints/node_app/app/app.ts +6 -0
- package/front_end/entrypoints/node_app/node_app.ts +4 -2
- package/front_end/generated/{InspectorBackendCommands.js → InspectorBackendCommands.ts} +16 -34
- package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +18 -3
- package/front_end/models/trace/types/TraceEvents.ts +19 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +49 -26
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -1
- package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +1 -134
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +170 -0
- package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
- package/front_end/panels/ai_assistance/components/chatView.css +0 -31
- package/front_end/panels/ai_assistance/components/disabledWidget.css +45 -0
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/application/components/FrameDetailsView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +123 -95
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
- package/front_end/panels/elements/NodeStackTraceWidget.ts +8 -2
- package/front_end/panels/explain/components/ConsoleInsight.ts +0 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +57 -33
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +12 -5
- package/front_end/panels/network/RequestInitiatorView.ts +1 -1
- package/front_end/panels/network/components/EditableSpan.ts +1 -1
- package/front_end/panels/recorder/components/StepView.ts +1 -1
- package/front_end/panels/recorder/models/RecordingPlayer.ts +8 -7
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +4 -4
- package/front_end/panels/timeline/TimelineFlameChartView.ts +10 -10
- package/front_end/panels/timeline/TimelinePanel.ts +3 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +21 -24
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +3 -2
- package/front_end/panels/utils/utils.ts +4 -2
- package/front_end/services/puppeteer/PuppeteerConnection.ts +56 -53
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +26 -9
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +9 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.d.ts +6 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.js +11 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +7 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +10 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +9 -3
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +37 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +26 -9
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +9 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.d.ts +6 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.js +11 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +7 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +10 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +9 -3
- package/front_end/third_party/puppeteer/package/package.json +3 -3
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +4 -2
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +8 -1
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +34 -10
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +13 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -2
- package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +4 -0
- package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/CdpSession.ts +2 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +15 -1
- package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +7 -5
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +8 -0
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +22 -1
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/switch/Switch.docs.ts +38 -0
- package/front_end/ui/components/tooltips/Tooltip.ts +69 -45
- package/front_end/ui/legacy/Slider.docs.ts +49 -0
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +77 -5
- package/front_end/ui/legacy/components/utils/Linkifier.ts +62 -3
- package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
- package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/src/templates/version.ts.tmpl +0 -4
- package/front_end/ui/components/docs/color_swatch/basic.html +0 -32
- package/front_end/ui/components/docs/color_swatch/basic.ts +0 -38
- package/front_end/ui/components/docs/color_swatch/change-color.html +0 -24
- package/front_end/ui/components/docs/color_swatch/change-color.ts +0 -28
- package/front_end/ui/components/docs/computed_style_property/basic.html +0 -25
- package/front_end/ui/components/docs/computed_style_property/basic.ts +0 -19
- package/front_end/ui/components/docs/computed_style_property/traceable.html +0 -25
- package/front_end/ui/components/docs/computed_style_property/traceable.ts +0 -16
- package/front_end/ui/components/docs/computed_style_trace/basic.html +0 -25
- package/front_end/ui/components/docs/computed_style_trace/basic.ts +0 -24
- package/front_end/ui/components/docs/console_insight/basic.html +0 -28
- package/front_end/ui/components/docs/console_insight/basic.ts +0 -103
- package/front_end/ui/components/docs/console_insight/error.html +0 -28
- package/front_end/ui/components/docs/console_insight/error.ts +0 -33
- package/front_end/ui/components/docs/console_insight/loading.html +0 -28
- package/front_end/ui/components/docs/console_insight/loading.ts +0 -47
- package/front_end/ui/components/docs/elements_breadcrumbs/basic.html +0 -43
- package/front_end/ui/components/docs/elements_breadcrumbs/basic.ts +0 -54
- package/front_end/ui/components/docs/elements_breadcrumbs/helpers.ts +0 -29
- package/front_end/ui/components/docs/elements_breadcrumbs/scroll-to-active-element.html +0 -38
- package/front_end/ui/components/docs/elements_breadcrumbs/scroll-to-active-element.ts +0 -90
- package/front_end/ui/components/docs/elements_breadcrumbs/scroll.html +0 -29
- package/front_end/ui/components/docs/elements_breadcrumbs/scroll.ts +0 -62
- package/front_end/ui/components/docs/icon_button/basic.html +0 -34
- package/front_end/ui/components/docs/icon_button/basic.ts +0 -67
- package/front_end/ui/components/docs/issue_counter/basic.html +0 -35
- package/front_end/ui/components/docs/issue_counter/basic.ts +0 -34
- package/front_end/ui/components/docs/issue_link_icon/basic.html +0 -31
- package/front_end/ui/components/docs/issue_link_icon/basic.ts +0 -26
- package/front_end/ui/components/docs/linear_memory_inspector/basic.html +0 -26
- package/front_end/ui/components/docs/linear_memory_inspector/basic.ts +0 -44
- package/front_end/ui/components/docs/menu/basic.html +0 -28
- package/front_end/ui/components/docs/menu/basic.ts +0 -66
- package/front_end/ui/components/docs/recorder_control_button/basic.html +0 -20
- package/front_end/ui/components/docs/recorder_control_button/basic.ts +0 -15
- package/front_end/ui/components/docs/recorder_recording_list_view/basic.html +0 -20
- package/front_end/ui/components/docs/recorder_recording_list_view/basic.ts +0 -26
- package/front_end/ui/components/docs/recorder_select_button/basic.html +0 -20
- package/front_end/ui/components/docs/recorder_select_button/basic.ts +0 -81
- package/front_end/ui/components/docs/recorder_split_view/basic.html +0 -17
- package/front_end/ui/components/docs/recorder_split_view/basic.ts +0 -22
- package/front_end/ui/components/docs/request_link_icon/basic.html +0 -31
- package/front_end/ui/components/docs/request_link_icon/basic.ts +0 -21
- package/front_end/ui/components/docs/slider/basic.ts +0 -62
- package/front_end/ui/components/docs/style_property_editor/flex.html +0 -21
- package/front_end/ui/components/docs/style_property_editor/flex.ts +0 -52
- package/front_end/ui/components/docs/style_property_editor/grid.html +0 -22
- package/front_end/ui/components/docs/style_property_editor/grid.ts +0 -50
- package/front_end/ui/components/docs/style_property_editor/masonry.html +0 -21
- package/front_end/ui/components/docs/style_property_editor/masonry.ts +0 -50
- package/front_end/ui/components/docs/switch/basic.ts +0 -51
- /package/front_end/entrypoints/node_app/{nodeConnectionsPanel.css → app/nodeConnectionsPanel.css} +0 -0
package/eslint.config.mjs
CHANGED
|
@@ -30,7 +30,7 @@ export default defineConfig([
|
|
|
30
30
|
// All of these scripts are auto-generated so don't lint them.
|
|
31
31
|
'front_end/generated/ARIAProperties.js',
|
|
32
32
|
'front_end/generated/Deprecation.ts',
|
|
33
|
-
'front_end/generated/InspectorBackendCommands.
|
|
33
|
+
'front_end/generated/InspectorBackendCommands.ts',
|
|
34
34
|
'front_end/generated/protocol-mapping.d.ts',
|
|
35
35
|
'front_end/generated/protocol-proxy-api.d.ts',
|
|
36
36
|
'front_end/generated/protocol.ts',
|
|
@@ -4,26 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import type {ProtocolMapping} from '../../generated/protocol-mapping.js';
|
|
6
6
|
|
|
7
|
+
export type Command = keyof ProtocolMapping.Commands;
|
|
7
8
|
export type CommandParams<T extends keyof ProtocolMapping.Commands> = ProtocolMapping.Commands[T]['paramsType'][0];
|
|
8
9
|
export type CommandResult<T extends keyof ProtocolMapping.Commands> = ProtocolMapping.Commands[T]['returnType'];
|
|
10
|
+
export type Event = keyof ProtocolMapping.Events;
|
|
9
11
|
export type EventParams<T extends keyof ProtocolMapping.Events> = ProtocolMapping.Events[T];
|
|
10
12
|
|
|
11
13
|
export interface CDPBaseMessage {
|
|
12
14
|
sessionId?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export interface CDPCommandRequest<T extends
|
|
17
|
+
export interface CDPCommandRequest<T extends Command> extends CDPBaseMessage {
|
|
16
18
|
id: number;
|
|
17
19
|
method: T;
|
|
18
20
|
params: CommandParams<T>;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
export interface CDPCommandResponse<T extends
|
|
23
|
+
export interface CDPCommandResponse<T extends Command> extends CDPBaseMessage {
|
|
22
24
|
id: number;
|
|
23
25
|
result: CommandResult<T>;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export interface CDPEvent<T extends
|
|
28
|
+
export interface CDPEvent<T extends Event> extends CDPBaseMessage {
|
|
27
29
|
method: T;
|
|
28
30
|
params: EventParams<T>;
|
|
29
31
|
}
|
|
@@ -31,7 +33,7 @@ export interface CDPEvent<T extends keyof ProtocolMapping.Events> extends CDPBas
|
|
|
31
33
|
/**
|
|
32
34
|
* Keep this in sync with https://source.chromium.org/chromium/chromium/src/+/main:third_party/inspector_protocol/crdtp/dispatch.h.
|
|
33
35
|
*/
|
|
34
|
-
export
|
|
36
|
+
export enum CDPErrorStatus {
|
|
35
37
|
PARSE_ERROR = -32700,
|
|
36
38
|
INVALID_REQUEST = -32600,
|
|
37
39
|
METHOD_NOT_FOUND = -32601,
|
|
@@ -39,6 +41,7 @@ export const enum CDPErrorStatus {
|
|
|
39
41
|
INTERNAL_ERROR = -32603,
|
|
40
42
|
SERVER_ERROR = -32000,
|
|
41
43
|
SESSION_NOT_FOUND = SERVER_ERROR - 1,
|
|
44
|
+
DEVTOOLS_STUB_ERROR = -32015,
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
export interface CDPError {
|
|
@@ -52,8 +55,7 @@ export interface CDPErrorMessage extends CDPBaseMessage {
|
|
|
52
55
|
error: CDPError;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent<any>|CDPErrorMessage;
|
|
58
|
+
export type CDPReceivableMessage = CDPCommandResponse<Command>|CDPEvent<Event>|CDPErrorMessage;
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* Allows the sending and receiving of CDP commands and the notification of CDP events to observers.
|
|
@@ -63,7 +65,7 @@ export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent
|
|
|
63
65
|
* would conflict with any other shared traffic.
|
|
64
66
|
*/
|
|
65
67
|
export interface CDPConnection {
|
|
66
|
-
send<T extends
|
|
68
|
+
send<T extends Command>(method: T, params: CommandParams<T>, sessionId: string|undefined):
|
|
67
69
|
Promise<{result: CommandResult<T>}|{error: CDPError}>;
|
|
68
70
|
|
|
69
71
|
observe(observer: CDPConnectionObserver): void;
|
|
@@ -71,7 +73,7 @@ export interface CDPConnection {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export interface CDPConnectionObserver {
|
|
74
|
-
onEvent<T extends
|
|
76
|
+
onEvent<T extends Event>(event: CDPEvent<T>): void;
|
|
75
77
|
onDisconnect(reason: string): void;
|
|
76
78
|
}
|
|
77
79
|
|
|
@@ -84,6 +86,6 @@ export interface DebuggableCDPConnection extends CDPConnection {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
export interface RawMessageObserver {
|
|
87
|
-
onMessageReceived(message:
|
|
88
|
-
onMessageSent(message:
|
|
89
|
+
onMessageReceived(message: CDPReceivableMessage): void;
|
|
90
|
+
onMessageSent(message: CDPCommandRequest<Command>): void;
|
|
89
91
|
}
|
|
@@ -7,15 +7,20 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
|
7
7
|
import type * as Protocol from '../../generated/protocol.js';
|
|
8
8
|
import type * as Platform from '../platform/platform.js';
|
|
9
9
|
|
|
10
|
+
import {
|
|
11
|
+
type CDPCommandRequest,
|
|
12
|
+
type CDPConnection,
|
|
13
|
+
type CDPConnectionObserver,
|
|
14
|
+
type CDPError,
|
|
15
|
+
CDPErrorStatus,
|
|
16
|
+
type CDPReceivableMessage,
|
|
17
|
+
type Command,
|
|
18
|
+
type CommandParams,
|
|
19
|
+
type CommandResult
|
|
20
|
+
} from './CDPConnection.js';
|
|
10
21
|
import {ConnectionTransport} from './ConnectionTransport.js';
|
|
11
22
|
import {NodeURL} from './NodeURL.js';
|
|
12
23
|
|
|
13
|
-
export const DevToolsStubErrorCode = -32015;
|
|
14
|
-
// TODO(dgozman): we are not reporting generic errors in tests, but we should
|
|
15
|
-
// instead report them and just have some expected errors in test expectations.
|
|
16
|
-
const GenericErrorCode = -32000;
|
|
17
|
-
const ConnectionClosedErrorCode = -32001;
|
|
18
|
-
|
|
19
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
25
|
type MessageParams = Record<string, any>;
|
|
21
26
|
|
|
@@ -59,25 +64,17 @@ export const qualifyName = (domain: string, name: UnqualifiedName): QualifiedNam
|
|
|
59
64
|
type EventParameterNames = Map<QualifiedName, string[]>;
|
|
60
65
|
type ReadonlyEventParameterNames = ReadonlyMap<QualifiedName, string[]>;
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
name: string;
|
|
64
|
-
type: string;
|
|
65
|
-
optional: boolean;
|
|
66
|
-
description: string;
|
|
67
|
-
}
|
|
67
|
+
type CommandParameter = InspectorBackendCommands.CommandParameter;
|
|
68
68
|
|
|
69
69
|
type Callback = (error: MessageError|null, arg1: Object|null) => void;
|
|
70
|
-
interface ResponseWithError {
|
|
71
|
-
error: MessageError|null;
|
|
72
|
-
result: Object|null;
|
|
73
|
-
}
|
|
74
70
|
|
|
75
71
|
interface CallbackWithDebugInfo {
|
|
76
|
-
resolve: (response:
|
|
72
|
+
resolve: (response: Awaited<ReturnType<CDPConnection['send']>>) => void;
|
|
77
73
|
method: string;
|
|
74
|
+
sessionId: string|undefined;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
export class InspectorBackend {
|
|
77
|
+
export class InspectorBackend implements InspectorBackendCommands.InspectorBackendAPI {
|
|
81
78
|
readonly agentPrototypes = new Map<ProtocolDomainName, AgentPrototype>();
|
|
82
79
|
#eventParameterNamesForDomain = new Map<ProtocolDomainName, EventParameterNames>();
|
|
83
80
|
readonly typeMap = new Map<QualifiedName, CommandParameter[]>();
|
|
@@ -197,17 +194,17 @@ export const test = {
|
|
|
197
194
|
|
|
198
195
|
const LongPollingMethods = new Set<string>(['CSS.takeComputedStyleUpdates']);
|
|
199
196
|
|
|
200
|
-
export class SessionRouter {
|
|
197
|
+
export class SessionRouter implements CDPConnection {
|
|
201
198
|
readonly #connection: ConnectionTransport;
|
|
202
199
|
#lastMessageId = 1;
|
|
203
200
|
#pendingResponsesCount = 0;
|
|
204
201
|
readonly #pendingLongPollingMessageIds = new Set<number>();
|
|
205
202
|
readonly #sessions = new Map<string, {
|
|
206
203
|
target: TargetBase,
|
|
207
|
-
callbacks: Map<number, CallbackWithDebugInfo>,
|
|
208
|
-
proxyConnection: ConnectionTransport|undefined|null,
|
|
209
204
|
}>();
|
|
210
205
|
#pendingScripts: Array<() => void> = [];
|
|
206
|
+
readonly #callbacks = new Map<number, CallbackWithDebugInfo>();
|
|
207
|
+
readonly #observers = new Set<CDPConnectionObserver>();
|
|
211
208
|
|
|
212
209
|
constructor(connection: ConnectionTransport) {
|
|
213
210
|
this.#connection = connection;
|
|
@@ -222,22 +219,20 @@ export class SessionRouter {
|
|
|
222
219
|
if (session) {
|
|
223
220
|
session.target.dispose(reason);
|
|
224
221
|
}
|
|
222
|
+
this.#observers.forEach(observer => observer.onDisconnect(reason));
|
|
225
223
|
});
|
|
226
224
|
}
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (proxyConnection) {
|
|
232
|
-
for (const session of this.#sessions.values()) {
|
|
233
|
-
if (session.proxyConnection) {
|
|
234
|
-
console.error('Multiple simultaneous proxy connections are currently unsupported');
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
226
|
+
observe(observer: CDPConnectionObserver): void {
|
|
227
|
+
this.#observers.add(observer);
|
|
228
|
+
}
|
|
239
229
|
|
|
240
|
-
|
|
230
|
+
unobserve(observer: CDPConnectionObserver): void {
|
|
231
|
+
this.#observers.delete(observer);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
registerSession(target: TargetBase, sessionId: string): void {
|
|
235
|
+
this.#sessions.set(sessionId, {target});
|
|
241
236
|
}
|
|
242
237
|
|
|
243
238
|
unregisterSession(sessionId: string): void {
|
|
@@ -245,13 +240,14 @@ export class SessionRouter {
|
|
|
245
240
|
if (!session) {
|
|
246
241
|
return;
|
|
247
242
|
}
|
|
248
|
-
for (const {resolve, method} of
|
|
243
|
+
for (const {resolve, method, sessionId: callbackSessionId} of this.#callbacks.values()) {
|
|
244
|
+
if (sessionId !== callbackSessionId) {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
249
247
|
resolve({
|
|
250
|
-
result: null,
|
|
251
248
|
error: {
|
|
252
249
|
message: `Session is unregistering, can\'t dispatch pending call to ${method}`,
|
|
253
|
-
code:
|
|
254
|
-
data: null,
|
|
250
|
+
code: CDPErrorStatus.SESSION_NOT_FOUND,
|
|
255
251
|
}
|
|
256
252
|
});
|
|
257
253
|
}
|
|
@@ -266,10 +262,10 @@ export class SessionRouter {
|
|
|
266
262
|
return this.#connection;
|
|
267
263
|
}
|
|
268
264
|
|
|
269
|
-
|
|
270
|
-
Promise<
|
|
265
|
+
send<T extends Command>(method: T, params: CommandParams<T>, sessionId: string|undefined):
|
|
266
|
+
Promise<{result: CommandResult<T>}|{error: CDPError}> {
|
|
271
267
|
const messageId = this.nextMessageId();
|
|
272
|
-
const messageObject:
|
|
268
|
+
const messageObject: Partial<CDPCommandRequest<T>> = {
|
|
273
269
|
id: messageId,
|
|
274
270
|
method,
|
|
275
271
|
};
|
|
@@ -286,6 +282,7 @@ export class SessionRouter {
|
|
|
286
282
|
}
|
|
287
283
|
|
|
288
284
|
if (test.onMessageSent) {
|
|
285
|
+
const domain = method.split('.')[0];
|
|
289
286
|
const paramsObject = JSON.parse(JSON.stringify(params || {}));
|
|
290
287
|
test.onMessageSent({domain, method, params: (paramsObject as Object), id: messageId, sessionId});
|
|
291
288
|
}
|
|
@@ -295,21 +292,21 @@ export class SessionRouter {
|
|
|
295
292
|
this.#pendingLongPollingMessageIds.add(messageId);
|
|
296
293
|
}
|
|
297
294
|
|
|
298
|
-
const session = this.#sessions.get(sessionId);
|
|
299
|
-
if (!session) {
|
|
300
|
-
return Promise.resolve({error: null, result: null});
|
|
301
|
-
}
|
|
302
|
-
|
|
303
295
|
return new Promise(resolve => {
|
|
304
|
-
|
|
296
|
+
this.#callbacks.set(messageId, {resolve, method, sessionId});
|
|
305
297
|
this.#connection.sendRawMessage(JSON.stringify(messageObject));
|
|
306
298
|
});
|
|
307
299
|
}
|
|
308
300
|
|
|
309
301
|
private sendRawMessageForTesting(method: QualifiedName, params: Object|null, callback: Callback|null, sessionId = ''):
|
|
310
302
|
void {
|
|
311
|
-
|
|
312
|
-
|
|
303
|
+
void this.send(method as Command, params as CommandParams<Command>, sessionId).then(response => {
|
|
304
|
+
if ('error' in response && response.error) {
|
|
305
|
+
callback?.(response.error, null);
|
|
306
|
+
} else if ('result' in response) {
|
|
307
|
+
callback?.(null, response.result as Object | null);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
313
310
|
}
|
|
314
311
|
|
|
315
312
|
private onMessage(message: string|Object): void {
|
|
@@ -322,71 +319,36 @@ export class SessionRouter {
|
|
|
322
319
|
test.onMessageReceived(messageObjectCopy);
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
const messageObject = ((typeof message === 'string') ? JSON.parse(message) : message) as
|
|
326
|
-
|
|
327
|
-
// Send all messages to proxy connections.
|
|
328
|
-
let suppressUnknownMessageErrors = false;
|
|
329
|
-
for (const session of this.#sessions.values()) {
|
|
330
|
-
if (!session.proxyConnection) {
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (!session.proxyConnection.onMessage) {
|
|
335
|
-
InspectorBackend.reportProtocolError(
|
|
336
|
-
'Protocol Error: the session has a proxyConnection with no _onMessage', messageObject);
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
session.proxyConnection.onMessage(messageObject);
|
|
341
|
-
suppressUnknownMessageErrors = true;
|
|
342
|
-
}
|
|
322
|
+
const messageObject = ((typeof message === 'string') ? JSON.parse(message) : message) as CDPReceivableMessage;
|
|
343
323
|
|
|
344
324
|
const sessionId = messageObject.sessionId || '';
|
|
345
325
|
const session = this.#sessions.get(sessionId);
|
|
346
|
-
if (!session) {
|
|
347
|
-
// In the DevTools MCP case, we may share the transport with puppeteer so we silently
|
|
348
|
-
// ignore unknown sessions.
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// If this message is directly for the target controlled by the proxy connection, don't handle it.
|
|
353
|
-
if (session.proxyConnection) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
326
|
|
|
357
|
-
if (session
|
|
327
|
+
if (session?.target.getNeedsNodeJSPatching()) {
|
|
358
328
|
NodeURL.patch(messageObject);
|
|
359
329
|
}
|
|
360
330
|
|
|
361
|
-
if (messageObject.id !== undefined) { // just a response for some request
|
|
362
|
-
const callback =
|
|
363
|
-
|
|
331
|
+
if ('id' in messageObject && messageObject.id !== undefined) { // just a response for some request
|
|
332
|
+
const callback = this.#callbacks.get(messageObject.id);
|
|
333
|
+
this.#callbacks.delete(messageObject.id);
|
|
364
334
|
if (!callback) {
|
|
365
|
-
|
|
366
|
-
// Ignore the errors that are sent as responses after the session closes.
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (!suppressUnknownMessageErrors) {
|
|
370
|
-
InspectorBackend.reportProtocolError('Protocol Error: the message with wrong id', messageObject);
|
|
371
|
-
}
|
|
335
|
+
// Ignore messages with unknown IDs, we might see puppeteer proxied messages here.
|
|
372
336
|
return;
|
|
373
337
|
}
|
|
374
338
|
|
|
375
|
-
callback.resolve(
|
|
339
|
+
callback.resolve(messageObject);
|
|
376
340
|
--this.#pendingResponsesCount;
|
|
377
341
|
this.#pendingLongPollingMessageIds.delete(messageObject.id);
|
|
378
342
|
|
|
379
343
|
if (this.#pendingScripts.length && !this.hasOutstandingNonLongPollingRequests()) {
|
|
380
344
|
this.deprecatedRunAfterPendingDispatches();
|
|
381
345
|
}
|
|
382
|
-
} else {
|
|
383
|
-
if (messageObject.method === undefined) {
|
|
384
|
-
InspectorBackend.reportProtocolError('Protocol Error: the message without method', messageObject);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
346
|
+
} else if ('method' in messageObject) {
|
|
387
347
|
// This cast is justified as we just checked for the presence of messageObject.method.
|
|
388
|
-
|
|
389
|
-
|
|
348
|
+
session?.target.dispatch(messageObject as unknown as EventMessage);
|
|
349
|
+
this.#observers.forEach(observer => observer.onEvent(messageObject));
|
|
350
|
+
} else {
|
|
351
|
+
InspectorBackend.reportProtocolError('Protocol Error: the message without method', messageObject);
|
|
390
352
|
}
|
|
391
353
|
}
|
|
392
354
|
|
|
@@ -842,6 +804,13 @@ export class TargetBase {
|
|
|
842
804
|
}
|
|
843
805
|
}
|
|
844
806
|
|
|
807
|
+
/** These are not logged as console.error */
|
|
808
|
+
const IGNORED_ERRORS = new Set<CDPErrorStatus>([
|
|
809
|
+
CDPErrorStatus.DEVTOOLS_STUB_ERROR,
|
|
810
|
+
CDPErrorStatus.SERVER_ERROR,
|
|
811
|
+
CDPErrorStatus.SESSION_NOT_FOUND,
|
|
812
|
+
]);
|
|
813
|
+
|
|
845
814
|
/**
|
|
846
815
|
* This is a class that serves as the prototype for a domains #agents (every target
|
|
847
816
|
* has it's own set of #agents). The InspectorBackend keeps an instance of this class
|
|
@@ -881,14 +850,18 @@ class AgentPrototype {
|
|
|
881
850
|
{result: null, getError: () => `Connection is closed, can\'t dispatch pending call to ${method}`});
|
|
882
851
|
}
|
|
883
852
|
|
|
884
|
-
return router.
|
|
885
|
-
if (error
|
|
886
|
-
|
|
887
|
-
|
|
853
|
+
return router.send(method as Command, request as CommandParams<Command>, this.target.sessionId).then(response => {
|
|
854
|
+
if ('error' in response && response.error) {
|
|
855
|
+
if (!test.suppressRequestErrors && !IGNORED_ERRORS.has(response.error.code)) {
|
|
856
|
+
console.error('Request ' + method + ' failed. ' + JSON.stringify(response.error));
|
|
857
|
+
}
|
|
858
|
+
return {getError: () => response.error.message};
|
|
888
859
|
}
|
|
889
860
|
|
|
890
|
-
|
|
891
|
-
|
|
861
|
+
if ('result' in response) {
|
|
862
|
+
return {...response.result, getError: () => undefined};
|
|
863
|
+
}
|
|
864
|
+
return {getError: () => undefined};
|
|
892
865
|
});
|
|
893
866
|
}
|
|
894
867
|
}
|
|
@@ -7,9 +7,7 @@ import * as Host from '../host/host.js';
|
|
|
7
7
|
import type * as Platform from '../platform/platform.js';
|
|
8
8
|
|
|
9
9
|
export class NodeURL {
|
|
10
|
-
static patch(object: {
|
|
11
|
-
url?: string,
|
|
12
|
-
}): void {
|
|
10
|
+
static patch(object: object): void {
|
|
13
11
|
process(object, '');
|
|
14
12
|
|
|
15
13
|
function process(object: {url?: string}, path: string): void {
|
|
@@ -7,9 +7,7 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
|
7
7
|
import type * as Protocol from '../../generated/protocol.js';
|
|
8
8
|
import * as Common from '../common/common.js';
|
|
9
9
|
import * as Host from '../host/host.js';
|
|
10
|
-
import type * as ProtocolClient from '../protocol_client/protocol_client.js';
|
|
11
10
|
|
|
12
|
-
import {ParallelConnection} from './Connections.js';
|
|
13
11
|
import {PrimaryPageChangeType, ResourceTreeModel} from './ResourceTreeModel.js';
|
|
14
12
|
import {SDKModel} from './SDKModel.js';
|
|
15
13
|
import {SecurityOriginManager} from './SecurityOriginManager.js';
|
|
@@ -36,7 +34,6 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
36
34
|
readonly #targetInfos = new Map<Protocol.Target.TargetID, Protocol.Target.TargetInfo>();
|
|
37
35
|
readonly #childTargetsBySessionId = new Map<Protocol.Target.SessionID, Target>();
|
|
38
36
|
readonly #childTargetsById = new Map<Protocol.Target.TargetID|'main', Target>();
|
|
39
|
-
readonly #parallelConnections = new Map<string, ProtocolClient.ConnectionTransport.ConnectionTransport>();
|
|
40
37
|
#parentTargetId: Protocol.Target.TargetID|null = null;
|
|
41
38
|
|
|
42
39
|
constructor(parentTarget: Target) {
|
|
@@ -244,15 +241,11 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
244
241
|
}
|
|
245
242
|
|
|
246
243
|
detachedFromTarget({sessionId}: Protocol.Target.DetachedFromTargetEvent): void {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
target.dispose('target terminated');
|
|
253
|
-
this.#childTargetsBySessionId.delete(sessionId);
|
|
254
|
-
this.#childTargetsById.delete(target.id());
|
|
255
|
-
}
|
|
244
|
+
const target = this.#childTargetsBySessionId.get(sessionId);
|
|
245
|
+
if (target) {
|
|
246
|
+
target.dispose('target terminated');
|
|
247
|
+
this.#childTargetsBySessionId.delete(sessionId);
|
|
248
|
+
this.#childTargetsById.delete(target.id());
|
|
256
249
|
}
|
|
257
250
|
}
|
|
258
251
|
|
|
@@ -260,35 +253,6 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
260
253
|
// We use flatten protocol.
|
|
261
254
|
}
|
|
262
255
|
|
|
263
|
-
async createParallelConnection(onMessage: (arg0: Object|string) => void):
|
|
264
|
-
Promise<{connection: ProtocolClient.ConnectionTransport.ConnectionTransport, sessionId: string}> {
|
|
265
|
-
// The main Target id is actually just `main`, instead of the real targetId.
|
|
266
|
-
// Get the real id (requires an async operation) so that it can be used synchronously later.
|
|
267
|
-
const targetId = await this.getParentTargetId();
|
|
268
|
-
const {connection, sessionId} =
|
|
269
|
-
await this.createParallelConnectionAndSessionForTarget(this.#parentTarget, targetId);
|
|
270
|
-
connection.setOnMessage(onMessage);
|
|
271
|
-
this.#parallelConnections.set(sessionId, connection);
|
|
272
|
-
return {connection, sessionId};
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
private async createParallelConnectionAndSessionForTarget(target: Target, targetId: Protocol.Target.TargetID):
|
|
276
|
-
Promise<{
|
|
277
|
-
connection: ProtocolClient.ConnectionTransport.ConnectionTransport,
|
|
278
|
-
sessionId: string,
|
|
279
|
-
}> {
|
|
280
|
-
const targetAgent = target.targetAgent();
|
|
281
|
-
const targetRouter = (target.router() as ProtocolClient.InspectorBackend.SessionRouter);
|
|
282
|
-
const sessionId = (await targetAgent.invoke_attachToTarget({targetId, flatten: true})).sessionId;
|
|
283
|
-
const connection = new ParallelConnection(targetRouter.connection(), sessionId);
|
|
284
|
-
targetRouter.registerSession(target, sessionId, connection);
|
|
285
|
-
connection.setOnDisconnect(() => {
|
|
286
|
-
targetRouter.unregisterSession(sessionId);
|
|
287
|
-
void targetAgent.invoke_detachFromTarget({sessionId});
|
|
288
|
-
});
|
|
289
|
-
return {connection, sessionId};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
256
|
targetInfos(): Protocol.Target.TargetInfo[] {
|
|
293
257
|
return Array.from(this.#targetInfos.values());
|
|
294
258
|
}
|
|
@@ -9,7 +9,7 @@ import type * as Platform from '../platform/platform.js';
|
|
|
9
9
|
import * as ProtocolClient from '../protocol_client/protocol_client.js';
|
|
10
10
|
import * as Root from '../root/root.js';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {RehydratingConnectionTransport} from './RehydratingConnection.js';
|
|
13
13
|
|
|
14
14
|
const UIStrings = {
|
|
15
15
|
/**
|
|
@@ -81,7 +81,7 @@ export class MainConnection implements ProtocolClient.ConnectionTransport.Connec
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export class
|
|
84
|
+
export class WebSocketTransport implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
85
85
|
#socket: WebSocket|null;
|
|
86
86
|
onMessage: ((arg0: Object|string) => void)|null = null;
|
|
87
87
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
@@ -176,7 +176,7 @@ export class WebSocketConnection implements ProtocolClient.ConnectionTransport.C
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
export class
|
|
179
|
+
export class StubTransport implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
180
180
|
onMessage: ((arg0: Object|string) => void)|null = null;
|
|
181
181
|
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
182
182
|
|
|
@@ -196,7 +196,7 @@ export class StubConnection implements ProtocolClient.ConnectionTransport.Connec
|
|
|
196
196
|
const messageObject = JSON.parse(message);
|
|
197
197
|
const error = {
|
|
198
198
|
message: 'This is a stub connection, can\'t dispatch message.',
|
|
199
|
-
code: ProtocolClient.
|
|
199
|
+
code: ProtocolClient.CDPConnection.CDPErrorStatus.DEVTOOLS_STUB_ERROR,
|
|
200
200
|
data: messageObject,
|
|
201
201
|
};
|
|
202
202
|
if (this.onMessage) {
|
|
@@ -213,80 +213,31 @@ export class StubConnection implements ProtocolClient.ConnectionTransport.Connec
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
export interface ParallelConnectionInterface extends ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
217
|
-
getSessionId: () => string;
|
|
218
|
-
getOnDisconnect: () => ((arg0: string) => void) | null;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export class ParallelConnection implements ParallelConnectionInterface {
|
|
222
|
-
readonly #connection: ProtocolClient.ConnectionTransport.ConnectionTransport;
|
|
223
|
-
#sessionId: string;
|
|
224
|
-
onMessage: ((arg0: Object) => void)|null = null;
|
|
225
|
-
#onDisconnect: ((arg0: string) => void)|null = null;
|
|
226
|
-
constructor(connection: ProtocolClient.ConnectionTransport.ConnectionTransport, sessionId: string) {
|
|
227
|
-
this.#connection = connection;
|
|
228
|
-
this.#sessionId = sessionId;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
setOnMessage(onMessage: (arg0: Object) => void): void {
|
|
232
|
-
this.onMessage = onMessage;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
setOnDisconnect(onDisconnect: (arg0: string) => void): void {
|
|
236
|
-
this.#onDisconnect = onDisconnect;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
getOnDisconnect(): ((arg0: string) => void)|null {
|
|
240
|
-
return this.#onDisconnect;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
sendRawMessage(message: string): void {
|
|
244
|
-
const messageObject = JSON.parse(message);
|
|
245
|
-
// If the message isn't for a specific session, it must be for the root session.
|
|
246
|
-
if (!messageObject.sessionId) {
|
|
247
|
-
messageObject.sessionId = this.#sessionId;
|
|
248
|
-
}
|
|
249
|
-
this.#connection.sendRawMessage(JSON.stringify(messageObject));
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
getSessionId(): string {
|
|
253
|
-
return this.#sessionId;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async disconnect(): Promise<void> {
|
|
257
|
-
if (this.#onDisconnect) {
|
|
258
|
-
this.#onDisconnect.call(null, 'force disconnect');
|
|
259
|
-
}
|
|
260
|
-
this.#onDisconnect = null;
|
|
261
|
-
this.onMessage = null;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
216
|
export async function initMainConnection(
|
|
266
217
|
createRootTarget: () => Promise<void>,
|
|
267
218
|
onConnectionLost: (message: Platform.UIString.LocalizedString) => void): Promise<void> {
|
|
268
|
-
ProtocolClient.ConnectionTransport.ConnectionTransport.setFactory(
|
|
219
|
+
ProtocolClient.ConnectionTransport.ConnectionTransport.setFactory(createMainTransport.bind(null, onConnectionLost));
|
|
269
220
|
await createRootTarget();
|
|
270
221
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.connectionReady();
|
|
271
222
|
}
|
|
272
223
|
|
|
273
|
-
function
|
|
224
|
+
function createMainTransport(onConnectionLost: (message: Platform.UIString.LocalizedString) => void):
|
|
274
225
|
ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
275
226
|
if (Root.Runtime.Runtime.isTraceApp()) {
|
|
276
|
-
return new
|
|
227
|
+
return new RehydratingConnectionTransport(onConnectionLost);
|
|
277
228
|
}
|
|
278
229
|
|
|
279
230
|
const wsParam = Root.Runtime.Runtime.queryParam('ws');
|
|
280
231
|
const wssParam = Root.Runtime.Runtime.queryParam('wss');
|
|
281
232
|
if (wsParam || wssParam) {
|
|
282
233
|
const ws = (wsParam ? `ws://${wsParam}` : `wss://${wssParam}`) as Platform.DevToolsPath.UrlString;
|
|
283
|
-
return new
|
|
234
|
+
return new WebSocketTransport(ws, onConnectionLost);
|
|
284
235
|
}
|
|
285
236
|
|
|
286
237
|
const notEmbeddedOrWs = Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode();
|
|
287
238
|
if (notEmbeddedOrWs) {
|
|
288
239
|
// eg., hosted mode (e.g. `http://localhost:9222/devtools/inspector.html`) without a WebSocket URL,
|
|
289
|
-
return new
|
|
240
|
+
return new StubTransport();
|
|
290
241
|
}
|
|
291
242
|
|
|
292
243
|
return new MainConnection();
|
|
@@ -632,6 +632,7 @@ export class DOMNode {
|
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
async getSubtree(depth: number, pierce: boolean): Promise<DOMNode[]|null> {
|
|
635
|
+
console.assert(depth > 0, 'Do not fetch an infinite subtree to avoid crashing the renderer for large documents');
|
|
635
636
|
const response = await this.#agent.invoke_requestChildNodes({nodeId: this.id, depth, pierce});
|
|
636
637
|
return response.getError() ? null : this.childrenInternal;
|
|
637
638
|
}
|
|
@@ -63,7 +63,7 @@ export const enum RehydratingConnectionState {
|
|
|
63
63
|
REHYDRATED = 3,
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export class
|
|
66
|
+
export class RehydratingConnectionTransport implements ProtocolClient.ConnectionTransport.ConnectionTransport {
|
|
67
67
|
rehydratingConnectionState: RehydratingConnectionState = RehydratingConnectionState.UNINITIALIZED;
|
|
68
68
|
onDisconnect: ((arg0: string) => void)|null = null;
|
|
69
69
|
onMessage: ((arg0: Object) => void)|null = null;
|