chrome-devtools-frontend 1.0.1690531 → 1.0.1695017
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/.agents/skills/devtools-model-management/SKILL.md +3 -3
- package/.agents/skills/foundation-test-migration/SKILL.md +2 -2
- package/.agents/skills/merging-devtools-module/SKILL.md +5 -5
- package/.gitmodules +0 -4
- package/AUTHORS +3 -0
- package/config/typescript/tsconfig.base.json +1 -0
- package/docs/get_the_code.md +4 -9
- package/front_end/Images/src/comment-mode-cursor.svg +23 -0
- package/front_end/Tests.js +1 -1
- package/front_end/application_tokens.css +5 -0
- package/front_end/core/common/ColorConverter.ts +3 -3
- package/front_end/core/host/UserMetrics.ts +27 -0
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +0 -46
- package/front_end/core/protocol_client/InspectorBackend.ts +6 -6
- package/front_end/core/sdk/CSSLocation.ts +32 -0
- package/front_end/core/sdk/CSSModel.ts +2 -22
- package/front_end/core/sdk/CSSQuery.ts +2 -1
- package/front_end/core/sdk/CSSRule.ts +29 -0
- package/front_end/core/sdk/DebuggerModel.ts +5 -1
- package/front_end/core/sdk/NetworkManager.ts +2 -0
- package/front_end/core/sdk/NetworkRequest.ts +14 -1
- package/front_end/core/sdk/NetworkRequestAccess.ts +41 -22
- package/front_end/core/sdk/ResourceTreeModel.ts +72 -23
- package/front_end/core/sdk/SecurityOrigin.ts +89 -29
- package/front_end/core/sdk/Target.ts +18 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/entrypoints/main/MainImpl.ts +8 -1
- package/front_end/foundation/Universe.ts +14 -11
- package/front_end/generated/Deprecation.ts +8 -0
- package/front_end/generated/InspectorBackendCommands.ts +9 -8
- package/front_end/generated/SupportedCSSProperties.ts +13 -3
- package/front_end/generated/protocol.ts +24 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +42 -9
- package/front_end/models/ai_assistance/AiConversation.ts +6 -6
- package/front_end/models/ai_assistance/README.md +5 -3
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +28 -34
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +13 -17
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +5 -3
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +16 -10
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
- package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
- package/front_end/models/ai_assistance/contexts/AccessibilityContext.ts +11 -2
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +17 -5
- package/front_end/models/ai_assistance/contexts/FileContext.ts +13 -6
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +52 -25
- package/front_end/models/ai_assistance/contexts/RequestContext.ts +18 -34
- package/front_end/models/ai_assistance/contexts/StorageContext.ts +14 -3
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +2 -5
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +135 -58
- package/front_end/models/ai_assistance/tools/CookieUtils.ts +25 -35
- package/front_end/models/ai_assistance/tools/DOMStorageUtils.ts +6 -3
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +9 -2
- package/front_end/models/ai_assistance/tools/GetCookieValues.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +3 -2
- package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +3 -5
- package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +8 -11
- package/front_end/models/ai_assistance/tools/GetResourceContent.ts +2 -4
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +6 -13
- package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetStorageValues.ts +9 -9
- package/front_end/models/ai_assistance/tools/GetStyles.ts +3 -2
- package/front_end/models/ai_assistance/tools/ListCookies.ts +1 -1
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +6 -14
- package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +10 -15
- package/front_end/models/ai_assistance/tools/ListSources.ts +5 -7
- package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +9 -9
- package/front_end/models/ai_assistance/tools/README.md +4 -2
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +3 -2
- package/front_end/models/ai_assistance/tools/Tool.ts +27 -3
- package/front_end/models/comment_manager/CD4ABridge.ts +128 -0
- package/front_end/models/comment_manager/CommentManager.ts +50 -8
- package/front_end/models/comment_manager/comment_manager.ts +2 -0
- package/front_end/models/emulation/DeviceModeModel.ts +37 -47
- package/front_end/models/javascript_metadata/NativeFunctions.ts +9 -1
- package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
- package/front_end/models/source_map_scopes/NamesResolver.ts +9 -7
- package/front_end/models/trace/ModelImpl.ts +2 -0
- package/front_end/models/trace/Processor.ts +6 -4
- package/front_end/models/trace/handlers/LayerTreeHandler.ts +3 -3
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
- package/front_end/models/trace/helpers/SyntheticEvents.ts +23 -1
- package/front_end/models/trace/types/Configuration.ts +7 -0
- package/front_end/models/trace/types/TraceEvents.ts +20 -4
- package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -0
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +177 -0
- package/front_end/panels/accessibility/accessibility.ts +2 -0
- package/front_end/panels/accessibility/accessibilityAnnouncementRecordingListView.css +33 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -15
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -35
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +4 -3
- package/front_end/panels/animation/AnimationTimeline.ts +1 -0
- package/front_end/panels/application/CrashReportContextView.ts +0 -1
- package/front_end/panels/application/FrameDetailsView.ts +5 -4
- package/front_end/panels/application/IndexedDBViews.ts +4 -4
- package/front_end/panels/application/indexedDBViews.css +0 -14
- package/front_end/panels/console/ConsoleContextSelector.ts +12 -5
- package/front_end/panels/console/ConsoleViewMessage.ts +12 -8
- package/front_end/panels/coverage/coverageView.css +8 -8
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +4 -5
- package/front_end/panels/developer_resources/developerResourcesView.css +3 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +39 -12
- package/front_end/panels/elements/ElementsTreeOutline.ts +183 -107
- package/front_end/panels/elements/ShortcutTreeElement.ts +4 -0
- package/front_end/panels/elements/StylePropertiesSection.ts +1 -34
- package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +5 -4
- package/front_end/panels/elements/components/StylePropertyEditor.ts +1 -0
- package/front_end/panels/elements/components/computedStyleProperty.css +5 -5
- package/front_end/panels/elements/components/computedStyleTrace.css +5 -5
- package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
- package/front_end/panels/elements/components/cssPropertyDocsView.css +3 -3
- package/front_end/panels/elements/components/cssVariableValueView.css +4 -4
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +3 -3
- package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -5
- package/front_end/panels/elements/components/queryContainer.css +2 -2
- package/front_end/panels/elements/elementsTreeOutline.css +20 -4
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/issues/AffectedElementsView.ts +3 -0
- package/front_end/panels/issues/issues.ts +2 -0
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +12 -10
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +1 -0
- package/front_end/panels/layer_viewer/Layers3DView.ts +13 -11
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspectorUtils.ts +2 -2
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +11 -11
- package/front_end/panels/media/PlayerPropertiesView.ts +1 -1
- package/front_end/panels/media/TickingFlameChart.ts +3 -2
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -1
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +2 -1
- package/front_end/panels/network/NetworkLogViewColumns.ts +5 -2
- package/front_end/panels/network/RequestHeadersView.ts +46 -10
- package/front_end/panels/network/components/RequestHeadersView.css +12 -0
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +3 -3
- package/front_end/panels/profiler/HeapProfileView.ts +1 -1
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
- package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
- package/front_end/panels/recorder/RecordingListView.ts +0 -6
- package/front_end/panels/recorder/RecordingView.ts +0 -6
- package/front_end/panels/recorder/controlButton.css +10 -10
- package/front_end/panels/recorder/startView.css +1 -1
- package/front_end/panels/screencast/ScreencastView.ts +4 -2
- package/front_end/panels/search/SearchView.ts +1 -1
- package/front_end/panels/security/SecurityPanel.ts +46 -35
- package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -32
- package/front_end/panels/timeline/TimelinePanel.ts +0 -17
- package/front_end/panels/timeline/components/cwvMetrics.css +2 -2
- package/front_end/panels/timeline/components/insights/checklist.css +1 -1
- package/front_end/panels/timeline/components/insights/table.css +3 -3
- package/front_end/panels/timeline/overlays/components/entriesLinkOverlay.css +4 -4
- package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +4 -4
- package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +2 -2
- package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +4 -4
- package/front_end/panels/timeline/timelinePanel.css +0 -74
- package/front_end/panels/web_audio/webAudio.css +5 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/csp_evaluator/package/tsconfig.json +1 -0
- package/front_end/third_party/diff/DiffWrapper.ts +1 -8
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +183 -4
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +708 -122
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +85 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +84 -11
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts +75 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js +102 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +6 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts +31 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js +138 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +23 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +6 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts +31 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +131 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +7 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +42 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js +265 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +24 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts +23 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +49 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +183 -4
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +143 -11
- package/front_end/third_party/puppeteer/package/src/api/ScreenRecording.ts +145 -0
- package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/bidi/ScreenRecording.ts +106 -0
- package/front_end/third_party/puppeteer/package/src/bidi/bidi.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +41 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +101 -0
- package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +17 -9
- package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +4 -0
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +46 -0
- package/front_end/third_party/puppeteer/package/src/common/Device.ts +287 -1
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +30 -1
- package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +73 -2
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +194 -0
- package/front_end/tsconfig.json +1 -2
- package/front_end/ui/comments/CommentAnchorResolver.ts +8 -3
- package/front_end/ui/comments/CommentOverlayManager.ts +53 -12
- package/front_end/ui/comments/CommentsOverlayWidget.ts +3 -3
- package/front_end/ui/comments/CommentsStatusBarPill.ts +96 -0
- package/front_end/ui/comments/comments-meta.ts +21 -0
- package/front_end/ui/comments/comments.ts +2 -0
- package/front_end/ui/comments/commentsOverlay.css +22 -3
- package/front_end/ui/components/markdown_view/MarkdownView.ts +31 -1
- package/front_end/ui/kit/icons/Icon.ts +0 -1
- package/front_end/ui/kit/link/Link.ts +8 -1
- package/front_end/ui/legacy/InspectorView.ts +17 -1
- package/front_end/ui/legacy/SplitWidget.ts +16 -2
- package/front_end/ui/legacy/StatusBar.ts +78 -0
- package/front_end/ui/legacy/Toolbar.ts +4 -0
- package/front_end/ui/legacy/Treeoutline.ts +78 -11
- package/front_end/ui/legacy/UIUtils.ts +2 -1
- package/front_end/ui/legacy/ViewRegistration.ts +1 -0
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +23 -23
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.docs.ts +83 -0
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +600 -0
- package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/colorMixSwatch.css +4 -4
- package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +3 -3
- package/front_end/ui/legacy/components/inline_editor/inline_editor.ts +2 -0
- package/front_end/ui/legacy/components/inline_editor/linkSwatch.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +154 -0
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +113 -51
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +10 -7
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +16 -97
- package/front_end/ui/legacy/components/object_ui/customPreviewComponent.css +7 -3
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -66
- package/front_end/ui/legacy/components/perf_ui/perf_ui.ts +0 -2
- package/front_end/ui/legacy/inspectorCommon.css +30 -6
- package/front_end/ui/legacy/legacy.ts +2 -0
- package/front_end/ui/legacy/statusBar.css +18 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/inspector_overlay/main.ts +8 -8
- package/mcp/mcp.ts +5 -0
- package/package.json +2 -9
- package/front_end/Images/generate-css-vars.js +0 -52
- package/front_end/Images/rollup.config.mjs +0 -36
- package/front_end/models/ai_assistance/AiOrigins.ts +0 -107
- package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +0 -20
- package/front_end/panels/recorder/injected/rollup.config.mjs +0 -20
- package/front_end/panels/timeline/EasterEgg.d.ts +0 -6
- package/front_end/panels/timeline/easter-egg-tsconfig.json +0 -8
- package/front_end/panels/timeline/enable-easter-egg.js +0 -20
- package/front_end/third_party/puppeteer-replay/puppeteer-replay-tsconfig.json +0 -8
- package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +0 -606
- package/inspector_overlay/loadCSS.rollup.js +0 -29
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
type AwaitedLocator,
|
|
120
120
|
} from './locators/locators.js';
|
|
121
121
|
import type {Realm} from './Realm.js';
|
|
122
|
+
import type {ScreenRecording} from './ScreenRecording.js';
|
|
122
123
|
import type {Target} from './Target.js';
|
|
123
124
|
import type {WebWorker} from './WebWorker.js';
|
|
124
125
|
|
|
@@ -463,6 +464,46 @@ export interface ScreencastOptions {
|
|
|
463
464
|
ffmpegPath?: string;
|
|
464
465
|
}
|
|
465
466
|
|
|
467
|
+
/**
|
|
468
|
+
* @public
|
|
469
|
+
* @experimental
|
|
470
|
+
*/
|
|
471
|
+
export interface RecordOptions {
|
|
472
|
+
/**
|
|
473
|
+
* File path to save the recording to.
|
|
474
|
+
*/
|
|
475
|
+
path?: string;
|
|
476
|
+
/**
|
|
477
|
+
* Specifies whether to overwrite output file,
|
|
478
|
+
* or exit immediately if it already exists.
|
|
479
|
+
*
|
|
480
|
+
* @defaultValue `true`
|
|
481
|
+
*/
|
|
482
|
+
overwrite?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Whether to record audio.
|
|
485
|
+
*
|
|
486
|
+
* @defaultValue `false`
|
|
487
|
+
*/
|
|
488
|
+
audio?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Maximum frame width in pixels.
|
|
491
|
+
*/
|
|
492
|
+
maxWidth?: number;
|
|
493
|
+
/**
|
|
494
|
+
* Maximum frame height in pixels.
|
|
495
|
+
*/
|
|
496
|
+
maxHeight?: number;
|
|
497
|
+
/**
|
|
498
|
+
* Maximum frame rate in frames per second.
|
|
499
|
+
*/
|
|
500
|
+
frameRate?: number;
|
|
501
|
+
/**
|
|
502
|
+
* Frame rate in frames per second (alias for frameRate).
|
|
503
|
+
*/
|
|
504
|
+
fps?: number;
|
|
505
|
+
}
|
|
506
|
+
|
|
466
507
|
/**
|
|
467
508
|
* @public
|
|
468
509
|
*/
|
|
@@ -2138,7 +2179,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
2138
2179
|
*
|
|
2139
2180
|
* ```ts
|
|
2140
2181
|
* import {KnownDevices} from 'puppeteer';
|
|
2141
|
-
* const iPhone = KnownDevices['iPhone
|
|
2182
|
+
* const iPhone = KnownDevices['iPhone 17 Pro'];
|
|
2142
2183
|
*
|
|
2143
2184
|
* const browser = await puppeteer.launch();
|
|
2144
2185
|
* const page = await browser.newPage();
|
|
@@ -2512,7 +2553,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
2512
2553
|
}
|
|
2513
2554
|
|
|
2514
2555
|
/**
|
|
2515
|
-
* Captures a screencast of this {@link Page | page}.
|
|
2556
|
+
* Captures a screencast of this {@link Page | page}. Works in Chrome 153+.
|
|
2516
2557
|
*
|
|
2517
2558
|
* @example
|
|
2518
2559
|
* Recording a {@link Page | page}:
|
|
@@ -2542,7 +2583,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
2542
2583
|
*
|
|
2543
2584
|
* @param options - Configures screencast behavior.
|
|
2544
2585
|
*
|
|
2545
|
-
* @
|
|
2586
|
+
* @deprecated Use {@link Page.record} instead.
|
|
2546
2587
|
*
|
|
2547
2588
|
* @remarks
|
|
2548
2589
|
*
|
|
@@ -2638,6 +2679,96 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
2638
2679
|
return recorder;
|
|
2639
2680
|
}
|
|
2640
2681
|
|
|
2682
|
+
/**
|
|
2683
|
+
* @internal
|
|
2684
|
+
*/
|
|
2685
|
+
protected abstract createScreenRecording(
|
|
2686
|
+
options: Readonly<RecordOptions>,
|
|
2687
|
+
): ScreenRecording;
|
|
2688
|
+
|
|
2689
|
+
/**
|
|
2690
|
+
* Records this {@link Page | page} using the Chrome DevTools Protocol
|
|
2691
|
+
* {@link https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-startScreenRecording | Page.startScreenRecording}
|
|
2692
|
+
* API.
|
|
2693
|
+
*
|
|
2694
|
+
* Outputs mp4 video stream.
|
|
2695
|
+
*
|
|
2696
|
+
* @example
|
|
2697
|
+
* Recording a {@link Page | page}:
|
|
2698
|
+
*
|
|
2699
|
+
* ```ts
|
|
2700
|
+
* import puppeteer from 'puppeteer';
|
|
2701
|
+
*
|
|
2702
|
+
* // Launch a browser
|
|
2703
|
+
* const browser = await puppeteer.launch();
|
|
2704
|
+
*
|
|
2705
|
+
* // Create a new page
|
|
2706
|
+
* const page = await browser.newPage();
|
|
2707
|
+
*
|
|
2708
|
+
* // Go to your site.
|
|
2709
|
+
* await page.goto('https://www.example.com');
|
|
2710
|
+
*
|
|
2711
|
+
* // Start recording.
|
|
2712
|
+
* const recorder = await page.record({path: 'recording.mp4'});
|
|
2713
|
+
*
|
|
2714
|
+
* // Do something.
|
|
2715
|
+
*
|
|
2716
|
+
* // Stop recording.
|
|
2717
|
+
* await recorder.stop();
|
|
2718
|
+
*
|
|
2719
|
+
* await browser.close();
|
|
2720
|
+
* ```
|
|
2721
|
+
*
|
|
2722
|
+
* @param options - Configures recording behavior.
|
|
2723
|
+
*
|
|
2724
|
+
* @experimental
|
|
2725
|
+
*/
|
|
2726
|
+
async record(
|
|
2727
|
+
options: Readonly<RecordOptions> = {},
|
|
2728
|
+
): Promise<ScreenRecording> {
|
|
2729
|
+
if (options.maxWidth !== undefined && options.maxWidth <= 0) {
|
|
2730
|
+
throw new Error('`maxWidth` must be greater than 0.');
|
|
2731
|
+
}
|
|
2732
|
+
if (options.maxHeight !== undefined && options.maxHeight <= 0) {
|
|
2733
|
+
throw new Error('`maxHeight` must be greater than 0.');
|
|
2734
|
+
}
|
|
2735
|
+
if (options.frameRate !== undefined && options.frameRate <= 0) {
|
|
2736
|
+
throw new Error('`frameRate` must be greater than 0.');
|
|
2737
|
+
}
|
|
2738
|
+
if (options.fps !== undefined && options.fps <= 0) {
|
|
2739
|
+
throw new Error('`fps` must be greater than 0.');
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
if (options.path && environment.value.path) {
|
|
2743
|
+
await environment.value.mkdir(
|
|
2744
|
+
environment.value.path.dirname(options.path),
|
|
2745
|
+
{recursive: options.overwrite ?? true},
|
|
2746
|
+
);
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
const stream = options.path
|
|
2750
|
+
? environment.value.createWriteStream(options.path, {
|
|
2751
|
+
encoding: 'binary',
|
|
2752
|
+
overwrite: options.overwrite,
|
|
2753
|
+
})
|
|
2754
|
+
: undefined;
|
|
2755
|
+
|
|
2756
|
+
const recording = this.createScreenRecording(options);
|
|
2757
|
+
|
|
2758
|
+
try {
|
|
2759
|
+
await recording._start();
|
|
2760
|
+
} catch (error) {
|
|
2761
|
+
void recording.stop();
|
|
2762
|
+
throw error;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
if (stream) {
|
|
2766
|
+
recording.pipe(stream);
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
return recording;
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2641
2772
|
#screencastSessionCount = 0;
|
|
2642
2773
|
#startScreencastPromise: Promise<void> | undefined;
|
|
2643
2774
|
|
|
@@ -2647,15 +2778,16 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
2647
2778
|
async _startScreencast(): Promise<void> {
|
|
2648
2779
|
++this.#screencastSessionCount;
|
|
2649
2780
|
if (!this.#startScreencastPromise) {
|
|
2650
|
-
|
|
2651
|
-
|
|
2781
|
+
const client = this.mainFrame().client;
|
|
2782
|
+
const firstFrame = new Promise<void>(resolve => {
|
|
2783
|
+
return client.once('Page.screencastFrame', () => {
|
|
2784
|
+
return resolve();
|
|
2785
|
+
});
|
|
2786
|
+
});
|
|
2787
|
+
this.#startScreencastPromise = client
|
|
2788
|
+
.send('Page.startScreencast', {format: 'png'})
|
|
2652
2789
|
.then(() => {
|
|
2653
|
-
|
|
2654
|
-
return new Promise(resolve => {
|
|
2655
|
-
return this.mainFrame().client.once('Page.screencastFrame', () => {
|
|
2656
|
-
return resolve();
|
|
2657
|
-
});
|
|
2658
|
-
});
|
|
2790
|
+
return firstFrame;
|
|
2659
2791
|
});
|
|
2660
2792
|
}
|
|
2661
2793
|
await this.#startScreencastPromise;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {Logger} from '../common/Debug.js';
|
|
8
|
+
import {asyncDisposeSymbol} from '../util/disposable.js';
|
|
9
|
+
|
|
10
|
+
import type {Page, RecordOptions} from './Page.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface WritableDestination {
|
|
16
|
+
write(chunk: Uint8Array): boolean;
|
|
17
|
+
end(): unknown;
|
|
18
|
+
writableFinished?: boolean;
|
|
19
|
+
closed?: boolean;
|
|
20
|
+
destroyed?: boolean;
|
|
21
|
+
once?(event: string, cb: (arg?: unknown) => void): unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export abstract class ScreenRecording extends ReadableStream<Uint8Array> {
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
protected page: Page;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
protected options: RecordOptions;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
protected logger: Logger;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
protected controller!: ReadableStreamDefaultController<Uint8Array>;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
protected destinations = new Set<WritableDestination>();
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
protected stopped = false;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
constructor(page: Page, options: RecordOptions = {}, logger: Logger) {
|
|
57
|
+
let controller!: ReadableStreamDefaultController<Uint8Array>;
|
|
58
|
+
super({
|
|
59
|
+
start(c) {
|
|
60
|
+
controller = c;
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
this.controller = controller;
|
|
64
|
+
|
|
65
|
+
this.page = page;
|
|
66
|
+
this.options = options;
|
|
67
|
+
this.logger = logger;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
abstract _start(): Promise<void>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pipes the recorded stream to a destination stream.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
pipe<T extends WritableStream<Uint8Array>>(destination: T): Promise<void>;
|
|
81
|
+
pipe<T extends WritableDestination>(destination: T): T;
|
|
82
|
+
pipe(
|
|
83
|
+
destination: WritableStream<Uint8Array> | WritableDestination,
|
|
84
|
+
): Promise<void> | WritableDestination {
|
|
85
|
+
if (
|
|
86
|
+
'getWriter' in destination &&
|
|
87
|
+
typeof destination.getWriter === 'function'
|
|
88
|
+
) {
|
|
89
|
+
return this.pipeTo(destination as WritableStream<Uint8Array>);
|
|
90
|
+
}
|
|
91
|
+
const dest = destination as WritableDestination;
|
|
92
|
+
this.destinations.add(dest);
|
|
93
|
+
dest.once?.('unpipe', () => {
|
|
94
|
+
this.destinations.delete(dest);
|
|
95
|
+
});
|
|
96
|
+
dest.once?.('error', () => {
|
|
97
|
+
this.destinations.delete(dest);
|
|
98
|
+
});
|
|
99
|
+
dest.once?.('close', () => {
|
|
100
|
+
this.destinations.delete(dest);
|
|
101
|
+
});
|
|
102
|
+
dest.once?.('finish', () => {
|
|
103
|
+
this.destinations.delete(dest);
|
|
104
|
+
});
|
|
105
|
+
return dest;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Stops the screen recording.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
abstract stop(): Promise<void>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
protected async closeDestinations(): Promise<void> {
|
|
119
|
+
try {
|
|
120
|
+
this.controller.close();
|
|
121
|
+
} catch {
|
|
122
|
+
// Controller might already be closed.
|
|
123
|
+
}
|
|
124
|
+
for (const dest of this.destinations) {
|
|
125
|
+
dest.end();
|
|
126
|
+
}
|
|
127
|
+
const destinationPromises = Array.from(this.destinations).map(dest => {
|
|
128
|
+
return new Promise(resolve => {
|
|
129
|
+
if (dest.writableFinished || dest.closed || dest.destroyed) {
|
|
130
|
+
resolve(undefined);
|
|
131
|
+
} else {
|
|
132
|
+
dest.once?.('finish', resolve);
|
|
133
|
+
dest.once?.('close', resolve);
|
|
134
|
+
dest.once?.('error', resolve);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
await Promise.all(destinationPromises);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async [asyncDisposeSymbol](): Promise<void> {
|
|
143
|
+
await this.stop();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -21,6 +21,7 @@ export type * from './Issue.js';
|
|
|
21
21
|
export * from './JSHandle.js';
|
|
22
22
|
export * from './Page.js';
|
|
23
23
|
export * from './Realm.js';
|
|
24
|
+
export * from './ScreenRecording.js';
|
|
24
25
|
export * from './Target.js';
|
|
25
26
|
export * from './WebWorker.js';
|
|
26
27
|
export * from './locators/locators.js';
|
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
HeapSnapshotOptions,
|
|
23
23
|
MediaFeature,
|
|
24
24
|
PageEvents,
|
|
25
|
+
RecordOptions,
|
|
25
26
|
ReloadOptions,
|
|
26
27
|
WaitTimeoutOptions,
|
|
27
28
|
} from '../api/Page.js';
|
|
@@ -70,6 +71,7 @@ import {BidiFrame} from './Frame.js';
|
|
|
70
71
|
import type {BidiHTTPResponse} from './HTTPResponse.js';
|
|
71
72
|
import {BidiKeyboard, BidiMouse, BidiTouchscreen} from './Input.js';
|
|
72
73
|
import type {BidiJSHandle} from './JSHandle.js';
|
|
74
|
+
import {BidiScreenRecording} from './ScreenRecording.js';
|
|
73
75
|
import {rewriteNavigationError} from './util.js';
|
|
74
76
|
import type {BidiWebWorker} from './WebWorker.js';
|
|
75
77
|
|
|
@@ -1033,6 +1035,15 @@ export class BidiPage extends Page {
|
|
|
1033
1035
|
override extensionRealms(): Realm[] {
|
|
1034
1036
|
throw new UnsupportedOperation();
|
|
1035
1037
|
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* @internal
|
|
1041
|
+
*/
|
|
1042
|
+
override createScreenRecording(
|
|
1043
|
+
options: Readonly<RecordOptions>,
|
|
1044
|
+
): BidiScreenRecording {
|
|
1045
|
+
return new BidiScreenRecording(this, options, this.logger);
|
|
1046
|
+
}
|
|
1036
1047
|
}
|
|
1037
1048
|
|
|
1038
1049
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {RecordOptions} from '../api/Page.js';
|
|
8
|
+
import {ScreenRecording} from '../api/ScreenRecording.js';
|
|
9
|
+
import {DEBUG_PREFIXES, type Logger} from '../common/Debug.js';
|
|
10
|
+
import {environment} from '../environment.js';
|
|
11
|
+
import {guarded} from '../util/decorators.js';
|
|
12
|
+
|
|
13
|
+
import type {BidiPage} from './Page.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export class BidiScreenRecording extends ScreenRecording {
|
|
19
|
+
declare protected page: BidiPage;
|
|
20
|
+
#screencastId?: string;
|
|
21
|
+
#path?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
constructor(page: BidiPage, options: RecordOptions = {}, logger: Logger) {
|
|
27
|
+
super(page, options, logger);
|
|
28
|
+
|
|
29
|
+
const browsingContext = this.page.mainFrame().browsingContext;
|
|
30
|
+
browsingContext?.once?.('closed', () => {
|
|
31
|
+
void this.stop().catch(err => {
|
|
32
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
override async _start(): Promise<void> {
|
|
41
|
+
const frameRate = this.options.frameRate ?? this.options.fps;
|
|
42
|
+
const video =
|
|
43
|
+
this.options.maxWidth !== undefined ||
|
|
44
|
+
this.options.maxHeight !== undefined ||
|
|
45
|
+
frameRate !== undefined
|
|
46
|
+
? {
|
|
47
|
+
width: this.options.maxWidth,
|
|
48
|
+
height: this.options.maxHeight,
|
|
49
|
+
frameRate,
|
|
50
|
+
}
|
|
51
|
+
: undefined;
|
|
52
|
+
|
|
53
|
+
const result = await this.page.mainFrame().browsingContext.startScreencast({
|
|
54
|
+
audio: this.options.audio,
|
|
55
|
+
video,
|
|
56
|
+
});
|
|
57
|
+
this.#screencastId = result.screencast;
|
|
58
|
+
this.#path = result.path;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Stops the screen recording.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
@guarded()
|
|
67
|
+
override async stop(): Promise<void> {
|
|
68
|
+
if (this.stopped) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.stopped = true;
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
if (!this.#screencastId) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const result = await this.page
|
|
79
|
+
.mainFrame()
|
|
80
|
+
.browsingContext.stopScreencast(this.#screencastId)
|
|
81
|
+
.catch(err => {
|
|
82
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
83
|
+
return undefined;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (result?.error) {
|
|
87
|
+
this.logger(DEBUG_PREFIXES.error)?.(result.error);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const filePath = result?.path ?? this.#path;
|
|
91
|
+
if (filePath) {
|
|
92
|
+
try {
|
|
93
|
+
const buffer = await environment.value.readFile(filePath);
|
|
94
|
+
this.controller.enqueue(buffer);
|
|
95
|
+
for (const dest of this.destinations) {
|
|
96
|
+
dest.write(buffer);
|
|
97
|
+
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} finally {
|
|
103
|
+
await this.closeDestinations();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -72,6 +72,14 @@ export type SetViewportOptions = Omit<
|
|
|
72
72
|
'context'
|
|
73
73
|
>;
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export type StartScreencastOptions = Omit<
|
|
79
|
+
Bidi.BrowsingContext.StartScreencastParameters,
|
|
80
|
+
'context'
|
|
81
|
+
>;
|
|
82
|
+
|
|
75
83
|
/**
|
|
76
84
|
* @internal
|
|
77
85
|
*/
|
|
@@ -390,6 +398,39 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
390
398
|
return data;
|
|
391
399
|
}
|
|
392
400
|
|
|
401
|
+
@throwIfDisposed<BrowsingContext>(context => {
|
|
402
|
+
// SAFETY: Disposal implies this exists.
|
|
403
|
+
return context.#reason!;
|
|
404
|
+
})
|
|
405
|
+
async startScreencast(
|
|
406
|
+
options: StartScreencastOptions = {},
|
|
407
|
+
): Promise<Bidi.BrowsingContext.StartScreencastResult> {
|
|
408
|
+
const {result} = await this.#session.send(
|
|
409
|
+
'browsingContext.startScreencast',
|
|
410
|
+
{
|
|
411
|
+
context: this.id,
|
|
412
|
+
...options,
|
|
413
|
+
},
|
|
414
|
+
);
|
|
415
|
+
return result;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
@throwIfDisposed<BrowsingContext>(context => {
|
|
419
|
+
// SAFETY: Disposal implies this exists.
|
|
420
|
+
return context.#reason!;
|
|
421
|
+
})
|
|
422
|
+
async stopScreencast(
|
|
423
|
+
screencast: Bidi.BrowsingContext.Screencast,
|
|
424
|
+
): Promise<Bidi.BrowsingContext.StopScreencastResult> {
|
|
425
|
+
const {result} = await this.#session.send(
|
|
426
|
+
'browsingContext.stopScreencast',
|
|
427
|
+
{
|
|
428
|
+
screencast,
|
|
429
|
+
},
|
|
430
|
+
);
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
433
|
+
|
|
393
434
|
@throwIfDisposed<BrowsingContext>(context => {
|
|
394
435
|
// SAFETY: Disposal implies this exists.
|
|
395
436
|
return context.#reason!;
|
|
@@ -20,6 +20,7 @@ import type {JSHandle} from '../api/JSHandle.js';
|
|
|
20
20
|
import type {
|
|
21
21
|
Credentials,
|
|
22
22
|
HeapSnapshotOptions,
|
|
23
|
+
RecordOptions,
|
|
23
24
|
ReloadOptions,
|
|
24
25
|
} from '../api/Page.js';
|
|
25
26
|
import {
|
|
@@ -81,6 +82,7 @@ import type {IsolatedWorld} from './IsolatedWorld.js';
|
|
|
81
82
|
import {MAIN_WORLD} from './IsolatedWorlds.js';
|
|
82
83
|
import {releaseObject} from './JSHandle.js';
|
|
83
84
|
import type {NetworkConditions} from './NetworkManager.js';
|
|
85
|
+
import {CdpScreenRecording} from './ScreenRecording.js';
|
|
84
86
|
import type {CdpTarget} from './Target.js';
|
|
85
87
|
import {TargetManagerEvent} from './TargetManageEvents.js';
|
|
86
88
|
import type {TargetManager} from './TargetManager.js';
|
|
@@ -1361,6 +1363,15 @@ export class CdpPage extends Page {
|
|
|
1361
1363
|
override extensionRealms(): Realm[] {
|
|
1362
1364
|
return this.mainFrame().extensionRealms();
|
|
1363
1365
|
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* @internal
|
|
1369
|
+
*/
|
|
1370
|
+
override createScreenRecording(
|
|
1371
|
+
options: Readonly<RecordOptions>,
|
|
1372
|
+
): CdpScreenRecording {
|
|
1373
|
+
return new CdpScreenRecording(this, options, this.logger);
|
|
1374
|
+
}
|
|
1364
1375
|
}
|
|
1365
1376
|
|
|
1366
1377
|
const supportedMetrics = new Set<string>([
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {CDPSessionEvent} from '../api/CDPSession.js';
|
|
8
|
+
import type {RecordOptions} from '../api/Page.js';
|
|
9
|
+
import {ScreenRecording} from '../api/ScreenRecording.js';
|
|
10
|
+
import {DEBUG_PREFIXES, type Logger} from '../common/Debug.js';
|
|
11
|
+
import {guarded} from '../util/decorators.js';
|
|
12
|
+
import {stringToTypedArray} from '../util/encoding.js';
|
|
13
|
+
|
|
14
|
+
import type {CdpPage} from './Page.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export class CdpScreenRecording extends ScreenRecording {
|
|
20
|
+
declare protected page: CdpPage;
|
|
21
|
+
#streamHandle?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
constructor(page: CdpPage, options: RecordOptions = {}, logger: Logger) {
|
|
27
|
+
super(page, options, logger);
|
|
28
|
+
|
|
29
|
+
const {client} = this.page.mainFrame();
|
|
30
|
+
client?.once?.(CDPSessionEvent.Disconnected, () => {
|
|
31
|
+
void this.stop().catch(err => {
|
|
32
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
override async _start(): Promise<void> {
|
|
41
|
+
const {client} = this.page.mainFrame();
|
|
42
|
+
const frameRate = this.options.frameRate ?? this.options.fps;
|
|
43
|
+
// @ts-expect-error Page.startScreenRecording is not yet in devtools-protocol
|
|
44
|
+
const result = (await client.send('Page.startScreenRecording', {
|
|
45
|
+
audio: this.options.audio,
|
|
46
|
+
maxWidth: this.options.maxWidth,
|
|
47
|
+
maxHeight: this.options.maxHeight,
|
|
48
|
+
frameRate,
|
|
49
|
+
})) as {stream: string};
|
|
50
|
+
this.#streamHandle = result.stream;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Stops the screen recording.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
@guarded()
|
|
59
|
+
override async stop(): Promise<void> {
|
|
60
|
+
if (this.stopped) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.stopped = true;
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const {client} = this.page.mainFrame();
|
|
67
|
+
await client
|
|
68
|
+
// @ts-expect-error Page.stopScreenRecording is not yet in devtools-protocol
|
|
69
|
+
.send('Page.stopScreenRecording')
|
|
70
|
+
.catch(err => {
|
|
71
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (!this.#streamHandle) {
|
|
75
|
+
throw new Error('Screen recording stream handle is missing.');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let eof = false;
|
|
79
|
+
while (!eof) {
|
|
80
|
+
const {
|
|
81
|
+
data,
|
|
82
|
+
base64Encoded,
|
|
83
|
+
eof: isEof,
|
|
84
|
+
} = await client.send('IO.read', {handle: this.#streamHandle});
|
|
85
|
+
eof = isEof;
|
|
86
|
+
if (data) {
|
|
87
|
+
const buffer = stringToTypedArray(data, base64Encoded ?? false);
|
|
88
|
+
this.controller.enqueue(buffer);
|
|
89
|
+
for (const dest of this.destinations) {
|
|
90
|
+
dest.write(buffer);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
await client.send('IO.close', {handle: this.#streamHandle}).catch(err => {
|
|
95
|
+
this.logger(DEBUG_PREFIXES.error)?.(err);
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
await this.closeDestinations();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -35,6 +35,7 @@ export * from './NetworkEventManager.js';
|
|
|
35
35
|
export * from './NetworkManager.js';
|
|
36
36
|
export * from './Page.js';
|
|
37
37
|
export * from './PredefinedNetworkConditions.js';
|
|
38
|
+
export * from './ScreenRecording.js';
|
|
38
39
|
export * from './Target.js';
|
|
39
40
|
export * from './TargetManager.js';
|
|
40
41
|
export * from './TargetManageEvents.js';
|