chrome-devtools-frontend 1.0.1739869 → 1.0.1742811
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/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +44 -7
- package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +1 -1
- package/.agents/skills/code-review/SKILL.md +23 -6
- package/.agents/skills/devtools-verification/SKILL.md +2 -1
- package/.agents/skills/migrate-chromium-test/SKILL.md +1 -0
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -11
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +41 -23
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +12 -7
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -0
- package/.agents/skills/ui-widgets/SKILL.md +22 -7
- package/.agents/skills/version-control/SKILL.md +10 -1
- package/.agents/skills/visual-regression-audit/SKILL.md +88 -0
- package/.gitallowed +2 -1
- package/.stylelintignore +1 -0
- package/.stylelintrc.json +2 -0
- package/AUTHORS +1 -0
- package/DIR_METADATA +2 -1
- package/PRESUBMIT_test.py +143 -0
- package/config/owner/INFRA_OWNERS +0 -1
- package/docs/contributing/infrastructure.md +2 -2
- package/docs/ui_engineering.md +14 -4
- package/eslint.config.mjs +1 -18
- package/front_end/application_tokens.css +0 -35
- package/front_end/core/host/AidaClient.ts +1 -1
- package/front_end/core/host/AidaClientTypes.ts +2 -0
- package/front_end/core/host/AidaErrors.ts +3 -3
- package/front_end/core/host/AidaGcaTranslation.ts +39 -0
- package/front_end/core/host/GcaClient.ts +32 -20
- package/front_end/core/host/GcaTypes.ts +4 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/i18n/DevToolsLocale.ts +0 -1
- package/front_end/core/sdk/DebuggerModel.ts +25 -13
- package/front_end/core/sdk/PreloadingModel.ts +2 -2
- package/front_end/core/sdk/RehydratingConnection.ts +59 -30
- package/front_end/core/sdk/StorageKeyManager.ts +0 -1
- package/front_end/core/sdk/Target.ts +6 -0
- package/front_end/core/sdk/TargetManager.ts +10 -4
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +12 -2
- package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +159 -52
- package/front_end/entrypoints/inspector_main/outermostTargetSelector.css +77 -25
- package/front_end/entrypoints/main/MainImpl.ts +32 -15
- package/front_end/models/ai_assistance/AiAgent2.ts +95 -46
- package/front_end/models/ai_assistance/AiConversation.ts +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +5 -4
- package/front_end/models/ai_assistance/performance/AICallTree.ts +7 -9
- package/front_end/models/ai_assistance/performance/AIQueries.ts +4 -8
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +11 -1
- package/front_end/models/ai_assistance/skills/lighthouse.md +1 -0
- package/front_end/models/ai_assistance/skills/network.md +3 -4
- package/front_end/models/ai_assistance/skills/sources.md +1 -2
- package/front_end/models/ai_assistance/skills/styling.md +3 -4
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +11 -3
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +84 -23
- package/front_end/models/ai_assistance/tools/ListSources.ts +41 -13
- package/front_end/models/badges/Badge.ts +0 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -4
- package/front_end/models/breakpoints/RecurringPauseDetector.ts +140 -0
- package/front_end/models/breakpoints/breakpoints.ts +2 -1
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +2 -2
- package/front_end/models/persistence/Automapping.ts +0 -1
- package/front_end/models/trace/Processor.ts +16 -7
- package/front_end/models/trace/README.md +17 -1
- package/front_end/models/trace/extras/ThirdParties.ts +4 -6
- package/front_end/models/trace/extras/TraceTree.ts +69 -72
- package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
- package/front_end/models/trace/handlers/types.ts +15 -0
- package/front_end/models/trace/helpers/Trace.ts +5 -3
- package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -1
- package/front_end/models/web_mcp/WebMCPModel.ts +19 -9
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +30 -3
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +1 -22
- package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -19
- package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -1
- package/front_end/panels/ai_assistance/components/walkthroughView.css +0 -13
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +3 -2
- package/front_end/panels/animation/AnimationTimeline.ts +5 -3
- package/front_end/panels/animation/animationTimeline.css +10 -8
- package/front_end/panels/application/ApplicationPanelSidebar.ts +14 -11
- package/front_end/panels/application/ReportingApiView.ts +0 -1
- package/front_end/panels/application/SubAppsView.ts +0 -1
- package/front_end/panels/application/WebMCPTreeElement.ts +3 -6
- package/front_end/panels/application/WebMCPView.ts +30 -0
- package/front_end/panels/application/components/ReportsGrid.ts +0 -1
- package/front_end/panels/application/components/backForwardCacheView.css +0 -7
- package/front_end/panels/application/components/permissionsPolicySection.css +2 -2
- package/front_end/panels/application/components/protocolHandlersView.css +46 -39
- package/front_end/panels/application/components/trustTokensView.css +0 -4
- package/front_end/panels/application/cookieItemsView.css +0 -7
- package/front_end/panels/application/indexedDBViews.css +0 -6
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +0 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +0 -1
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -5
- package/front_end/panels/application/preloading/components/preloadingGrid.css +0 -9
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -9
- package/front_end/panels/application/serviceWorkersView.css +5 -4
- package/front_end/panels/application/storageView.css +0 -5
- package/front_end/panels/application/webMCPView.css +17 -0
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +15 -20
- package/front_end/panels/changes/changesView.css +0 -5
- package/front_end/panels/common/ExtensionServer.ts +80 -10
- package/front_end/panels/console/ConsolePanel.ts +92 -18
- package/front_end/panels/console/consoleContextSelector.css +1 -8
- package/front_end/panels/console/consoleInsightTeaser.css +10 -17
- package/front_end/panels/console/consolePinPane.css +3 -1
- package/front_end/panels/console/consoleView.css +13 -17
- package/front_end/panels/coverage/coverageListView.css +0 -4
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -22
- package/front_end/panels/css_overview/cssOverviewStartView.css +0 -43
- package/front_end/panels/developer_resources/developerResourcesListView.css +0 -4
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +52 -45
- package/front_end/panels/elements/LayoutPane.ts +1 -3
- package/front_end/panels/elements/PropertiesWidget.ts +26 -8
- package/front_end/panels/elements/PropertyRenderer.ts +45 -21
- package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -7
- package/front_end/panels/elements/StyleEditorWidget.ts +110 -63
- package/front_end/panels/elements/StylePropertiesSection.ts +14 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +529 -518
- package/front_end/panels/elements/StylesContainer.ts +5 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
- package/front_end/panels/elements/components/CSSVariableValueView.ts +17 -4
- package/front_end/panels/elements/components/StylePropertyEditor.ts +178 -140
- package/front_end/panels/elements/components/cssQuery.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +60 -56
- package/front_end/panels/elements/layoutPane.css +2 -2
- package/front_end/panels/elements/metricsSidebarPane.css +6 -7
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -6
- package/front_end/panels/elements/stylesSidebarPane.css +3 -4
- package/front_end/panels/emulation/deviceModeView.css +1 -1
- package/front_end/panels/event_listeners/EventListenersView.ts +9 -2
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +1 -2
- package/front_end/panels/issues/issuesTree.css +6 -43
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
- package/front_end/panels/layer_viewer/paintProfiler.css +4 -3
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -6
- package/front_end/panels/lighthouse/lighthouseStartView.css +5 -16
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +0 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +1 -1
- package/front_end/panels/media/playerListView.css +1 -2
- package/front_end/panels/media/playerPropertiesView.css +1 -1
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +2 -2
- package/front_end/panels/network/NetworkLogView.ts +594 -580
- package/front_end/panels/network/RequestCookiesView.ts +0 -1
- package/front_end/panels/network/networkConfigView.css +1 -2
- package/front_end/panels/network/networkLogView.css +363 -364
- package/front_end/panels/network/networkPanel.css +1 -5
- package/front_end/panels/network/networkTimingTable.css +1 -1
- package/front_end/panels/network/networkWaterfallColumn.css +1 -1
- package/front_end/panels/network/requestConditionsDrawer.css +0 -4
- package/front_end/panels/network/requestCookiesView.css +7 -1
- package/front_end/panels/network/requestPayloadTree.css +0 -4
- package/front_end/panels/profiler/HeapProfileView.ts +1 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +0 -7
- package/front_end/panels/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/recorder/RecordingView.ts +10 -10
- package/front_end/panels/recorder/StepView.ts +5 -4
- package/front_end/panels/recorder/createRecordingView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +0 -8
- package/front_end/panels/recorder/recordingListView.css +4 -4
- package/front_end/panels/recorder/recordingView.css +12 -20
- package/front_end/panels/recorder/stepEditor.css +4 -4
- package/front_end/panels/recorder/stepView.css +31 -9
- package/front_end/panels/recorder/timelineSection.css +4 -0
- package/front_end/panels/screencast/ScreencastApp.ts +0 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/security/originView.css +2 -2
- package/front_end/panels/sensors/SensorsView.ts +273 -346
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +0 -1
- package/front_end/panels/settings/backendLinkingSettingsTab.css +7 -7
- package/front_end/panels/settings/components/syncSection.css +0 -1
- package/front_end/panels/settings/workspaceSettingsTab.css +0 -5
- package/front_end/panels/sources/CSSPlugin.ts +177 -98
- package/front_end/panels/sources/DebuggerPausedMessage.ts +100 -27
- package/front_end/panels/sources/NavigatorView.ts +926 -946
- package/front_end/panels/sources/SourcesPanel.ts +9 -2
- package/front_end/panels/sources/breakpointsView.css +6 -29
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/sources/debuggerPausedMessage.css +7 -0
- package/front_end/panels/sources/navigatorTree.css +7 -2
- package/front_end/panels/sources/sourcesNavigator.css +0 -9
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -10
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +0 -10
- package/front_end/panels/timeline/ModificationsManager.ts +0 -1
- package/front_end/panels/timeline/ThreadAppender.ts +2 -6
- package/front_end/panels/timeline/TimelinePanel.ts +2 -2
- package/front_end/panels/timeline/TimelineTreeView.ts +38 -41
- package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
- package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -6
- package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -12
- package/front_end/panels/timeline/components/interactionBreakdown.css +1 -2
- package/front_end/panels/timeline/components/layoutShiftDetails.css +2 -9
- package/front_end/panels/timeline/components/liveMetricsView.css +0 -16
- package/front_end/panels/timeline/components/metricCard.css +1 -5
- package/front_end/panels/timeline/components/networkRequestDetails.css +3 -4
- package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
- package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -2
- package/front_end/panels/timeline/timelineDetailsView.css +1 -12
- package/front_end/panels/timeline/timelineFlamechartPopover.css +0 -4
- package/front_end/panels/timeline/timelineMiniMap.css +1 -4
- package/front_end/panels/timeline/timelinePanel.css +0 -4
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/timeline/timelineTreeView.css +0 -12
- package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
- package/front_end/panels/webauthn/webauthnPane.css +1 -7
- package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/adorners/adorner.css +1 -1
- package/front_end/ui/components/buttons/button.css +0 -28
- package/front_end/ui/components/buttons/textButton.css +1 -45
- package/front_end/ui/components/input/checkbox.css +3 -3
- package/front_end/ui/components/issue_counter/issueLinkIcon.css +2 -2
- package/front_end/ui/components/menus/Menu.ts +14 -0
- package/front_end/ui/components/menus/menu.css +2 -14
- package/front_end/ui/components/menus/menuItem.css +0 -4
- package/front_end/ui/components/request_link_icon/requestLinkIcon.css +2 -2
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/survey_link/surveyLink.css +3 -3
- package/front_end/ui/components/switch/switch.css +3 -2
- package/front_end/ui/components/text_editor/theme.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +3 -3
- package/front_end/ui/components/tree_outline/treeOutline.css +0 -23
- package/front_end/ui/legacy/ContextMenu.ts +5 -5
- package/front_end/ui/legacy/SoftContextMenu.ts +24 -8
- package/front_end/ui/legacy/Toolbar.ts +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +31 -78
- package/front_end/ui/legacy/UIUtils.ts +9 -17
- package/front_end/ui/legacy/checkboxTextLabel.css +2 -44
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +39 -27
- package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -10
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +2 -6
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +34 -26
- package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/swatchPopover.css +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +49 -1
- package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -9
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +2 -1
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +0 -5
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +6 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +95 -1
- package/front_end/ui/legacy/filter.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +6 -28
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/progressIndicator.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/front_end/ui/visual_logging/LoggingDriver.ts +4 -0
- package/front_end/ui/visual_logging/visual_logging.ts +1 -1
- package/inspector_overlay/common.ts +0 -3
- package/inspector_overlay/main.ts +1 -3
- package/inspector_overlay/tool_source_order.css +0 -4
- package/package.json +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +0 -9705
|
@@ -94,6 +94,10 @@ function mapCommonAidaRequestFields(aidaRequest: AidaRequest, gcaRequest: GCA.Ge
|
|
|
94
94
|
temperature: aidaRequest.options.temperature,
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
if (aidaRequest.metadata?.string_session_id) {
|
|
98
|
+
// Populate top-level sessionId for server-side session affinity; labels['session_id'] only sets a sanitized GCP label.
|
|
99
|
+
gcaRequest.sessionId = aidaRequest.metadata.string_session_id;
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
export function gcaResponseToAidaDoConversationResponse(response: GCA.GenerateContentResponse):
|
|
@@ -501,6 +505,33 @@ function convertAidaParamToGcaSchema<T extends string|number|symbol = string>(pa
|
|
|
501
505
|
return schema;
|
|
502
506
|
}
|
|
503
507
|
|
|
508
|
+
// `FinishReason` covers normal completion ('STOP'), failures (for example 'MAX_TOKENS'),
|
|
509
|
+
// and content blocks. Only the reasons below mean that GCA blocked the candidate output.
|
|
510
|
+
const BLOCKING_FINISH_REASONS = new Set<string>([
|
|
511
|
+
'SAFETY',
|
|
512
|
+
'RECITATION',
|
|
513
|
+
'BLOCKLIST',
|
|
514
|
+
'PROHIBITED_CONTENT',
|
|
515
|
+
'SPII',
|
|
516
|
+
'IMAGE_SAFETY',
|
|
517
|
+
'IMAGE_PROHIBITED_CONTENT',
|
|
518
|
+
'IMAGE_RECITATION',
|
|
519
|
+
]);
|
|
520
|
+
|
|
521
|
+
// GCA JSON responses send enum names (for example 'STOP'), while the GcaTypes enums and test fixtures use numbers.
|
|
522
|
+
function enumName(value: number|string|undefined, names: Record<number, string>): string|undefined {
|
|
523
|
+
return typeof value === 'number' ? names[value] : value;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Setting `RecitationAction.BLOCK` makes `AidaClient` throw `AidaBlockError`.
|
|
527
|
+
function blockedChunk(metadata: AIDA.ResponseMetadata, blockMessage: string): AIDA.AidaChunkResponse {
|
|
528
|
+
const citations = metadata.attributionMetadata?.citations ?? [];
|
|
529
|
+
return {
|
|
530
|
+
metadata: {...metadata, attributionMetadata: {attributionAction: AIDA.RecitationAction.BLOCK, citations}},
|
|
531
|
+
blockMessage,
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
504
535
|
export function gcaChunkResponseToAidaChunkResponse(response: GCA.GenerateContentResponse): AIDA.AidaChunkResponse[] {
|
|
505
536
|
try {
|
|
506
537
|
if (response.error) {
|
|
@@ -533,6 +564,14 @@ export function gcaChunkResponseToAidaChunkResponse(response: GCA.GenerateConten
|
|
|
533
564
|
})),
|
|
534
565
|
};
|
|
535
566
|
}
|
|
567
|
+
const blockReason = enumName(response.promptFeedback?.blockReason, GCA.BlockReason);
|
|
568
|
+
if (blockReason && blockReason !== 'BLOCKED_REASON_UNSPECIFIED') {
|
|
569
|
+
return [blockedChunk(metadata, `GCA prompt blocked: ${blockReason}`)];
|
|
570
|
+
}
|
|
571
|
+
const finishReason = enumName(candidate?.finishReason, GCA.FinishReason);
|
|
572
|
+
if (finishReason && BLOCKING_FINISH_REASONS.has(finishReason)) {
|
|
573
|
+
return [blockedChunk(metadata, `GCA response blocked: ${finishReason}`)];
|
|
574
|
+
}
|
|
536
575
|
// Trailing chunks without parts still yield metadata so the client receives the final
|
|
537
576
|
// rpcGlobalId, modelVersion, usageMetadata, and citationMetadata.
|
|
538
577
|
const chunks: AIDA.AidaChunkResponse[] = parts.length === 0 ? [{metadata}] : parts.map(part => {
|
|
@@ -26,6 +26,9 @@ import type {GenerateContentRequest, GenerateContentResponse} from './GcaTypes.j
|
|
|
26
26
|
import type {AidaClientResult} from './InspectorFrontendHostAPI.js';
|
|
27
27
|
|
|
28
28
|
const SERVICE_NAME = 'gcaService';
|
|
29
|
+
const OPT_OUT_DATA_COLLECTION_HEADER = {
|
|
30
|
+
'User-Agent': 'Chrome (aidev_client; datacollection_opt_in=false)',
|
|
31
|
+
};
|
|
29
32
|
|
|
30
33
|
const ENDPOINTS = {
|
|
31
34
|
CONTENT: '/v1beta:generateContent',
|
|
@@ -38,19 +41,25 @@ export class GcaClient {
|
|
|
38
41
|
return Root.Runtime.hostConfig.devToolsUseGcaApi?.enabled;
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
#getHeaders(disableUserContentLogging: boolean): Record<string, string>|undefined {
|
|
45
|
+
// Only send the User-Agent override when logging is disabled; otherwise omit it so
|
|
46
|
+
// GCA runs its own server-side eligibility and preference checks.
|
|
47
|
+
return disableUserContentLogging ? OPT_OUT_DATA_COLLECTION_HEADER : undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
async conversationRequest(request: DoConversationRequest, streamId: number, options?: {signal?: AbortSignal}):
|
|
42
51
|
Promise<void> {
|
|
43
52
|
try {
|
|
44
53
|
const gcaRequest = aidaDoConversationRequestToGcaRequest(request);
|
|
45
|
-
const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateContentResponse>(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateContentResponse>({
|
|
55
|
+
service: SERVICE_NAME,
|
|
56
|
+
path: ENDPOINTS.STREAM_CONTENT,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body: JSON.stringify(gcaRequest),
|
|
59
|
+
headers: this.#getHeaders(request.metadata.disable_user_content_logging),
|
|
60
|
+
streamId,
|
|
61
|
+
},
|
|
62
|
+
options);
|
|
54
63
|
debugLog('GCA conversation request succeeded:', JSON.stringify(request), JSON.stringify(response));
|
|
55
64
|
} catch (err) {
|
|
56
65
|
debugLog('GCA request failed:', JSON.stringify(request), err);
|
|
@@ -65,6 +74,7 @@ export class GcaClient {
|
|
|
65
74
|
path: ENDPOINTS.SEND_TELEMETRY,
|
|
66
75
|
method: 'POST',
|
|
67
76
|
body: JSON.stringify(gcaEvent),
|
|
77
|
+
headers: this.#getHeaders(clientEvent.disable_user_content_logging),
|
|
68
78
|
});
|
|
69
79
|
return response.then(
|
|
70
80
|
result => {
|
|
@@ -79,27 +89,29 @@ export class GcaClient {
|
|
|
79
89
|
|
|
80
90
|
async completeCode(request: CompletionRequest): Promise<CompletionResponse> {
|
|
81
91
|
const gcaRequest = aidaCompletionRequestToGcaRequest(request);
|
|
82
|
-
const result =
|
|
92
|
+
const result =
|
|
93
|
+
await this.#requestContent(gcaRequest, this.#getHeaders(request.metadata.disable_user_content_logging));
|
|
83
94
|
return gcaResponseToAidaCompletionResponse(result);
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}): Promise<GenerateCodeResponse> {
|
|
87
98
|
const gcaRequest = aidaGenerateCodeRequestToGcaRequest(request);
|
|
88
|
-
const result = await this.#requestContent(gcaRequest,
|
|
99
|
+
const result = await this.#requestContent(gcaRequest,
|
|
100
|
+
this.#getHeaders(request.metadata.disable_user_content_logging), options);
|
|
89
101
|
return gcaResponseToAidaGenerateCodeResponse(result);
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
async #requestContent(request: GenerateContentRequest,
|
|
104
|
+
async #requestContent(request: GenerateContentRequest, headers: Record<string, string>|undefined,
|
|
93
105
|
options?: {signal?: AbortSignal}): Promise<GenerateContentResponse> {
|
|
94
106
|
try {
|
|
95
|
-
const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateContentResponse>(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateContentResponse>({
|
|
108
|
+
service: SERVICE_NAME,
|
|
109
|
+
path: ENDPOINTS.CONTENT,
|
|
110
|
+
method: 'POST',
|
|
111
|
+
body: JSON.stringify(request),
|
|
112
|
+
headers,
|
|
113
|
+
},
|
|
114
|
+
options);
|
|
103
115
|
debugLog('GCA request succeeded:', JSON.stringify(request), JSON.stringify(response));
|
|
104
116
|
return response;
|
|
105
117
|
} catch (err) {
|
|
@@ -339,7 +339,8 @@ export interface GenerateContentResponse {
|
|
|
339
339
|
export interface Candidate {
|
|
340
340
|
index: number;
|
|
341
341
|
content: Content;
|
|
342
|
-
|
|
342
|
+
// GCA JSON responses send the enum name (for example 'STOP'), while `FinishReason` is a numeric enum.
|
|
343
|
+
finishReason: FinishReason|keyof typeof FinishReason;
|
|
343
344
|
safetyRatings: SafetyRating[];
|
|
344
345
|
citationMetadata: CitationMetadata;
|
|
345
346
|
groundingMetadata: GroundingMetadata;
|
|
@@ -423,7 +424,8 @@ export interface PredictionMetadata {
|
|
|
423
424
|
}
|
|
424
425
|
|
|
425
426
|
export interface PromptFeedback {
|
|
426
|
-
|
|
427
|
+
// GCA JSON responses send the enum name (for example 'SAFETY'), while `BlockReason` is a numeric enum.
|
|
428
|
+
blockReason: BlockReason|keyof typeof BlockReason;
|
|
427
429
|
safetyRatings: SafetyRating[];
|
|
428
430
|
blockReasonMessage: string;
|
|
429
431
|
}
|
|
@@ -276,6 +276,7 @@ export type DispatchHttpRequestRequest = {
|
|
|
276
276
|
path: string,
|
|
277
277
|
method: 'GET',
|
|
278
278
|
queryParams?: Record<string, string|string[]>,
|
|
279
|
+
headers?: Record<string, string>,
|
|
279
280
|
streamId?: number,
|
|
280
281
|
body?: never,
|
|
281
282
|
}|{
|
|
@@ -283,6 +284,7 @@ export type DispatchHttpRequestRequest = {
|
|
|
283
284
|
path: string,
|
|
284
285
|
method: 'POST',
|
|
285
286
|
queryParams?: Record<string, string|string[]>,
|
|
287
|
+
headers?: Record<string, string>,
|
|
286
288
|
streamId?: number,
|
|
287
289
|
// A JSON string containing the request body.
|
|
288
290
|
body?: string,
|
|
@@ -34,7 +34,6 @@ export class DevToolsLocale {
|
|
|
34
34
|
private constructor(data: DevToolsLocaleData) {
|
|
35
35
|
this.lookupClosestDevToolsLocale = data.lookupClosestDevToolsLocale;
|
|
36
36
|
|
|
37
|
-
// TODO(crbug.com/1163928): Use constant once setting actually exists.
|
|
38
37
|
if (data.settingLanguage === 'browserLanguage') {
|
|
39
38
|
this.locale = data.navigatorLanguage || 'en-US';
|
|
40
39
|
} else {
|
|
@@ -336,11 +336,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
private onFrameNavigated(): void {
|
|
339
|
-
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
DebuggerModel.shouldResyncDebuggerId = true;
|
|
339
|
+
DebuggerModel.modelsNeedingDebuggerIdResync.add(this);
|
|
344
340
|
}
|
|
345
341
|
|
|
346
342
|
private registerDebugger(response: Protocol.Debugger.EnableResponse): void {
|
|
@@ -349,6 +345,9 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
349
345
|
return;
|
|
350
346
|
}
|
|
351
347
|
const {debuggerId} = response;
|
|
348
|
+
if (typeof this.#debuggerId === 'string' && this.#debuggerId !== debuggerId) {
|
|
349
|
+
debuggerIdToModel.delete(this.#debuggerId);
|
|
350
|
+
}
|
|
352
351
|
debuggerIdToModel.set(debuggerId, this);
|
|
353
352
|
this.#debuggerId = debuggerId;
|
|
354
353
|
this.dispatchEventToListeners(Events.DebuggerIsReadyToPause, this);
|
|
@@ -359,20 +358,30 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
359
358
|
}
|
|
360
359
|
|
|
361
360
|
static async modelForDebuggerId(debuggerId: string): Promise<DebuggerModel|null> {
|
|
362
|
-
|
|
361
|
+
const existingModel = debuggerIdToModel.get(debuggerId);
|
|
362
|
+
if (existingModel) {
|
|
363
|
+
return existingModel;
|
|
364
|
+
}
|
|
365
|
+
if (DebuggerModel.modelsNeedingDebuggerIdResync.size > 0 || DebuggerModel.resyncDebuggerIdPromise) {
|
|
363
366
|
await DebuggerModel.resyncDebuggerIdForModels();
|
|
364
|
-
DebuggerModel.shouldResyncDebuggerId = false;
|
|
365
367
|
}
|
|
366
368
|
return debuggerIdToModel.get(debuggerId) || null;
|
|
367
369
|
}
|
|
368
370
|
|
|
369
371
|
static async resyncDebuggerIdForModels(): Promise<void> {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
if (!DebuggerModel.resyncDebuggerIdPromise) {
|
|
373
|
+
const promise = (async () => {
|
|
374
|
+
while (DebuggerModel.modelsNeedingDebuggerIdResync.size > 0) {
|
|
375
|
+
const dbgModels = Array.from(DebuggerModel.modelsNeedingDebuggerIdResync).filter(m => m.debuggerEnabled());
|
|
376
|
+
DebuggerModel.modelsNeedingDebuggerIdResync.clear();
|
|
377
|
+
await Promise.all(dbgModels.map(m => m.syncDebuggerId()));
|
|
378
|
+
}
|
|
379
|
+
})();
|
|
380
|
+
DebuggerModel.resyncDebuggerIdPromise = promise.finally(() => {
|
|
381
|
+
DebuggerModel.resyncDebuggerIdPromise = null;
|
|
382
|
+
});
|
|
375
383
|
}
|
|
384
|
+
await DebuggerModel.resyncDebuggerIdPromise;
|
|
376
385
|
}
|
|
377
386
|
|
|
378
387
|
private async disableDebugger(): Promise<void> {
|
|
@@ -390,6 +399,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
390
399
|
debuggerIdToModel.delete(this.#debuggerId);
|
|
391
400
|
}
|
|
392
401
|
this.#debuggerId = null;
|
|
402
|
+
DebuggerModel.modelsNeedingDebuggerIdResync.delete(this);
|
|
393
403
|
}
|
|
394
404
|
|
|
395
405
|
private skipAllPauses(skip: boolean): void {
|
|
@@ -949,6 +959,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
949
959
|
}
|
|
950
960
|
|
|
951
961
|
override dispose(): void {
|
|
962
|
+
DebuggerModel.modelsNeedingDebuggerIdResync.delete(this);
|
|
952
963
|
if (this.#debuggerId) {
|
|
953
964
|
debuggerIdToModel.delete(this.#debuggerId);
|
|
954
965
|
}
|
|
@@ -972,7 +983,8 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
972
983
|
await this.enableDebugger();
|
|
973
984
|
}
|
|
974
985
|
|
|
975
|
-
private static
|
|
986
|
+
private static readonly modelsNeedingDebuggerIdResync = new Set<DebuggerModel>();
|
|
987
|
+
private static resyncDebuggerIdPromise: Promise<void>|null = null;
|
|
976
988
|
|
|
977
989
|
getEvaluateOnCallFrameCallback():
|
|
978
990
|
((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null {
|
|
@@ -874,8 +874,8 @@ class PreloadingAttemptRegistry {
|
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
mergePrevious(prev: PreloadingAttemptRegistry): void {
|
|
877
|
-
for (const
|
|
878
|
-
prev.
|
|
877
|
+
for (const attempt of this.map.values()) {
|
|
878
|
+
prev.upsert(attempt);
|
|
879
879
|
}
|
|
880
880
|
|
|
881
881
|
this.map = prev.map;
|
|
@@ -106,6 +106,11 @@ export class RehydratingConnectionTransport implements ProtocolClient.Connection
|
|
|
106
106
|
fetchPromiseForTest?: Promise<void>;
|
|
107
107
|
#onConnectionLost: (message: Platform.UIString.LocalizedString) => void;
|
|
108
108
|
#rehydratingWindow = window;
|
|
109
|
+
// The window we announced ourselves to; the only one allowed to send the trace.
|
|
110
|
+
#hostWindow: Window|null = null;
|
|
111
|
+
// Popup openers (`TimelinePanel.#launchRehydratedSession`) are always same-origin, whereas
|
|
112
|
+
// external tools may embed `trace_app.html` in a cross-origin iframe (crbug.com/453705035).
|
|
113
|
+
#requireSameOriginHost = false;
|
|
109
114
|
#onReceiveHostWindowPayloadBound = this.onReceiveHostWindowPayload.bind(this);
|
|
110
115
|
|
|
111
116
|
constructor(onConnectionLost: (message: Platform.UIString.LocalizedString) => void) {
|
|
@@ -153,33 +158,57 @@ export class RehydratingConnectionTransport implements ProtocolClient.Connection
|
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
#setupMessagePassing(): void {
|
|
156
|
-
this.#rehydratingWindow.addEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
157
161
|
if (this.#rehydratingWindow.opener) {
|
|
162
|
+
this.#hostWindow = this.#rehydratingWindow.opener;
|
|
163
|
+
this.#requireSameOriginHost = true;
|
|
164
|
+
this.#rehydratingWindow.addEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
158
165
|
this.#rehydratingWindow.opener.postMessage({type: 'REHYDRATING_WINDOW_READY'});
|
|
159
166
|
} else if (this.#rehydratingWindow !== window.top) {
|
|
167
|
+
this.#hostWindow = this.#rehydratingWindow.parent;
|
|
168
|
+
this.#requireSameOriginHost = false;
|
|
169
|
+
this.#rehydratingWindow.addEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
160
170
|
this.#rehydratingWindow.parent.postMessage({type: 'REHYDRATING_IFRAME_READY'}, '*');
|
|
161
171
|
} else {
|
|
162
172
|
this.#onConnectionLost(i18nString(UIStrings.noHostWindow));
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
175
|
|
|
176
|
+
/**
|
|
177
|
+
* The trace payload is replayed into the front-end as synthetic CDP events, so only accept it
|
|
178
|
+
* from the window we announced ourselves to. For popups, also require same-origin (matching
|
|
179
|
+
* `TimelinePanel.#launchRehydratedSession`); iframe embedders may be cross-origin
|
|
180
|
+
* (crbug.com/453705035), so `event.source` is checked there.
|
|
181
|
+
*/
|
|
182
|
+
#isFromHostWindow(event: MessageEvent): boolean {
|
|
183
|
+
if (this.#hostWindow === null || event.source !== this.#hostWindow) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
if (this.#requireSameOriginHost && event.origin !== this.#rehydratingWindow.location.origin) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
166
192
|
/**
|
|
167
193
|
* This is a callback for rehydrated session to receive payload from host window. Payload includes but not limited to
|
|
168
194
|
* the trace event and all necessary data to power a rehydrated session.
|
|
169
195
|
*/
|
|
170
196
|
onReceiveHostWindowPayload(event: MessageEvent): void {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
trace = new TraceObject(JSON.parse(traceJson));
|
|
176
|
-
} catch {
|
|
177
|
-
this.#onConnectionLost(i18nString(UIStrings.errorLoadingLog));
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
void this.startHydration(trace);
|
|
197
|
+
// Ignore (and keep listening after) anything that is not the trace from the host window,
|
|
198
|
+
// so a stray or hostile message cannot take the one-shot channel away from the host.
|
|
199
|
+
if (!this.#isFromHostWindow(event) || event.data?.type !== 'REHYDRATING_TRACE_FILE') {
|
|
200
|
+
return;
|
|
181
201
|
}
|
|
182
202
|
this.#rehydratingWindow.removeEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
203
|
+
const traceJson = event.data.traceJson as string;
|
|
204
|
+
let trace;
|
|
205
|
+
try {
|
|
206
|
+
trace = new TraceObject(JSON.parse(traceJson));
|
|
207
|
+
} catch {
|
|
208
|
+
this.#onConnectionLost(i18nString(UIStrings.errorLoadingLog));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
void this.startHydration(trace);
|
|
183
212
|
}
|
|
184
213
|
|
|
185
214
|
async startHydration(trace: TraceObject): Promise<boolean> {
|
|
@@ -285,6 +314,7 @@ export class RehydratingConnectionTransport implements ProtocolClient.Connection
|
|
|
285
314
|
}
|
|
286
315
|
|
|
287
316
|
disconnect(): Promise<void> {
|
|
317
|
+
this.#rehydratingWindow.removeEventListener('message', this.#onReceiveHostWindowPayloadBound);
|
|
288
318
|
return Promise.reject();
|
|
289
319
|
}
|
|
290
320
|
}
|
|
@@ -321,9 +351,9 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
321
351
|
scripts: RehydratingScript[] = [];
|
|
322
352
|
resources: RehydratingResource[] = [];
|
|
323
353
|
|
|
324
|
-
constructor(
|
|
325
|
-
|
|
326
|
-
|
|
354
|
+
constructor(sessionId: number, target: RehydratingTarget, executionContexts: RehydratingExecutionContext[],
|
|
355
|
+
scripts: RehydratingScript[], resources: RehydratingResource[],
|
|
356
|
+
connection: RehydratingConnectionInterface) {
|
|
327
357
|
super(connection);
|
|
328
358
|
this.sessionId = sessionId;
|
|
329
359
|
this.target = target;
|
|
@@ -386,23 +416,22 @@ export class RehydratingSession extends RehydratingSessionBase {
|
|
|
386
416
|
}
|
|
387
417
|
|
|
388
418
|
declareSessionAttachedToTarget(): void {
|
|
389
|
-
this.sendMessageToFrontend(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
canAccessOpener: false,
|
|
402
|
-
},
|
|
403
|
-
},
|
|
419
|
+
this.sendMessageToFrontend({
|
|
420
|
+
method: 'Target.attachedToTarget',
|
|
421
|
+
params: {
|
|
422
|
+
sessionId: this.sessionId,
|
|
423
|
+
waitingForDebugger: false,
|
|
424
|
+
targetInfo: {
|
|
425
|
+
targetId: this.target.targetId,
|
|
426
|
+
type: this.target.type,
|
|
427
|
+
title: this.target.url,
|
|
428
|
+
url: this.target.url,
|
|
429
|
+
attached: true,
|
|
430
|
+
canAccessOpener: false,
|
|
404
431
|
},
|
|
405
|
-
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
/* attachSessionId */ false);
|
|
406
435
|
}
|
|
407
436
|
|
|
408
437
|
// Runtime.Enable indicates that Runtime domain is flushing the event to communicate
|
|
@@ -99,5 +99,4 @@ export interface EventTypes {
|
|
|
99
99
|
[Events.MAIN_STORAGE_KEY_CHANGED]: MainStorageKeyChangedEvent;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// TODO(jarhar): this is the one of the two usages of Capability.None. Do something about it!
|
|
103
102
|
SDKModel.register(StorageKeyManager, {capabilities: Capability.NONE, autostart: false});
|
|
@@ -24,6 +24,7 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
24
24
|
#id: Protocol.Target.TargetID|'main';
|
|
25
25
|
#modelByConstructor = new Map<new(arg1: Target) => SDKModel, SDKModel>();
|
|
26
26
|
#isSuspended: boolean;
|
|
27
|
+
#suspendGeneration = 0;
|
|
27
28
|
/**
|
|
28
29
|
* Generally when a target crashes we don't need to know, with one exception.
|
|
29
30
|
* If a target crashes during the recording of a performance trace, after the
|
|
@@ -256,6 +257,7 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
256
257
|
return;
|
|
257
258
|
}
|
|
258
259
|
this.#isSuspended = true;
|
|
260
|
+
const generation = ++this.#suspendGeneration;
|
|
259
261
|
|
|
260
262
|
// If the target has crashed, we will not attempt to suspend all the
|
|
261
263
|
// models, but we still mark it as suspended so we correctly track the
|
|
@@ -265,6 +267,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
await Promise.all(Array.from(this.models().values(), m => m.preSuspendModel(reason)));
|
|
270
|
+
if (generation !== this.#suspendGeneration) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
268
273
|
await Promise.all(Array.from(this.models().values(), m => m.suspendModel(reason)));
|
|
269
274
|
}
|
|
270
275
|
|
|
@@ -273,6 +278,7 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
273
278
|
return;
|
|
274
279
|
}
|
|
275
280
|
this.#isSuspended = false;
|
|
281
|
+
++this.#suspendGeneration;
|
|
276
282
|
|
|
277
283
|
if (this.#hasCrashed) {
|
|
278
284
|
return;
|
|
@@ -159,7 +159,10 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
159
159
|
}
|
|
160
160
|
this.#isSuspended = true;
|
|
161
161
|
this.dispatchEventToListeners(Events.SUSPEND_STATE_CHANGED);
|
|
162
|
-
const suspendPromises = Array.from(this.#targets.values(), target =>
|
|
162
|
+
const suspendPromises = Array.from(this.#targets.values(), async target => {
|
|
163
|
+
await this.#waitForPromiseWithTimeout(target.suspend(reason),
|
|
164
|
+
`Timeout waiting for target ${target.name()} to suspend`);
|
|
165
|
+
});
|
|
163
166
|
await Promise.all(suspendPromises);
|
|
164
167
|
}
|
|
165
168
|
|
|
@@ -169,9 +172,12 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
169
172
|
this.getConsole().warn(timeoutMessage);
|
|
170
173
|
timeoutResolve();
|
|
171
174
|
}, 2000);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
try {
|
|
176
|
+
await Promise.race([promise, timeoutPromise]);
|
|
177
|
+
} finally {
|
|
178
|
+
globalThis.clearTimeout(timeoutId);
|
|
179
|
+
timeoutResolve(); // avoids "pending async operations" error from test harness.
|
|
180
|
+
}
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
async resumeAllTargets(): Promise<void> {
|
|
@@ -3628,8 +3628,18 @@ export abstract class HeapSnapshot {
|
|
|
3628
3628
|
|
|
3629
3629
|
const matchingIndexes: number[] = [];
|
|
3630
3630
|
|
|
3631
|
-
|
|
3632
|
-
|
|
3631
|
+
function toPattern(pattern?: string|RegExp): RegExp|undefined {
|
|
3632
|
+
if (typeof pattern === 'string') {
|
|
3633
|
+
return pattern ? new RegExp(pattern, 'i') : undefined;
|
|
3634
|
+
}
|
|
3635
|
+
if (pattern && (pattern.global || pattern.sticky)) {
|
|
3636
|
+
return new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ''));
|
|
3637
|
+
}
|
|
3638
|
+
return pattern;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
const classNamePattern = toPattern(queryOptions.className);
|
|
3642
|
+
const propertyNamePattern = toPattern(queryOptions.propertyName);
|
|
3633
3643
|
const targetNodeType = queryOptions.nodeType ? queryOptions.nodeType.toLowerCase() : null;
|
|
3634
3644
|
|
|
3635
3645
|
const node = this.rootNode();
|