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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as Common from '../../../core/common/common.js';
|
|
6
5
|
import * as Host from '../../../core/host/host.js';
|
|
7
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
8
7
|
import * as Root from '../../../core/root/root.js';
|
|
@@ -12,12 +11,11 @@ import * as Logs from '../../logs/logs.js';
|
|
|
12
11
|
import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
|
|
13
12
|
import type * as Trace from '../../trace/trace.js';
|
|
14
13
|
import * as Workspace from '../../workspace/workspace.js';
|
|
15
|
-
import {isOpaqueOrigin} from '../AiOrigins.js';
|
|
16
14
|
import {AccessibilityContext} from '../contexts/AccessibilityContext.js';
|
|
17
15
|
import {DOMNodeContext} from '../contexts/DOMNodeContext.js';
|
|
18
16
|
import {FileContext} from '../contexts/FileContext.js';
|
|
19
17
|
import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
|
|
20
|
-
import {
|
|
18
|
+
import {RequestContext} from '../contexts/RequestContext.js';
|
|
21
19
|
import {StorageContext} from '../contexts/StorageContext.js';
|
|
22
20
|
import {formatBytesToKb, seconds} from '../data_formatters/UnitFormatters.js';
|
|
23
21
|
import {debugLog} from '../debug.js';
|
|
@@ -149,16 +147,16 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
149
147
|
};
|
|
150
148
|
}
|
|
151
149
|
const origin = allowedOriginResult.origin;
|
|
152
|
-
if (origin
|
|
150
|
+
if (origin?.isOpaque()) {
|
|
153
151
|
return {
|
|
154
152
|
error: 'No requests recorded by DevTools',
|
|
155
153
|
};
|
|
156
154
|
}
|
|
157
155
|
|
|
156
|
+
const allowedSecurityOrigin = origin ?? null;
|
|
158
157
|
let hasCrossOriginRequest = false;
|
|
159
158
|
const requestsToShow: NetworkRequest[] = [];
|
|
160
159
|
for (const request of this.#networkLog.requests()) {
|
|
161
|
-
const requestOrigin = getRequestContextOrigin(request);
|
|
162
160
|
/**
|
|
163
161
|
* NOTE: this origin check does not ensure that all the requests are
|
|
164
162
|
* from the same origin as the target page. Instead, it ensures that
|
|
@@ -167,7 +165,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
167
165
|
* during the loading of the target page, and do not leak URLs from
|
|
168
166
|
* other pages.
|
|
169
167
|
*/
|
|
170
|
-
if (
|
|
168
|
+
if (allowedSecurityOrigin && !request.initiatorSecurityOrigin().isSameOriginWith(allowedSecurityOrigin)) {
|
|
171
169
|
hasCrossOriginRequest = true;
|
|
172
170
|
continue;
|
|
173
171
|
}
|
|
@@ -185,7 +183,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
185
183
|
if (requests.length === 0) {
|
|
186
184
|
return {
|
|
187
185
|
error: hasCrossOriginRequest ?
|
|
188
|
-
`No requests showing with origin ${origin}. Tell the user to start a new chat` :
|
|
186
|
+
`No requests showing with origin ${origin?.siteId() ?? ''}. Tell the user to start a new chat` :
|
|
189
187
|
'No requests recorded by DevTools',
|
|
190
188
|
};
|
|
191
189
|
}
|
|
@@ -232,18 +230,18 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
232
230
|
};
|
|
233
231
|
}
|
|
234
232
|
const origin = allowedOriginResult.origin;
|
|
235
|
-
if (origin
|
|
233
|
+
if (origin?.isOpaque()) {
|
|
236
234
|
return {
|
|
237
235
|
error: 'No request found',
|
|
238
236
|
};
|
|
239
237
|
}
|
|
238
|
+
const allowedSecurityOrigin = origin ?? null;
|
|
240
239
|
const request = this.#networkLog.requests().find(req => {
|
|
241
240
|
if (req.requestId() !== id) {
|
|
242
241
|
return false;
|
|
243
242
|
}
|
|
244
243
|
|
|
245
|
-
|
|
246
|
-
return !origin || requestOrigin === origin;
|
|
244
|
+
return !allowedSecurityOrigin || req.initiatorSecurityOrigin().isSameOriginWith(allowedSecurityOrigin);
|
|
247
245
|
});
|
|
248
246
|
|
|
249
247
|
if (request) {
|
|
@@ -293,10 +291,9 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
293
291
|
const files: Array<{file: string, id: number | undefined}> = [];
|
|
294
292
|
const uiSourceCodes: Workspace.UISourceCode.UISourceCode[] = [];
|
|
295
293
|
for (const file of ContextSelectionAgent.getUISourceCodes(this.#workspace)) {
|
|
296
|
-
const
|
|
297
|
-
const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
|
|
294
|
+
const fileSecurityOrigin = FileContext.originForUISourceCode(file);
|
|
298
295
|
|
|
299
|
-
if (origin &&
|
|
296
|
+
if (origin && !fileSecurityOrigin.isSameOriginWith(origin)) {
|
|
300
297
|
continue;
|
|
301
298
|
}
|
|
302
299
|
|
|
@@ -354,9 +351,8 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
354
351
|
if (ContextSelectionAgent.uiSourceCodeId.get(file) !== params.id) {
|
|
355
352
|
return false;
|
|
356
353
|
}
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
return !origin || fileOrigin === origin;
|
|
354
|
+
const fileSecurityOrigin = FileContext.originForUISourceCode(file);
|
|
355
|
+
return !origin || fileSecurityOrigin.isSameOriginWith(origin);
|
|
360
356
|
});
|
|
361
357
|
|
|
362
358
|
if (!file) {
|
|
@@ -534,7 +530,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
534
530
|
}
|
|
535
531
|
|
|
536
532
|
return {
|
|
537
|
-
context: new StorageContext(new StorageItem(origin, origin)),
|
|
533
|
+
context: new StorageContext(new StorageItem(origin.siteId(), origin.siteId())),
|
|
538
534
|
description: 'User selected page storage',
|
|
539
535
|
};
|
|
540
536
|
},
|
|
@@ -12,7 +12,6 @@ import * as TextUtils from '../../../core/text_utils/text_utils.js';
|
|
|
12
12
|
import * as Tracing from '../../../services/tracing/tracing.js';
|
|
13
13
|
import * as Logs from '../../logs/logs.js';
|
|
14
14
|
import * as Trace from '../../trace/trace.js';
|
|
15
|
-
import {canResourceContentsBeReadForTrace} from '../AiOrigins.js';
|
|
16
15
|
import type {MainThreadSectionLabel, PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
|
|
17
16
|
import {
|
|
18
17
|
PerformanceInsightFormatter,
|
|
@@ -1053,6 +1052,10 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
|
|
|
1053
1052
|
return {error: 'Missing arg: column'};
|
|
1054
1053
|
}
|
|
1055
1054
|
|
|
1055
|
+
if (!context.canAccessResource(args.scriptUrl)) {
|
|
1056
|
+
return {error: 'Resource not found'};
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1056
1059
|
if (!this.#formatter) {
|
|
1057
1060
|
throw new Error('missing formatter');
|
|
1058
1061
|
}
|
|
@@ -1115,8 +1118,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
|
|
|
1115
1118
|
}
|
|
1116
1119
|
|
|
1117
1120
|
const url = args.url;
|
|
1118
|
-
|
|
1119
|
-
if (!canResourceContentsBeReadForTrace(url, allowedOrigin)) {
|
|
1121
|
+
if (!context.canAccessResource(url)) {
|
|
1120
1122
|
return {error: 'Resource not found'};
|
|
1121
1123
|
}
|
|
1122
1124
|
|
|
@@ -71,16 +71,19 @@ export function isSamePageOrigin(target: SDK.Target.Target|null, context?: Conve
|
|
|
71
71
|
if (!target || !context) {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const inspectedURL = target.inspectedURL();
|
|
75
|
+
if (!inspectedURL) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const pageOrigin = SDK.SecurityOrigin.SecurityOrigin.create(inspectedURL);
|
|
79
|
+
return !pageOrigin.isOpaque() && context.isOriginAllowed(pageOrigin);
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
const MAX_TARGET_ORIGINS = 100;
|
|
79
83
|
|
|
80
84
|
function resolveTargetOrigins(context?: ConversationContext<StorageItem>, origins?: string[]): string[] {
|
|
81
85
|
const primaryOrigin = context?.getOrigin();
|
|
82
|
-
const primaryString =
|
|
83
|
-
primaryOrigin instanceof SDK.SecurityOrigin.SecurityOrigin ? primaryOrigin.siteId() : primaryOrigin;
|
|
86
|
+
const primaryString = primaryOrigin?.siteId();
|
|
84
87
|
const rawList = (origins && origins.length > 0) ? origins : (primaryString ? [primaryString] : []);
|
|
85
88
|
const uniqueOrigins = Array.from(new Set(rawList));
|
|
86
89
|
return uniqueOrigins.slice(0, MAX_TARGET_ORIGINS);
|
|
@@ -145,19 +148,21 @@ export class StorageAgent extends AiAgent<StorageItem> {
|
|
|
145
148
|
return {error: 'No origin available or not allowed.'};
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
const origins =
|
|
151
|
+
const origins: SDK.SecurityOrigin.SecurityOrigin[] = [];
|
|
149
152
|
for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(this.targetManager)) {
|
|
150
153
|
if (!isSamePageOrigin(frame.resourceTreeModel().target().outermostTarget(), this.context)) {
|
|
151
154
|
continue;
|
|
152
155
|
}
|
|
153
|
-
const origin = frame.securityOrigin;
|
|
154
|
-
if (
|
|
156
|
+
const origin = frame.securityOrigin();
|
|
157
|
+
if (origin.isOpaque()) {
|
|
155
158
|
continue;
|
|
156
159
|
}
|
|
157
|
-
origins.
|
|
160
|
+
if (!origins.some(existing => existing.isSameOriginWith(origin))) {
|
|
161
|
+
origins.push(origin);
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
return {result: {origins:
|
|
165
|
+
return {result: {origins: origins.map(o => o.siteId())}};
|
|
161
166
|
},
|
|
162
167
|
});
|
|
163
168
|
|
|
@@ -679,8 +684,9 @@ export async function getCookiesForDomain(target: SDK.Target.Target,
|
|
|
679
684
|
export function findFrameForOrigin(
|
|
680
685
|
context: ConversationContext<StorageItem>|undefined, origin: string,
|
|
681
686
|
targetManager: SDK.TargetManager.TargetManager): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
687
|
+
const parsedOrigin = SDK.SecurityOrigin.SecurityOrigin.create(origin);
|
|
682
688
|
for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(targetManager)) {
|
|
683
|
-
if (frame.securityOrigin
|
|
689
|
+
if (frame.securityOrigin().isSameOriginWith(parsedOrigin)) {
|
|
684
690
|
const target = frame.resourceTreeModel().target();
|
|
685
691
|
if (isSamePageOrigin(target.outermostTarget(), context)) {
|
|
686
692
|
return frame;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../../core/host/host.js';
|
|
6
6
|
import * as Root from '../../../core/root/root.js';
|
|
7
|
-
import * as SDK from '../../../core/sdk/sdk.js';
|
|
7
|
+
import type * as SDK from '../../../core/sdk/sdk.js';
|
|
8
8
|
import {ChangeManager} from '../ChangeManager.js';
|
|
9
9
|
import {ExtensionScope} from '../ExtensionScope.js';
|
|
10
10
|
import {AI_ASSISTANCE_CSS_CLASS_NAME} from '../injected.js';
|
|
@@ -155,8 +155,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
|
|
|
155
155
|
return await getStylesTool.handler(args, {
|
|
156
156
|
getTarget: () => this.targetManager.primaryPageTarget() ?? context.getItem().domModel().target(),
|
|
157
157
|
getEstablishedOrigin: () => {
|
|
158
|
-
|
|
159
|
-
return origin instanceof SDK.SecurityOrigin.SecurityOrigin ? origin.siteId() : origin;
|
|
158
|
+
return context.getOrigin();
|
|
160
159
|
},
|
|
161
160
|
});
|
|
162
161
|
},
|
|
@@ -177,11 +176,11 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
|
|
|
177
176
|
createExtensionScope: this.#createExtensionScope.bind(this),
|
|
178
177
|
execJs: this.#execJs,
|
|
179
178
|
getExecutionContextNode: () => this.context?.getItem() ?? null,
|
|
179
|
+
getEstablishedOrigin: () => this.context?.getOrigin(),
|
|
180
180
|
},
|
|
181
181
|
options,
|
|
182
182
|
),
|
|
183
183
|
});
|
|
184
|
-
|
|
185
184
|
}
|
|
186
185
|
|
|
187
186
|
override preambleFeatures(): string[] {
|
|
@@ -12,7 +12,6 @@ import * as StylingAgent from './agents/StylingAgent.js';
|
|
|
12
12
|
import * as AiAgent2 from './AiAgent2.js';
|
|
13
13
|
import * as AiConversation from './AiConversation.js';
|
|
14
14
|
import * as AiHistoryStorage from './AiHistoryStorage.js';
|
|
15
|
-
import * as AiOrigins from './AiOrigins.js';
|
|
16
15
|
import * as AiSetting from './AiSetting.js';
|
|
17
16
|
import * as AiUtils from './AiUtils.js';
|
|
18
17
|
import * as BuiltInAi from './BuiltInAi.js';
|
|
@@ -80,7 +79,6 @@ export {
|
|
|
80
79
|
AIContext,
|
|
81
80
|
AiConversation,
|
|
82
81
|
AiHistoryStorage,
|
|
83
|
-
AiOrigins,
|
|
84
82
|
AIQueries,
|
|
85
83
|
AiSetting,
|
|
86
84
|
AiUtils,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
5
6
|
import type * as LHModel from '../../lighthouse/lighthouse.js';
|
|
6
7
|
import {
|
|
7
8
|
type AiWidget,
|
|
@@ -23,8 +24,16 @@ export class AccessibilityContext extends ConversationContext<LHModel.ReporterTy
|
|
|
23
24
|
return this.#lh.finalUrl ?? this.#lh.finalDisplayedUrl;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Returns the security origin of the audited page from the Lighthouse report.
|
|
29
|
+
*
|
|
30
|
+
* Derives the origin from the report URL (`finalUrl` or `finalDisplayedUrl`).
|
|
31
|
+
* If the report does not contain a valid URL, returns a unique opaque origin.
|
|
32
|
+
*
|
|
33
|
+
* @returns The security origin of the audited page.
|
|
34
|
+
*/
|
|
35
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
36
|
+
return SDK.SecurityOrigin.SecurityOrigin.create(this.#url());
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
override getItem(): LHModel.ReporterTypes.ReportJSON {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
|
-
import
|
|
6
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
7
7
|
import {
|
|
8
8
|
type ContextDetail,
|
|
9
9
|
ConversationContext,
|
|
@@ -21,19 +21,31 @@ const lockedString = i18n.i18n.lockedString;
|
|
|
21
21
|
|
|
22
22
|
export class DOMNodeContext extends ConversationContext<SDK.DOMModel.DOMNode> {
|
|
23
23
|
#node: SDK.DOMModel.DOMNode;
|
|
24
|
+
#opaqueOrigin?: SDK.SecurityOrigin.SecurityOrigin;
|
|
24
25
|
|
|
25
26
|
constructor(node: SDK.DOMModel.DOMNode) {
|
|
26
27
|
super();
|
|
27
28
|
this.#node = node;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Returns the security origin of the node's owner document.
|
|
33
|
+
*
|
|
34
|
+
* If the node is detached from a document, returns a unique opaque origin to
|
|
35
|
+
* prevent unauthorized cross-origin access in AI conversations.
|
|
36
|
+
*
|
|
37
|
+
* @returns The security origin of the owner document, or a unique opaque origin.
|
|
38
|
+
*/
|
|
39
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
31
40
|
const ownerDocument = this.#node.ownerDocument;
|
|
32
41
|
if (!ownerDocument) {
|
|
33
|
-
//
|
|
34
|
-
|
|
42
|
+
// Detached nodes have no security document; isolate them with a unique opaque origin.
|
|
43
|
+
if (!this.#opaqueOrigin) {
|
|
44
|
+
this.#opaqueOrigin = SDK.SecurityOrigin.SecurityOrigin.createUniqueOpaque();
|
|
45
|
+
}
|
|
46
|
+
return this.#opaqueOrigin;
|
|
35
47
|
}
|
|
36
|
-
return ownerDocument.documentURL;
|
|
48
|
+
return SDK.SecurityOrigin.SecurityOrigin.create(ownerDocument.documentURL);
|
|
37
49
|
}
|
|
38
50
|
|
|
39
51
|
getItem(): SDK.DOMModel.DOMNode {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
6
6
|
import type * as Bindings from '../../bindings/bindings.js';
|
|
7
7
|
import type * as Workspace from '../../workspace/workspace.js';
|
|
8
8
|
import {type ContextDetail, ConversationContext} from '../agents/AiAgent.js';
|
|
@@ -19,13 +19,20 @@ export class FileContext extends ConversationContext<Workspace.UISourceCode.UISo
|
|
|
19
19
|
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the security origin of a given UISourceCode.
|
|
24
|
+
* Prefers the project security origin, falling back to the origin of the file URL.
|
|
25
|
+
*/
|
|
26
|
+
static originForUISourceCode(file: Workspace.UISourceCode.UISourceCode): SDK.SecurityOrigin.SecurityOrigin {
|
|
27
|
+
return file.project()?.securityOrigin?.() ?? SDK.SecurityOrigin.SecurityOrigin.create(file.url());
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Returns the security origin of the project containing the file, falling
|
|
32
|
+
* back to the origin derived from the file URL.
|
|
33
|
+
*/
|
|
34
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
35
|
+
return FileContext.originForUISourceCode(this.#file);
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
override getItem(): Workspace.UISourceCode.UISourceCode {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as Common from '../../../core/common/common.js';
|
|
6
5
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
7
6
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
8
7
|
import * as Tracing from '../../../services/tracing/tracing.js';
|
|
@@ -15,7 +14,6 @@ import {
|
|
|
15
14
|
ConversationContext,
|
|
16
15
|
type ConversationSuggestions,
|
|
17
16
|
} from '../agents/AiAgent.js';
|
|
18
|
-
import {extractContextOrigin} from '../AiOrigins.js';
|
|
19
17
|
import {
|
|
20
18
|
PerformanceInsightFormatter,
|
|
21
19
|
} from '../data_formatters/PerformanceInsightFormatter.js';
|
|
@@ -88,6 +86,7 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
|
|
|
88
86
|
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
89
87
|
readonly #freshRecordingTracker: Tracing.FreshRecording.Tracker;
|
|
90
88
|
readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
|
|
89
|
+
#origin?: SDK.SecurityOrigin.SecurityOrigin;
|
|
91
90
|
|
|
92
91
|
constructor(focus: AgentFocus,
|
|
93
92
|
// eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
|
|
@@ -128,36 +127,64 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
|
|
|
128
127
|
return formatter;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Returns whether this trace was imported rather than recorded live in the current session.
|
|
132
|
+
*/
|
|
133
|
+
isImported(): boolean {
|
|
134
|
+
return !this.#freshRecordingTracker.recordingIsFresh(this.#focus.parsedTrace);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Checks whether the AI can access the resource at the specified URL.
|
|
139
|
+
*
|
|
140
|
+
* Access requires the resource origin to match the trace origin.
|
|
141
|
+
* Always rejects `file://` URLs to prevent local file leaks (b/523743289).
|
|
142
|
+
*
|
|
143
|
+
* @param url The URL of the resource to access.
|
|
144
|
+
* @returns `true` if the resource is same-origin with the trace and not a `file://` URL; otherwise `false`.
|
|
145
|
+
*/
|
|
146
|
+
canAccessResource(url: string): boolean {
|
|
147
|
+
const traceOrigin = this.getOrigin();
|
|
148
|
+
const targetOrigin = SDK.SecurityOrigin.SecurityOrigin.create(url);
|
|
149
|
+
|
|
150
|
+
// We explicitly block all file:// URLs even if same-origin (b/523743289).
|
|
151
|
+
// Allowing local file access in trace AI risks leaking local system files
|
|
152
|
+
// (such as /etc/passwd) via prompt injection across filesystem edge cases.
|
|
153
|
+
if (traceOrigin.isFile() || targetOrigin.isFile()) {
|
|
154
|
+
return false;
|
|
139
155
|
}
|
|
156
|
+
|
|
157
|
+
return traceOrigin.isSameOriginWith(targetOrigin);
|
|
140
158
|
}
|
|
141
159
|
|
|
142
160
|
/**
|
|
143
|
-
* Returns the origin for
|
|
161
|
+
* Returns the security origin for the performance trace.
|
|
162
|
+
*
|
|
163
|
+
* Live traces use the origin of the main frame URL.
|
|
144
164
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
165
|
+
* Imported traces use a custom scheme (`imported-trace://${host}`) to isolate
|
|
166
|
+
* them from live pages (such as `https://${host}`). This isolation prevents
|
|
167
|
+
* cross-origin prompt injection and requires a new conversation when switching
|
|
168
|
+
* between imported traces and live pages.
|
|
169
|
+
*
|
|
170
|
+
* If an imported trace origin does not contain a host, this method returns a
|
|
171
|
+
* unique opaque origin.
|
|
172
|
+
*
|
|
173
|
+
* @returns The security origin for the trace.
|
|
150
174
|
*/
|
|
151
|
-
override getOrigin():
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
175
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
176
|
+
if (!this.#origin) {
|
|
177
|
+
if (this.isImported()) {
|
|
178
|
+
this.#origin = SDK.SecurityOrigin.SecurityOrigin.createForImportedTrace(
|
|
179
|
+
this.#focus.parsedTrace.data.Meta.mainFrameURL,
|
|
180
|
+
);
|
|
181
|
+
} else {
|
|
182
|
+
this.#origin = SDK.SecurityOrigin.SecurityOrigin.create(
|
|
183
|
+
this.#focus.parsedTrace.data.Meta.mainFrameURL,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
159
186
|
}
|
|
160
|
-
return origin;
|
|
187
|
+
return this.#origin;
|
|
161
188
|
}
|
|
162
189
|
|
|
163
190
|
override getItem(): AgentFocus {
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as Common from '../../../core/common/common.js';
|
|
6
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
|
-
import type * as Platform from '../../../core/platform/platform.js';
|
|
8
6
|
import type * as SDK from '../../../core/sdk/sdk.js';
|
|
9
7
|
import type * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
|
|
10
8
|
import {
|
|
11
9
|
type ContextDetail,
|
|
12
10
|
ConversationContext,
|
|
13
11
|
} from '../agents/AiAgent.js';
|
|
14
|
-
import {
|
|
15
|
-
|
|
12
|
+
import {
|
|
13
|
+
NetworkRequestFormatter,
|
|
14
|
+
} from '../data_formatters/NetworkRequestFormatter.js';
|
|
16
15
|
|
|
17
16
|
const UIStringsNotTranslate = {
|
|
18
17
|
request: 'Request',
|
|
@@ -24,24 +23,6 @@ const UIStringsNotTranslate = {
|
|
|
24
23
|
|
|
25
24
|
const lockedString = i18n.i18n.lockedString;
|
|
26
25
|
|
|
27
|
-
/**
|
|
28
|
-
* Returns the origin for a network request in the AI context.
|
|
29
|
-
*
|
|
30
|
-
* To prevent cross-origin prompt injection attacks, HAR-imported requests
|
|
31
|
-
* are isolated from live pages. We assign them a virtual origin
|
|
32
|
-
* (`imported-har://${domain}`) so they do not share the origin of live pages
|
|
33
|
-
* (e.g., `https://${domain}`). This forces a conversation reset when transitioning
|
|
34
|
-
* between imported HAR data and live pages.
|
|
35
|
-
*/
|
|
36
|
-
export function getRequestContextOrigin(request: SDK.NetworkRequest.NetworkRequest): string {
|
|
37
|
-
const origin = extractContextOrigin(request.documentURL);
|
|
38
|
-
if (request.isImportedHar()) {
|
|
39
|
-
const parsed = Common.ParsedURL.ParsedURL.fromString(origin as Platform.DevToolsPath.UrlString);
|
|
40
|
-
return `imported-har://${parsed ? parsed.domain() : origin}`;
|
|
41
|
-
}
|
|
42
|
-
return origin;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
export class RequestContext extends ConversationContext<SDK.NetworkRequest.NetworkRequest> {
|
|
46
27
|
#request: SDK.NetworkRequest.NetworkRequest;
|
|
47
28
|
#calculator: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
@@ -56,17 +37,14 @@ export class RequestContext extends ConversationContext<SDK.NetworkRequest.Netwo
|
|
|
56
37
|
}
|
|
57
38
|
|
|
58
39
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
40
|
+
* Returns the security origin of the document that initiated the request.
|
|
41
|
+
*
|
|
42
|
+
* Network requests to third-party endpoints share the origin of the page
|
|
43
|
+
* that initiated them. This permits the AI to inspect third-party subresources
|
|
44
|
+
* without triggering a cross-origin conversation reset.
|
|
63
45
|
*/
|
|
64
|
-
override
|
|
65
|
-
return this.#request.
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
override getOrigin(): string {
|
|
69
|
-
return getRequestContextOrigin(this.#request);
|
|
46
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
47
|
+
return this.#request.initiatorSecurityOrigin();
|
|
70
48
|
}
|
|
71
49
|
|
|
72
50
|
override getItem(): SDK.NetworkRequest.NetworkRequest {
|
|
@@ -77,13 +55,19 @@ export class RequestContext extends ConversationContext<SDK.NetworkRequest.Netwo
|
|
|
77
55
|
return this.#request.name();
|
|
78
56
|
}
|
|
79
57
|
|
|
58
|
+
#createFormatter(): NetworkRequestFormatter {
|
|
59
|
+
return new NetworkRequestFormatter(this.#request, this.#calculator, {
|
|
60
|
+
accessingSecurityOrigin: this.#request.initiatorSecurityOrigin(),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
80
64
|
override async getPromptDetails(): Promise<string|null> {
|
|
81
|
-
const formatter =
|
|
65
|
+
const formatter = this.#createFormatter();
|
|
82
66
|
return `# Selected network request\n${await formatter.formatNetworkRequest()}`;
|
|
83
67
|
}
|
|
84
68
|
|
|
85
69
|
override async getUserFacingDetails(): Promise<[ContextDetail, ...ContextDetail[]]|null> {
|
|
86
|
-
const formatter =
|
|
70
|
+
const formatter = this.#createFormatter();
|
|
87
71
|
const requestContextDetail: ContextDetail = {
|
|
88
72
|
title: lockedString(UIStringsNotTranslate.request),
|
|
89
73
|
text: lockedString(UIStringsNotTranslate.requestUrl) + ': ' + this.#request.url() + '\n\n' +
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
5
6
|
import {
|
|
6
7
|
ConversationContext,
|
|
7
8
|
type ConversationSuggestions,
|
|
@@ -16,8 +17,18 @@ export class StorageContext extends ConversationContext<StorageItem> {
|
|
|
16
17
|
this.#item = item;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Returns the security origin of the primary inspected page target.
|
|
22
|
+
*
|
|
23
|
+
* The storage context binds to `primaryTargetOrigin` rather than the specific
|
|
24
|
+
* item origin (`this.#item.origin`). This allows generic storage views
|
|
25
|
+
* (which have an empty origin) and third-party storage items to be inspected
|
|
26
|
+
* within the current page conversation.
|
|
27
|
+
*
|
|
28
|
+
* @returns The security origin of the primary page target.
|
|
29
|
+
*/
|
|
30
|
+
override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
|
|
31
|
+
return SDK.SecurityOrigin.SecurityOrigin.create(this.#item.primaryTargetOrigin);
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
override getItem(): StorageItem {
|
|
@@ -38,7 +49,7 @@ export class StorageContext extends ConversationContext<StorageItem> {
|
|
|
38
49
|
const prefix = this.#item.type === 'localStorage' ? 'local storage' : 'session storage';
|
|
39
50
|
return `${prefix}${this.#item.isGenericContext ? '' : `: ${this.#item.origin}`}`;
|
|
40
51
|
}
|
|
41
|
-
return `Storage: ${this.getOrigin()}`;
|
|
52
|
+
return `Storage: ${this.getOrigin().siteId()}`;
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
/**
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Bindings from '../../bindings/bindings.js';
|
|
6
6
|
import * as Logs from '../../logs/logs.js';
|
|
7
|
-
import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
|
|
8
7
|
import type * as Workspace from '../../workspace/workspace.js';
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import {formatRequestInitiatorChain} from './NetworkRequestFormatter.js';
|
|
11
10
|
|
|
12
11
|
const MAX_FILE_SIZE = 10000;
|
|
13
12
|
|
|
@@ -75,10 +74,8 @@ export class FileFormatter {
|
|
|
75
74
|
];
|
|
76
75
|
const resource = Bindings.ResourceUtils.resourceForURL(this.#file.url());
|
|
77
76
|
if (resource?.request) {
|
|
78
|
-
const calculator = new NetworkTimeCalculator.NetworkTransferTimeCalculator();
|
|
79
|
-
calculator.updateBoundaries(resource.request);
|
|
80
77
|
lines.push(`Request initiator chain:
|
|
81
|
-
${
|
|
78
|
+
${formatRequestInitiatorChain(resource.request, this.#networkLog)}`);
|
|
82
79
|
}
|
|
83
80
|
lines.push(`File content:
|
|
84
81
|
${this.#formatFileContent()}`);
|