chrome-devtools-frontend 1.0.1675430 → 1.0.1676824
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/WATCHLISTS +0 -4
- package/front_end/core/common/Settings.ts +0 -66
- package/front_end/core/root/Runtime.ts +0 -5
- package/front_end/core/sdk/CSSMetadata.ts +5 -9
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +8 -28
- package/front_end/core/sdk/DebuggerModel.ts +50 -30
- package/front_end/core/sdk/ResourceTreeModel.ts +20 -1
- package/front_end/core/sdk/Script.ts +9 -53
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +213 -23
- package/front_end/entrypoints/main/MainImpl.ts +31 -0
- package/front_end/generated/InspectorBackendCommands.ts +3 -1
- package/front_end/generated/SupportedCSSProperties.ts +21 -4
- package/front_end/generated/protocol-mapping.d.ts +14 -0
- package/front_end/generated/protocol-proxy-api.d.ts +10 -0
- package/front_end/generated/protocol.ts +35 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +11 -0
- package/front_end/models/ai_assistance/AiConversation.ts +22 -5
- package/front_end/models/ai_assistance/README.md +52 -26
- package/front_end/models/ai_assistance/agents/AiAgent.ts +54 -8
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +7 -194
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +8 -87
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +16 -0
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +124 -0
- package/front_end/models/ai_assistance/contexts/StorageContext.ts +111 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +69 -1
- package/front_end/models/ai_assistance/skills/README.md +63 -1
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +4 -0
- package/front_end/models/ai_assistance/skills/performance.md +8 -0
- package/front_end/models/ai_assistance/skills/sources.md +16 -0
- package/front_end/models/ai_assistance/skills/storage.md +31 -0
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +101 -0
- package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +83 -0
- package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +106 -0
- package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +104 -0
- package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +81 -0
- package/front_end/models/ai_assistance/tools/ListSources.ts +116 -0
- package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +90 -0
- package/front_end/models/ai_assistance/tools/Tool.ts +22 -1
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +14 -0
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +4 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +3 -201
- package/front_end/models/bindings/SASSSourceMapping.ts +6 -0
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -49
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +27 -0
- package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +10 -2
- package/front_end/models/issues_manager/descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/front_end/models/issues_manager/descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/front_end/models/issues_manager/descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/persistence/IsolatedFileSystem.ts +7 -8
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +2 -2
- package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
- package/front_end/models/persistence/persistence-meta.ts +9 -9
- package/front_end/models/trace/types/TraceEvents.ts +36 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -3
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +36 -36
- package/front_end/panels/accessibility/AccessibilityStrings.ts +168 -168
- package/front_end/panels/accessibility/SourceOrderView.ts +7 -7
- package/front_end/panels/accessibility/accessibility-meta.ts +2 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
- package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -3
- package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +27 -2
- package/front_end/panels/application/IndexedDBViews.ts +65 -63
- package/front_end/panels/application/WebMCPView.ts +16 -7
- package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +5 -5
- package/front_end/panels/common/BadgeNotification.ts +8 -8
- package/front_end/panels/common/ExtensionServer.ts +21 -1
- package/front_end/panels/common/GdpSignUpDialog.ts +16 -16
- package/front_end/panels/common/GeminiRebrandPromoDialog.ts +5 -6
- package/front_end/panels/common/PersistenceUtils.ts +2 -2
- package/front_end/panels/common/common.ts +0 -97
- package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -2
- package/front_end/panels/console/ConsolePinPane.ts +2 -2
- package/front_end/panels/console/ConsoleView.ts +20 -19
- package/front_end/panels/elements/LayoutPane.ts +2 -8
- package/front_end/panels/event_listeners/EventListenersView.ts +8 -4
- package/front_end/panels/issues/AffectedTrackingSitesView.ts +25 -14
- package/front_end/panels/media/PlayerMessagesView.ts +149 -68
- package/front_end/panels/network/NetworkPanel.ts +1 -1
- package/front_end/panels/network/RequestPayloadView.ts +1 -0
- package/front_end/panels/profiler/HeapSnapshotView.ts +0 -2
- package/front_end/panels/profiler/heapProfiler.css +0 -9
- package/front_end/panels/recorder/RecorderPanel.ts +2 -3
- package/front_end/panels/screencast/ScreencastView.ts +148 -138
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -2
- package/front_end/panels/sources/DebuggerPlugin.ts +9 -58
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +3 -8
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +4 -2
- package/front_end/panels/timeline/TimelineController.ts +36 -64
- package/front_end/panels/timeline/TimelinePanel.ts +11 -8
- package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
- package/front_end/panels/timeline/timelinePanel.css +0 -10
- package/front_end/panels/utils/utils.ts +7 -7
- package/front_end/services/tracing/PerformanceTracing.ts +5 -17
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/package.json +2 -2
- package/front_end/third_party/codemirror.next/rebuild.sh +4 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +436 -10
- package/front_end/ui/comments/CommentManager.ts +640 -0
- package/front_end/ui/comments/CommentsOverlayWidget.ts +121 -0
- package/front_end/ui/comments/comments.ts +4 -0
- package/front_end/ui/comments/commentsOverlay.css +49 -0
- package/front_end/{panels/common → ui/components/dialogs}/FreDialog.ts +6 -6
- package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +96 -0
- package/front_end/ui/components/dialogs/dialogs.ts +4 -0
- package/front_end/ui/components/settings/SettingCheckbox.ts +3 -3
- package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionDisclaimer.ts +13 -13
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +7 -6
- package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionTeaser.ts +43 -46
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +22 -26
- package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationTeaser.ts +10 -10
- package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationUpgradeDialog.ts +5 -5
- package/front_end/ui/components/text_editor/text_editor.ts +4 -0
- package/front_end/ui/legacy/Toolbar.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +11 -3
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +270 -162
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +5 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -16
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +5 -12
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +8 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +2 -2
- package/front_end/ui/settings/SettingUIRegistration.ts +55 -6
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/mcp/mcp.ts +6 -1
- package/package.json +1 -1
- package/front_end/Images/toolbarResizerVertical.png +0 -0
- package/front_end/emulated_devices/MotoG4-landscape.svg +0 -155
- package/front_end/emulated_devices/MotoG4-portrait.svg +0 -155
- package/front_end/emulated_devices/Nexus5X-landscape.svg +0 -19
- package/front_end/emulated_devices/Nexus5X-portrait.svg +0 -19
- package/front_end/emulated_devices/Nexus6P-landscape.svg +0 -50
- package/front_end/emulated_devices/Nexus6P-portrait.svg +0 -54
- package/front_end/emulated_devices/google-nest-hub-horizontal.png +0 -0
- package/front_end/emulated_devices/google-nest-hub-max-horizontal.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-default-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-default-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-default-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-default-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-navigation-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5-vertical-navigation-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-default-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-default-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-default-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-default-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-2x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-1x.png +0 -0
- package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-2x.png +0 -0
- package/front_end/emulated_devices/iPad-landscape.svg +0 -73
- package/front_end/emulated_devices/iPad-portrait.svg +0 -76
- package/front_end/emulated_devices/iPhone5-landscape.svg +0 -99
- package/front_end/emulated_devices/iPhone5-portrait.svg +0 -83
- package/front_end/emulated_devices/iPhone6-landscape.svg +0 -111
- package/front_end/emulated_devices/iPhone6-portrait.svg +0 -116
- package/front_end/emulated_devices/iPhone6Plus-landscape.svg +0 -118
- package/front_end/emulated_devices/iPhone6Plus-portrait.svg +0 -116
- package/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/README.md +0 -9
- package/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
- package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
- package/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
- package/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
- package/front_end/emulated_devices/optimized/optimized_images.gni +0 -53
- package/front_end/models/ai_assistance/agents/README.md +0 -136
- /package/front_end/{panels/common → ui/components/dialogs}/freDialog.css +0 -0
- /package/front_end/{panels/common/common.css → ui/components/dialogs/typeToAllowDialog.css} +0 -0
- /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionDisclaimer.css +0 -0
- /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionTeaser.css +0 -0
- /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationTeaser.css +0 -0
- /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationUpgradeDialog.css +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright 2026 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Common from '../../../core/common/common.js';
|
|
6
|
+
import * as Host from '../../../core/host/host.js';
|
|
7
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
8
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
9
|
+
import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
type BaseToolCapability,
|
|
13
|
+
type DataHandlerResult,
|
|
14
|
+
type DataTool,
|
|
15
|
+
type ToolArgs,
|
|
16
|
+
ToolName,
|
|
17
|
+
} from './Tool.js';
|
|
18
|
+
|
|
19
|
+
const UIStringsNotTranslate = {
|
|
20
|
+
selectingTraceEvent: 'Selecting trace event',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
const lockedString = i18n.i18n.lockedString;
|
|
24
|
+
|
|
25
|
+
export interface SelectTraceEventByKeyArgs extends ToolArgs {
|
|
26
|
+
eventKey: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class SelectTraceEventByKeyTool implements DataTool<SelectTraceEventByKeyArgs, string, BaseToolCapability> {
|
|
30
|
+
readonly name = ToolName.SELECT_TRACE_EVENT_BY_KEY;
|
|
31
|
+
readonly description = 'Selects and reveals a specific event by its key in the Performance panel Flamechart.';
|
|
32
|
+
|
|
33
|
+
readonly parameters: Host.AidaClient.FunctionObjectParam<keyof SelectTraceEventByKeyArgs> = {
|
|
34
|
+
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
35
|
+
description: 'Arguments for selecting a trace event.',
|
|
36
|
+
nullable: false,
|
|
37
|
+
properties: {
|
|
38
|
+
eventKey: {
|
|
39
|
+
type: Host.AidaClient.ParametersTypes.STRING,
|
|
40
|
+
description: 'The key of the event to select.',
|
|
41
|
+
nullable: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
required: ['eventKey'],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
displayInfoFromArgs(params: SelectTraceEventByKeyArgs): {
|
|
48
|
+
title: string,
|
|
49
|
+
action: string,
|
|
50
|
+
} {
|
|
51
|
+
return {
|
|
52
|
+
title: lockedString(UIStringsNotTranslate.selectingTraceEvent),
|
|
53
|
+
action: `selectTraceEventByKey('${params.eventKey}')`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async handler(
|
|
58
|
+
params: SelectTraceEventByKeyArgs,
|
|
59
|
+
capabilities: BaseToolCapability,
|
|
60
|
+
): Promise<DataHandlerResult<string>> {
|
|
61
|
+
const conversationContext = capabilities.conversationContext;
|
|
62
|
+
if (!conversationContext || !(conversationContext instanceof PerformanceTraceContext)) {
|
|
63
|
+
return {error: 'Performance trace context is not available.'};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const focus = conversationContext.getItem();
|
|
67
|
+
const event = focus.lookupEvent(params.eventKey);
|
|
68
|
+
if (!event) {
|
|
69
|
+
return {error: `Could not find event with key "${params.eventKey}".`};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const revealable = new SDK.TraceObject.RevealableEvent(event);
|
|
73
|
+
try {
|
|
74
|
+
await Common.Revealer.reveal(revealable);
|
|
75
|
+
} catch {
|
|
76
|
+
// A failed reveal should not block returning the selected event context.
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
result: 'Event selected',
|
|
81
|
+
widgets: [{
|
|
82
|
+
name: 'TIMELINE_EVENT_SUMMARY',
|
|
83
|
+
data: {
|
|
84
|
+
event,
|
|
85
|
+
parsedTrace: focus.parsedTrace,
|
|
86
|
+
},
|
|
87
|
+
}],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -140,13 +140,18 @@ export interface PerformanceRecordingCapability {
|
|
|
140
140
|
* Used by the agent to pass a complete context to any tool type-safely.
|
|
141
141
|
*/
|
|
142
142
|
export type AllToolsCapabilities = BaseToolCapability&PageExecutionCapability&StyleMutationCapability&TargetCapability&
|
|
143
|
-
OriginLockCapability&LighthouseCapability&PerformanceRecordingCapability;
|
|
143
|
+
OriginLockCapability&LighthouseCapability&PerformanceRecordingCapability&ServerLoggingCapability;
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Base argument type for AI Tools.
|
|
147
147
|
*/
|
|
148
148
|
export type ToolArgs = Record<string, unknown>;
|
|
149
149
|
|
|
150
|
+
// The maximum size (in bytes) of a function execution result.
|
|
151
|
+
// Approximately 16k tokens at ~4 characters per token, designed to limit
|
|
152
|
+
// result sizes to prevent overloading the LLM's context window.
|
|
153
|
+
export const MAX_FUNCTION_RESULT_BYTE_LENGTH = 16384 * 4;
|
|
154
|
+
|
|
150
155
|
export const enum ToolName {
|
|
151
156
|
EXECUTE_JAVASCRIPT = 'executeJavaScript',
|
|
152
157
|
GET_STYLES = 'getStyles',
|
|
@@ -156,6 +161,13 @@ export const enum ToolName {
|
|
|
156
161
|
RESOLVE_DEVTOOLS_NODE_PATH = 'resolveDevtoolsNodePath',
|
|
157
162
|
GET_ELEMENT_ACCESSIBILITY_DETAILS = 'getElementAccessibilityDetails',
|
|
158
163
|
RECORD_PERFORMANCE_TRACE = 'recordPerformanceTrace',
|
|
164
|
+
LIST_PAGE_ORIGINS = 'listPageOrigins',
|
|
165
|
+
GET_TRACE_EVENT_BY_KEY = 'getTraceEventByKey',
|
|
166
|
+
SELECT_TRACE_EVENT_BY_KEY = 'selectTraceEventByKey',
|
|
167
|
+
LIST_SOURCES = 'listSources',
|
|
168
|
+
GET_SOURCE_CONTENT = 'getSourceContent',
|
|
169
|
+
GET_TRACE_MAIN_THREAD_SUMMARY = 'getTraceMainThreadSummary',
|
|
170
|
+
GET_TRACE_NETWORK_SUMMARY = 'getTraceNetworkSummary',
|
|
159
171
|
}
|
|
160
172
|
|
|
161
173
|
/**
|
|
@@ -180,6 +192,7 @@ export interface BaseTool<ArgsType extends ToolArgs = ToolArgs> {
|
|
|
180
192
|
) => {
|
|
181
193
|
title?: string, thought?: string, action?: string, suggestions?: [string, ...string[]],
|
|
182
194
|
};
|
|
195
|
+
readonly annotations?: ToolAnnotation[];
|
|
183
196
|
}
|
|
184
197
|
|
|
185
198
|
/**
|
|
@@ -242,3 +255,11 @@ export type Tool<
|
|
|
242
255
|
ReturnType = unknown,
|
|
243
256
|
CapabilitiesType extends BaseToolCapability = BaseToolCapability,
|
|
244
257
|
> = DataTool<ArgsType, ReturnType, CapabilitiesType>|ContextTool<ArgsType, ReturnType, CapabilitiesType>;
|
|
258
|
+
|
|
259
|
+
export interface ServerLoggingCapability {
|
|
260
|
+
setLoggingEnabled(enabled: boolean): void;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export const enum ToolAnnotation {
|
|
264
|
+
REDACT_FROM_HISTORY = 'redact-from-history',
|
|
265
|
+
}
|
|
@@ -6,10 +6,17 @@ import {ExecuteJavaScriptTool} from './ExecuteJavaScript.js';
|
|
|
6
6
|
import {GetElementAccessibilityDetailsTool} from './GetElementAccessibilityDetails.js';
|
|
7
7
|
import {GetLighthouseAuditsTool} from './GetLighthouseAudits.js';
|
|
8
8
|
import {GetNetworkRequestDetailsTool} from './GetNetworkRequestDetails.js';
|
|
9
|
+
import {GetSourceContentTool} from './GetSourceContent.js';
|
|
9
10
|
import {GetStylesTool} from './GetStyles.js';
|
|
11
|
+
import {GetTraceEventByKeyTool} from './GetTraceEventByKey.js';
|
|
12
|
+
import {GetTraceMainThreadSummaryTool} from './GetTraceMainThreadSummary.js';
|
|
13
|
+
import {GetTraceNetworkSummaryTool} from './GetTraceNetworkSummary.js';
|
|
10
14
|
import {ListNetworkRequestsTool} from './ListNetworkRequests.js';
|
|
15
|
+
import {ListPageOriginsTool} from './ListPageOrigins.js';
|
|
16
|
+
import {ListSourcesTool} from './ListSources.js';
|
|
11
17
|
import {RecordPerformanceTraceTool} from './RecordPerformanceTrace.js';
|
|
12
18
|
import {ResolveDevtoolsNodePathTool} from './ResolveDevtoolsNodePath.js';
|
|
19
|
+
import {SelectTraceEventByKeyTool} from './SelectTraceEventByKey.js';
|
|
13
20
|
import {type AllToolsCapabilities, type Tool, type ToolArgs, ToolName} from './Tool.js';
|
|
14
21
|
|
|
15
22
|
/**
|
|
@@ -29,6 +36,13 @@ export const TOOLS = {
|
|
|
29
36
|
[ToolName.RESOLVE_DEVTOOLS_NODE_PATH]: new ResolveDevtoolsNodePathTool(),
|
|
30
37
|
[ToolName.GET_ELEMENT_ACCESSIBILITY_DETAILS]: new GetElementAccessibilityDetailsTool(),
|
|
31
38
|
[ToolName.RECORD_PERFORMANCE_TRACE]: new RecordPerformanceTraceTool(),
|
|
39
|
+
[ToolName.LIST_PAGE_ORIGINS]: new ListPageOriginsTool(),
|
|
40
|
+
[ToolName.GET_TRACE_EVENT_BY_KEY]: new GetTraceEventByKeyTool(),
|
|
41
|
+
[ToolName.SELECT_TRACE_EVENT_BY_KEY]: new SelectTraceEventByKeyTool(),
|
|
42
|
+
[ToolName.LIST_SOURCES]: new ListSourcesTool(),
|
|
43
|
+
[ToolName.GET_SOURCE_CONTENT]: new GetSourceContentTool(),
|
|
44
|
+
[ToolName.GET_TRACE_MAIN_THREAD_SUMMARY]: new GetTraceMainThreadSummaryTool(),
|
|
45
|
+
[ToolName.GET_TRACE_NETWORK_SUMMARY]: new GetTraceNetworkSummaryTool(),
|
|
32
46
|
};
|
|
33
47
|
|
|
34
48
|
/**
|
|
@@ -143,6 +143,10 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
143
143
|
}
|
|
144
144
|
return rawLocations;
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
sourceMapURLsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): Platform.DevToolsPath.UrlString[] {
|
|
148
|
+
return SASSSourceMapping.sourceMapURLsForUISourceCode(uiSourceCode);
|
|
149
|
+
}
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
export interface SourceMapping {
|
|
@@ -577,6 +577,10 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
577
577
|
return scripts;
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
+
sourceMapURLsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): Platform.DevToolsPath.UrlString[] {
|
|
581
|
+
return [...this.#uiSourceCodeToSourceMaps.get(uiSourceCode)].map(sourceMap => sourceMap.url());
|
|
582
|
+
}
|
|
583
|
+
|
|
580
584
|
private sourceMapAttachedForTest(_sourceMap: SDK.SourceMap.SourceMap): void {
|
|
581
585
|
}
|
|
582
586
|
|
|
@@ -463,6 +463,14 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
463
463
|
return [...scripts];
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
+
sourceMapURLsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): Platform.DevToolsPath.UrlString[] {
|
|
467
|
+
const urls = new Set<Platform.DevToolsPath.UrlString>();
|
|
468
|
+
for (const modelData of this.#debuggerModelToData.values()) {
|
|
469
|
+
modelData.compilerMapping.sourceMapURLsForUISourceCode(uiSourceCode).forEach(url => urls.add(url));
|
|
470
|
+
}
|
|
471
|
+
return [...urls];
|
|
472
|
+
}
|
|
473
|
+
|
|
466
474
|
supportsConditionalBreakpoints(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
467
475
|
const scripts = this.pluginManager.scriptsForUISourceCode(uiSourceCode);
|
|
468
476
|
return scripts.every(script => script.isJavaScript());
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
-
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
8
|
-
import * as Root from '../../core/root/root.js';
|
|
9
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
8
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
11
|
-
import * as Protocol from '../../generated/protocol.js';
|
|
12
9
|
import * as Formatter from '../formatter/formatter.js';
|
|
13
10
|
import * as Workspace from '../workspace/workspace.js';
|
|
14
11
|
|
|
@@ -17,21 +14,6 @@ import {type DebuggerSourceMapping, DebuggerWorkspaceBinding} from './DebuggerWo
|
|
|
17
14
|
import {NetworkProject} from './NetworkProject.js';
|
|
18
15
|
import {metadataForURL} from './ResourceUtils.js';
|
|
19
16
|
|
|
20
|
-
const UIStrings = {
|
|
21
|
-
/**
|
|
22
|
-
* @description Error text displayed in the Console panel when editing a live script fails. LiveEdit is the name of the feature for editing code that is already running.
|
|
23
|
-
* @example {warning} PH1
|
|
24
|
-
*/
|
|
25
|
-
liveEditFailed: '`LiveEdit` failed: {PH1}',
|
|
26
|
-
/**
|
|
27
|
-
* @description Error text displayed in the Console panel when compiling a live-edited script fails. LiveEdit is the name of the feature for editing code that is already running.
|
|
28
|
-
* @example {connection lost} PH1
|
|
29
|
-
*/
|
|
30
|
-
liveEditCompileFailed: '`LiveEdit` compile failed: {PH1}',
|
|
31
|
-
} as const;
|
|
32
|
-
const str_ = i18n.i18n.registerUIStrings('models/bindings/ResourceScriptMapping.ts', UIStrings);
|
|
33
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
34
|
-
|
|
35
17
|
export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
36
18
|
readonly debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
37
19
|
#workspace: Workspace.Workspace.WorkspaceImpl;
|
|
@@ -96,9 +78,6 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
96
78
|
if (!scriptFile) {
|
|
97
79
|
return null;
|
|
98
80
|
}
|
|
99
|
-
if ((scriptFile.hasDivergedFromVM() && !scriptFile.isMergingToVM()) || scriptFile.isDivergingFromVM()) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
81
|
if (scriptFile.script !== script) {
|
|
103
82
|
return null;
|
|
104
83
|
}
|
|
@@ -205,8 +184,7 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
205
184
|
}
|
|
206
185
|
|
|
207
186
|
private addScript(script: SDK.Script.Script): void {
|
|
208
|
-
|
|
209
|
-
if (script.isLiveEdit() || script.isBreakpointCondition) {
|
|
187
|
+
if (script.isBreakpointCondition) {
|
|
210
188
|
return;
|
|
211
189
|
}
|
|
212
190
|
|
|
@@ -272,10 +250,6 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
272
250
|
if (!uiSourceCode) {
|
|
273
251
|
continue;
|
|
274
252
|
}
|
|
275
|
-
const scriptFile = this.#uiSourceCodeToScriptFile.get(uiSourceCode);
|
|
276
|
-
if (scriptFile) {
|
|
277
|
-
scriptFile.dispose();
|
|
278
|
-
}
|
|
279
253
|
|
|
280
254
|
this.#uiSourceCodeToScriptFile.delete(uiSourceCode);
|
|
281
255
|
this.#scriptToUISourceCode.delete(script);
|
|
@@ -325,177 +299,17 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
325
299
|
}
|
|
326
300
|
}
|
|
327
301
|
|
|
328
|
-
export class ResourceScriptFile
|
|
302
|
+
export class ResourceScriptFile {
|
|
329
303
|
readonly #resourceScriptMapping: ResourceScriptMapping;
|
|
330
304
|
readonly uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
331
305
|
readonly script: SDK.Script.Script|null;
|
|
332
|
-
|
|
333
|
-
#isDivergingFromVM?: boolean;
|
|
334
|
-
#hasDivergedFromVM?: boolean;
|
|
335
|
-
#isMergingToVM?: boolean;
|
|
336
|
-
#updateMutex = new Common.Mutex.Mutex();
|
|
306
|
+
|
|
337
307
|
constructor(
|
|
338
308
|
resourceScriptMapping: ResourceScriptMapping, uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
339
309
|
script: SDK.Script.Script) {
|
|
340
|
-
super();
|
|
341
310
|
this.#resourceScriptMapping = resourceScriptMapping;
|
|
342
311
|
this.uiSourceCode = uiSourceCode;
|
|
343
312
|
this.script = this.uiSourceCode.contentType().isScript() ? script : null;
|
|
344
|
-
|
|
345
|
-
this.uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyChanged, this.workingCopyChanged, this);
|
|
346
|
-
this.uiSourceCode.addEventListener(
|
|
347
|
-
Workspace.UISourceCode.Events.WorkingCopyCommitted, this.workingCopyCommitted, this);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
private isDiverged(): boolean {
|
|
351
|
-
if (this.uiSourceCode.isDirty()) {
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
if (!this.script) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
if (typeof this.#scriptSource === 'undefined' || this.#scriptSource === null) {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
const workingCopy = this.uiSourceCode.workingCopy();
|
|
361
|
-
if (!workingCopy) {
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// Match ignoring sourceURL.
|
|
366
|
-
if (!workingCopy.startsWith(this.#scriptSource.trimEnd())) {
|
|
367
|
-
return true;
|
|
368
|
-
}
|
|
369
|
-
const suffix = this.uiSourceCode.workingCopy().substr(this.#scriptSource.length);
|
|
370
|
-
return Boolean(suffix.length) && !suffix.match(SDK.Script.sourceURLRegex);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
private workingCopyChanged(): void {
|
|
374
|
-
void this.update();
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
private workingCopyCommitted(): void {
|
|
378
|
-
// This feature flag is for turning down live edit. If it's not present, we keep the feature enabled.
|
|
379
|
-
if (Root.Runtime.hostConfig.devToolsLiveEdit?.enabled === false) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (this.uiSourceCode.project().canSetFileContent()) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
if (!this.script) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const source = this.uiSourceCode.workingCopy();
|
|
391
|
-
void this.script.editSource(source).then(({status, exceptionDetails}) => {
|
|
392
|
-
void this.scriptSourceWasSet(source, status, exceptionDetails);
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
async scriptSourceWasSet(
|
|
397
|
-
source: string, status: Protocol.Debugger.SetScriptSourceResponseStatus,
|
|
398
|
-
exceptionDetails?: Protocol.Runtime.ExceptionDetails): Promise<void> {
|
|
399
|
-
if (status === Protocol.Debugger.SetScriptSourceResponseStatus.Ok) {
|
|
400
|
-
this.#scriptSource = source;
|
|
401
|
-
}
|
|
402
|
-
await this.update();
|
|
403
|
-
|
|
404
|
-
if (status === Protocol.Debugger.SetScriptSourceResponseStatus.Ok) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (!exceptionDetails) {
|
|
409
|
-
// TODO(crbug.com/1334484): Instead of to the console, report these errors in an "info bar" at the bottom
|
|
410
|
-
// of the text editor, similar to e.g. source mapping errors.
|
|
411
|
-
// eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
|
|
412
|
-
Common.Console.Console.instance().addMessage(
|
|
413
|
-
i18nString(UIStrings.liveEditFailed, {PH1: getErrorText(status)}), Common.Console.MessageLevel.WARNING);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const messageText = i18nString(UIStrings.liveEditCompileFailed, {PH1: exceptionDetails.text});
|
|
417
|
-
this.uiSourceCode.addLineMessage(
|
|
418
|
-
Workspace.UISourceCode.Message.Level.ERROR, messageText, exceptionDetails.lineNumber,
|
|
419
|
-
exceptionDetails.columnNumber);
|
|
420
|
-
|
|
421
|
-
function getErrorText(status: Protocol.Debugger.SetScriptSourceResponseStatus): string {
|
|
422
|
-
switch (status) {
|
|
423
|
-
case Protocol.Debugger.SetScriptSourceResponseStatus.BlockedByActiveFunction:
|
|
424
|
-
return 'Functions that are on the stack (currently being executed) can’t be edited';
|
|
425
|
-
case Protocol.Debugger.SetScriptSourceResponseStatus.BlockedByActiveGenerator:
|
|
426
|
-
return 'Async functions/generators that are active can’t be edited';
|
|
427
|
-
case Protocol.Debugger.SetScriptSourceResponseStatus.BlockedByTopLevelEsModuleChange:
|
|
428
|
-
return 'The top level of JavaScript modules can’t be edited';
|
|
429
|
-
case Protocol.Debugger.SetScriptSourceResponseStatus.CompileError:
|
|
430
|
-
case Protocol.Debugger.SetScriptSourceResponseStatus.Ok:
|
|
431
|
-
throw new Error('Compile errors and Ok status must not be reported on the console');
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
private async update(): Promise<void> {
|
|
437
|
-
// Do not interleave "divergeFromVM" with "mergeToVM" calls.
|
|
438
|
-
const release = await this.#updateMutex.acquire();
|
|
439
|
-
const diverged = this.isDiverged();
|
|
440
|
-
if (diverged && !this.#hasDivergedFromVM) {
|
|
441
|
-
await this.divergeFromVM();
|
|
442
|
-
} else if (!diverged && this.#hasDivergedFromVM) {
|
|
443
|
-
await this.mergeToVM();
|
|
444
|
-
}
|
|
445
|
-
release();
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
private async divergeFromVM(): Promise<void> {
|
|
449
|
-
if (this.script) {
|
|
450
|
-
this.#isDivergingFromVM = true;
|
|
451
|
-
await this.#resourceScriptMapping.debuggerWorkspaceBinding.updateLocations(this.script);
|
|
452
|
-
this.#isDivergingFromVM = undefined;
|
|
453
|
-
this.#hasDivergedFromVM = true;
|
|
454
|
-
this.dispatchEventToListeners(ResourceScriptFile.Events.DID_DIVERGE_FROM_VM);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
private async mergeToVM(): Promise<void> {
|
|
459
|
-
if (this.script) {
|
|
460
|
-
this.#hasDivergedFromVM = undefined;
|
|
461
|
-
this.#isMergingToVM = true;
|
|
462
|
-
await this.#resourceScriptMapping.debuggerWorkspaceBinding.updateLocations(this.script);
|
|
463
|
-
this.#isMergingToVM = undefined;
|
|
464
|
-
this.dispatchEventToListeners(ResourceScriptFile.Events.DID_MERGE_TO_VM);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
hasDivergedFromVM(): boolean {
|
|
469
|
-
return Boolean(this.#hasDivergedFromVM);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
isDivergingFromVM(): boolean {
|
|
473
|
-
return Boolean(this.#isDivergingFromVM);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
isMergingToVM(): boolean {
|
|
477
|
-
return Boolean(this.#isMergingToVM);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
checkMapping(): void {
|
|
481
|
-
if (!this.script || typeof this.#scriptSource !== 'undefined') {
|
|
482
|
-
this.mappingCheckedForTest();
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
void this.script.requestContentData().then(content => {
|
|
486
|
-
this.#scriptSource = TextUtils.ContentData.ContentData.textOr(content, null);
|
|
487
|
-
void this.update().then(() => this.mappingCheckedForTest());
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
private mappingCheckedForTest(): void {
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
dispose(): void {
|
|
495
|
-
this.uiSourceCode.removeEventListener(
|
|
496
|
-
Workspace.UISourceCode.Events.WorkingCopyChanged, this.workingCopyChanged, this);
|
|
497
|
-
this.uiSourceCode.removeEventListener(
|
|
498
|
-
Workspace.UISourceCode.Events.WorkingCopyCommitted, this.workingCopyCommitted, this);
|
|
499
313
|
}
|
|
500
314
|
|
|
501
315
|
addSourceMapURL(sourceMapURL: Platform.DevToolsPath.UrlString): void {
|
|
@@ -527,15 +341,3 @@ export class ResourceScriptFile extends Common.ObjectWrapper.ObjectWrapper<Resou
|
|
|
527
341
|
return sources && 'missingSymbolFiles' in sources ? sources.missingSymbolFiles : null;
|
|
528
342
|
}
|
|
529
343
|
}
|
|
530
|
-
|
|
531
|
-
export namespace ResourceScriptFile {
|
|
532
|
-
export const enum Events {
|
|
533
|
-
DID_MERGE_TO_VM = 'DidMergeToVM',
|
|
534
|
-
DID_DIVERGE_FROM_VM = 'DidDivergeFromVM',
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
export interface EventTypes {
|
|
538
|
-
[Events.DID_MERGE_TO_VM]: void;
|
|
539
|
-
[Events.DID_DIVERGE_FROM_VM]: void;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
@@ -140,6 +140,12 @@ export class SASSSourceMapping implements SourceMapping {
|
|
|
140
140
|
return [];
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
static sourceMapURLsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode):
|
|
144
|
+
Platform.DevToolsPath.UrlString[] {
|
|
145
|
+
const binding = uiSourceCodeToBinding.get(uiSourceCode);
|
|
146
|
+
return binding?.getReferringSourceMaps().map(sourceMap => sourceMap.url()) ?? [];
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
dispose(): void {
|
|
144
150
|
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
145
151
|
this.#project.dispose();
|
|
@@ -8,7 +8,7 @@ import {assertNotNullOrUndefined} from '../../core/platform/platform.js';
|
|
|
8
8
|
import * as Root from '../../core/root/root.js';
|
|
9
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
10
|
import type * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
11
|
-
import * as Protocol from '../../generated/protocol.js';
|
|
11
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
12
12
|
import * as Bindings from '../bindings/bindings.js';
|
|
13
13
|
import * as Formatter from '../formatter/formatter.js';
|
|
14
14
|
import * as SourceMapScopes from '../source_map_scopes/source_map_scopes.js';
|
|
@@ -608,7 +608,6 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
|
|
|
608
608
|
|
|
609
609
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.DebuggerWasEnabled, this.#onDebuggerEnabled, this);
|
|
610
610
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.DebuggerWasDisabled, this.#onDebuggerDisabled, this);
|
|
611
|
-
debuggerModel.addEventListener(SDK.DebuggerModel.Events.ScriptSourceWasEdited, this.#onScriptWasEdited, this);
|
|
612
611
|
}
|
|
613
612
|
|
|
614
613
|
modelRemoved(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
|
|
@@ -622,7 +621,6 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
|
|
|
622
621
|
#removeDebuggerModelListeners(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
|
|
623
622
|
debuggerModel.removeEventListener(SDK.DebuggerModel.Events.DebuggerWasEnabled, this.#onDebuggerEnabled, this);
|
|
624
623
|
debuggerModel.removeEventListener(SDK.DebuggerModel.Events.DebuggerWasDisabled, this.#onDebuggerDisabled, this);
|
|
625
|
-
debuggerModel.removeEventListener(SDK.DebuggerModel.Events.ScriptSourceWasEdited, this.#onScriptWasEdited, this);
|
|
626
624
|
}
|
|
627
625
|
|
|
628
626
|
#onDebuggerEnabled(event: Common.EventTarget.EventTargetEvent<SDK.DebuggerModel.DebuggerModel>): void {
|
|
@@ -639,29 +637,6 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
|
|
|
639
637
|
model?.cleanUpAfterDebuggerIsGone();
|
|
640
638
|
}
|
|
641
639
|
|
|
642
|
-
async #onScriptWasEdited(
|
|
643
|
-
event: Common.EventTarget
|
|
644
|
-
.EventTargetEvent<{script: SDK.Script.Script, status: Protocol.Debugger.SetScriptSourceResponseStatus}>):
|
|
645
|
-
Promise<void> {
|
|
646
|
-
const {source: debuggerModel, data: {script, status}} = event;
|
|
647
|
-
if (status !== Protocol.Debugger.SetScriptSourceResponseStatus.Ok) {
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// V8 throws away breakpoints on all functions in a live edited script. Here we attempt to re-set them again at the
|
|
652
|
-
// same position. This is because we don't know what was edited and how the breakpoint should move, e.g. if the file
|
|
653
|
-
// was originally changed on the filesystem (via workspace).
|
|
654
|
-
// If the live edit originated in DevTools (in CodeMirror), then the `DebuggerPlugin` will remove the breakpoint
|
|
655
|
-
// wholesale and re-apply based on the diff.
|
|
656
|
-
|
|
657
|
-
console.assert(debuggerModel instanceof SDK.DebuggerModel.DebuggerModel);
|
|
658
|
-
const model = this.#modelBreakpoints.get(debuggerModel as SDK.DebuggerModel.DebuggerModel);
|
|
659
|
-
if (model?.wasSetIn(script.scriptId)) {
|
|
660
|
-
await model.resetBreakpoint();
|
|
661
|
-
void this.#updateModel(model);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
640
|
modelBreakpoint(debuggerModel: SDK.DebuggerModel.DebuggerModel): ModelBreakpoint|undefined {
|
|
666
641
|
return this.#modelBreakpoints.get(debuggerModel);
|
|
667
642
|
}
|
|
@@ -966,11 +941,6 @@ export class ModelBreakpoint {
|
|
|
966
941
|
#cancelCallback = false;
|
|
967
942
|
#currentState: Breakpoint.State|null = null;
|
|
968
943
|
#breakpointIds: Protocol.Debugger.BreakpointId[] = [];
|
|
969
|
-
/**
|
|
970
|
-
* We track all the script IDs this ModelBreakpoint was actually set in. This allows us
|
|
971
|
-
* to properly reset this ModelBreakpoint after a script was live edited.
|
|
972
|
-
*/
|
|
973
|
-
#resolvedScriptIds = new Set<Protocol.Runtime.ScriptId>();
|
|
974
944
|
|
|
975
945
|
constructor(
|
|
976
946
|
debuggerModel: SDK.DebuggerModel.DebuggerModel, breakpoint: Breakpoint,
|
|
@@ -991,7 +961,6 @@ export class ModelBreakpoint {
|
|
|
991
961
|
|
|
992
962
|
this.#uiLocations.clear();
|
|
993
963
|
this.#liveLocations.disposeAll();
|
|
994
|
-
this.#resolvedScriptIds.clear();
|
|
995
964
|
}
|
|
996
965
|
|
|
997
966
|
async scheduleUpdateInDebugger(): Promise<ScheduleUpdateResult> {
|
|
@@ -1021,16 +990,6 @@ export class ModelBreakpoint {
|
|
|
1021
990
|
return result;
|
|
1022
991
|
}
|
|
1023
992
|
|
|
1024
|
-
private scriptDiverged(): boolean {
|
|
1025
|
-
for (const uiSourceCode of this.#breakpoint.getUiSourceCodes()) {
|
|
1026
|
-
const scriptFile = this.#debuggerWorkspaceBinding.scriptFile(uiSourceCode, this.#debuggerModel);
|
|
1027
|
-
if (scriptFile?.hasDivergedFromVM()) {
|
|
1028
|
-
return true;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
return false;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
993
|
async #updateInDebugger(): Promise<DebuggerUpdateResult> {
|
|
1035
994
|
if (this.#debuggerModel.target().isDisposed()) {
|
|
1036
995
|
this.cleanUpAfterDebuggerIsGone();
|
|
@@ -1042,7 +1001,7 @@ export class ModelBreakpoint {
|
|
|
1042
1001
|
|
|
1043
1002
|
// Calculate the new state.
|
|
1044
1003
|
let newState: Breakpoint.State|null = null;
|
|
1045
|
-
if (!this.#breakpoint.getIsRemoved() && this.#breakpoint.enabled()
|
|
1004
|
+
if (!this.#breakpoint.getIsRemoved() && this.#breakpoint.enabled()) {
|
|
1046
1005
|
let debuggerLocations: SDK.DebuggerModel.Location[] = [];
|
|
1047
1006
|
for (const uiSourceCode of this.#breakpoint.getUiSourceCodes()) {
|
|
1048
1007
|
const {lineNumber: uiLineNumber, columnNumber: uiColumnNumber} =
|
|
@@ -1226,7 +1185,6 @@ export class ModelBreakpoint {
|
|
|
1226
1185
|
}
|
|
1227
1186
|
|
|
1228
1187
|
private async addResolvedLocation(location: SDK.DebuggerModel.Location): Promise<ResolveLocationResult> {
|
|
1229
|
-
this.#resolvedScriptIds.add(location.scriptId);
|
|
1230
1188
|
const uiLocation = await this.#debuggerWorkspaceBinding.rawLocationToUILocation(location);
|
|
1231
1189
|
if (!uiLocation) {
|
|
1232
1190
|
return ResolveLocationResult.OK;
|
|
@@ -1249,11 +1207,6 @@ export class ModelBreakpoint {
|
|
|
1249
1207
|
this.didRemoveFromDebugger();
|
|
1250
1208
|
}
|
|
1251
1209
|
}
|
|
1252
|
-
|
|
1253
|
-
/** @returns true, iff this `ModelBreakpoint` was set (at some point) in `scriptId` */
|
|
1254
|
-
wasSetIn(scriptId: Protocol.Runtime.ScriptId): boolean {
|
|
1255
|
-
return this.#resolvedScriptIds.has(scriptId);
|
|
1256
|
-
}
|
|
1257
1210
|
}
|
|
1258
1211
|
|
|
1259
1212
|
/**
|
|
@@ -335,6 +335,15 @@ export interface NativeContextSizes {
|
|
|
335
335
|
noAttributionSize: number;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
+
export interface RetainedByContextSummary {
|
|
339
|
+
contextCount: number;
|
|
340
|
+
retainedByContextSize: number;
|
|
341
|
+
retainedByContextCount: number;
|
|
342
|
+
notRetainedByContextSize: number;
|
|
343
|
+
notRetainedByContextCount: number;
|
|
344
|
+
totalSize: number;
|
|
345
|
+
}
|
|
346
|
+
|
|
338
347
|
export const enum DOMLinkState {
|
|
339
348
|
UNKNOWN = 0,
|
|
340
349
|
ATTACHED = 1,
|
|
@@ -353,3 +362,21 @@ export interface ObjectInfo {
|
|
|
353
362
|
edgeCount: number;
|
|
354
363
|
retainerCount: number;
|
|
355
364
|
}
|
|
365
|
+
|
|
366
|
+
export interface HeapQueryOptions {
|
|
367
|
+
className?: string;
|
|
368
|
+
propertyName?: string;
|
|
369
|
+
nodeType?: string;
|
|
370
|
+
minRetainedSize?: number;
|
|
371
|
+
maxRetainedSize?: number;
|
|
372
|
+
minSelfSize?: number;
|
|
373
|
+
maxSelfSize?: number;
|
|
374
|
+
isDetached?: boolean;
|
|
375
|
+
sortBy?: 'retainedSize'|'selfSize'|'id';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface HeapEdgesQueryOptions {
|
|
379
|
+
sortBy?: 'retainedSize'|'selfSize'|'name';
|
|
380
|
+
minRetainedSize?: number;
|
|
381
|
+
excludePrimitives?: boolean;
|
|
382
|
+
}
|
|
@@ -280,6 +280,10 @@ export class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
280
280
|
return this.callMethodPromise('getNativeContextSizes');
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
getRetainedByContextSummary(): Promise<HeapSnapshotModel.RetainedByContextSummary> {
|
|
284
|
+
return this.callMethodPromise('getRetainedByContextSummary');
|
|
285
|
+
}
|
|
286
|
+
|
|
283
287
|
aggregatesWithFilter(filter: HeapSnapshotModel.NodeFilter):
|
|
284
288
|
Promise<Record<string, HeapSnapshotModel.AggregatedInfo>> {
|
|
285
289
|
return this.callMethodPromise('aggregatesWithFilter', filter);
|
|
@@ -312,8 +316,8 @@ export class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
312
316
|
return this.callMethodPromise('getObjectInfo', nodeIndex);
|
|
313
317
|
}
|
|
314
318
|
|
|
315
|
-
createEdgesProvider(nodeIndex: number): HeapSnapshotProviderProxy {
|
|
316
|
-
return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex);
|
|
319
|
+
createEdgesProvider(nodeIndex: number, options?: HeapSnapshotModel.HeapEdgesQueryOptions): HeapSnapshotProviderProxy {
|
|
320
|
+
return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex, options);
|
|
317
321
|
}
|
|
318
322
|
|
|
319
323
|
createRetainingEdgesProvider(nodeIndex: number): HeapSnapshotProviderProxy {
|
|
@@ -336,6 +340,10 @@ export class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
336
340
|
return this.callFactoryMethod('createNodesProviderForClass', HeapSnapshotProviderProxy, classKey, nodeFilter);
|
|
337
341
|
}
|
|
338
342
|
|
|
343
|
+
queryObjects(queryOptions: HeapSnapshotModel.HeapQueryOptions): HeapSnapshotProviderProxy {
|
|
344
|
+
return this.callFactoryMethod('queryObjects', HeapSnapshotProviderProxy, queryOptions);
|
|
345
|
+
}
|
|
346
|
+
|
|
339
347
|
allocationTracesTops(): Promise<HeapSnapshotModel.SerializedAllocationNode[]> {
|
|
340
348
|
return this.callMethodPromise('allocationTracesTops');
|
|
341
349
|
}
|