chrome-devtools-frontend 1.0.1672557 → 1.0.1675430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +26 -9
- package/front_end/core/common/ParsedURL.ts +5 -1
- package/front_end/core/common/SettingRegistration.ts +30 -34
- package/front_end/core/common/Settings.ts +4 -64
- package/front_end/core/host/UserMetrics.ts +127 -117
- package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +42 -9
- package/front_end/core/root/Runtime.ts +14 -0
- package/front_end/core/sdk/NetworkManager.ts +0 -35
- package/front_end/core/sdk/SourceMap.ts +1 -19
- package/front_end/core/sdk/SourceMapManager.ts +75 -48
- package/front_end/core/sdk/SourceMapScopesInfo.ts +0 -62
- package/front_end/core/sdk/TargetManager.ts +18 -0
- package/front_end/devtools_compatibility.js +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +1 -0
- package/front_end/foundation/Universe.ts +44 -29
- package/front_end/generated/InspectorBackendCommands.ts +4 -3
- package/front_end/generated/SupportedCSSProperties.ts +16 -1
- package/front_end/generated/protocol-mapping.d.ts +8 -0
- package/front_end/generated/protocol-proxy-api.d.ts +6 -0
- package/front_end/generated/protocol.ts +16 -2
- package/front_end/models/ai_assistance/AiSetting.ts +66 -3
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +15 -5
- package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
- package/front_end/models/emulation/DeviceModeModel.ts +82 -102
- package/front_end/models/emulation/EmulatedDevices.ts +18 -66
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -4
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +2 -2
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +20 -29
- package/front_end/models/trace/ModelImpl.ts +5 -0
- package/front_end/models/trace/Processor.ts +5 -0
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +7 -1
- package/front_end/models/trace/handlers/MetaHandler.ts +8 -4
- package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +11 -0
- package/front_end/models/workspace/FileManager.ts +13 -6
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +11 -10
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +3 -45
- package/front_end/panels/application/BackgroundServiceView.ts +42 -40
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
- package/front_end/panels/application/WebMCPView.ts +13 -5
- package/front_end/panels/application/components/AdsView.ts +24 -1
- package/front_end/panels/application/components/adsView.css +27 -21
- package/front_end/panels/autofill/AutofillView.ts +12 -12
- package/front_end/panels/autofill/autofill-meta.ts +2 -2
- package/front_end/panels/common/ExtensionServer.ts +7 -1
- package/front_end/panels/common/common.ts +0 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +7 -6
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
- package/front_end/panels/elements/ClassesPaneWidget.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +602 -327
- package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AdornerManager.ts +1 -0
- package/front_end/panels/emulation/AdvancedApp.ts +3 -3
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -11
- package/front_end/panels/emulation/DeviceModeView.ts +234 -75
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +1 -1
- package/front_end/panels/emulation/deviceModeView.css +4 -21
- package/front_end/panels/emulation/emulation-meta.ts +4 -30
- package/front_end/panels/emulation/emulation.ts +0 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +11 -7
- package/front_end/panels/js_timeline/js_timeline-meta.ts +8 -8
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +30 -30
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +6 -6
- package/front_end/panels/layer_viewer/LayerViewHost.ts +1 -1
- package/front_end/panels/layer_viewer/Layers3DView.ts +11 -11
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +8 -8
- package/front_end/panels/layer_viewer/TransformController.ts +3 -3
- package/front_end/panels/layer_viewer/layer_viewer-meta.ts +11 -11
- package/front_end/panels/layers/LayersPanel.ts +2 -2
- package/front_end/panels/layers/layers-meta.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -7
- package/front_end/panels/mobile_throttling/CPUThrottlingSelector.ts +313 -0
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +0 -10
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +21 -10
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -58
- package/front_end/panels/mobile_throttling/mobile_throttling.ts +2 -9
- package/front_end/panels/network/NetworkConfigView.ts +1 -71
- package/front_end/panels/network/networkConfigView.css +1 -2
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +3 -3
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +5 -5
- package/front_end/panels/profiler/HeapProfileView.ts +32 -32
- package/front_end/panels/profiler/HeapProfilerPanel.ts +2 -2
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +33 -37
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +26 -27
- package/front_end/panels/profiler/HeapSnapshotView.ts +48 -48
- package/front_end/panels/profiler/IsolateSelector.ts +10 -10
- package/front_end/panels/profiler/ModuleUIStrings.ts +25 -25
- package/front_end/panels/profiler/ProfileLauncherView.ts +6 -6
- package/front_end/panels/profiler/ProfilesPanel.ts +6 -6
- package/front_end/panels/profiler/WritableProfileHeader.ts +6 -6
- package/front_end/panels/profiler/profiler-meta.ts +7 -7
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +7 -0
- package/front_end/panels/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +27 -23
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -2
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +12 -17
- package/front_end/panels/timeline/TimelinePanel.ts +20 -35
- package/front_end/panels/timeline/components/LiveMetricsView.ts +27 -6
- package/front_end/panels/timeline/components/NetworkTrackWidget.ts +1 -1
- package/front_end/panels/timeline/components/components.ts +0 -4
- package/front_end/panels/timeline/components/liveMetricsView.css +7 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/README.md +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/deno.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +2 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +2 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -0
- package/front_end/ui/comments/CommentAnchorResolver.ts +132 -0
- package/front_end/ui/comments/comments.ts +9 -0
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +2 -0
- package/front_end/ui/components/settings/SettingCheckbox.ts +4 -12
- package/front_end/ui/components/settings/settingCheckbox.css +0 -7
- package/front_end/ui/legacy/Treeoutline.ts +14 -14
- package/front_end/ui/legacy/UIUtils.ts +2 -47
- package/front_end/ui/legacy/Widget.ts +10 -2
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +40 -0
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +1 -1
- package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -0
- package/front_end/ui/lit/Directives.ts +80 -0
- package/front_end/ui/lit/lit.ts +1 -0
- package/front_end/ui/lit/render.ts +8 -0
- package/front_end/ui/settings/SettingUIRegistration.ts +4 -0
- package/front_end/ui/visual_logging/Debugging.ts +1 -5
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/front_end/ui/visual_logging/LoggingConfig.ts +21 -0
- package/front_end/ui/visual_logging/visual_logging.ts +9 -0
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/panels/common/ThrottlingUtils.ts +0 -51
- package/front_end/panels/emulation/DeviceModeWrapper.ts +0 -248
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +0 -92
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +0 -235
- package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +0 -245
- package/front_end/panels/timeline/components/cpuThrottlingSelector.css +0 -30
- package/front_end/panels/timeline/components/networkThrottlingSelector.css +0 -24
|
@@ -6,26 +6,25 @@ import * as Common from '../common/common.js';
|
|
|
6
6
|
|
|
7
7
|
import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
|
|
8
8
|
import {EnumeratedHistogram} from './InspectorFrontendHostAPI.js';
|
|
9
|
-
import
|
|
9
|
+
import * as Enums from './UserMetricsEnums.js';
|
|
10
10
|
|
|
11
11
|
export class UserMetrics {
|
|
12
|
-
|
|
13
12
|
sourcesPanelFileDebugged(mediaType?: string): void {
|
|
14
13
|
const code = (mediaType && MediaTypes[mediaType as keyof typeof MediaTypes]) || MediaTypes.Unknown;
|
|
15
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
16
|
-
|
|
14
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.SourcesPanelFileDebugged, code,
|
|
15
|
+
MediaTypes.MAX_VALUE);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
sourcesPanelFileOpened(mediaType?: string): void {
|
|
20
19
|
const code = (mediaType && MediaTypes[mediaType as keyof typeof MediaTypes]) || MediaTypes.Unknown;
|
|
21
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
22
|
-
|
|
20
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.SourcesPanelFileOpened, code,
|
|
21
|
+
MediaTypes.MAX_VALUE);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
networkPanelResponsePreviewOpened(mediaType: string): void {
|
|
26
25
|
const code = (mediaType && MediaTypes[mediaType as keyof typeof MediaTypes]) || MediaTypes.Unknown;
|
|
27
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
28
|
-
|
|
26
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.NetworkPanelResponsePreviewOpened, code,
|
|
27
|
+
MediaTypes.MAX_VALUE);
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
actionTaken(action: Action): void {
|
|
@@ -39,20 +38,20 @@ export class UserMetrics {
|
|
|
39
38
|
|
|
40
39
|
keybindSetSettingChanged(keybindSet: string): void {
|
|
41
40
|
const value = KeybindSetSettings[keybindSet as keyof typeof KeybindSetSettings] || 0;
|
|
42
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
43
|
-
|
|
41
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.KeybindSetSettingChanged, value,
|
|
42
|
+
KeybindSetSettings.MAX_VALUE);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
keyboardShortcutFired(actionId: string): void {
|
|
47
46
|
const action =
|
|
48
47
|
KeyboardShortcutAction[actionId as keyof typeof KeyboardShortcutAction] || KeyboardShortcutAction.OtherShortcut;
|
|
49
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
50
|
-
|
|
48
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.KeyboardShortcutFired, action,
|
|
49
|
+
KeyboardShortcutAction.MAX_VALUE);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
issuesPanelOpenedFrom(issueOpener: IssueOpener): void {
|
|
54
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
55
|
-
|
|
53
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssuesPanelOpenedFrom, issueOpener,
|
|
54
|
+
IssueOpener.MAX_VALUE);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
issuesPanelIssueExpanded(issueExpandedCategory?: string): void {
|
|
@@ -66,8 +65,8 @@ export class UserMetrics {
|
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
70
|
-
|
|
68
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssuesPanelIssueExpanded, issueExpanded,
|
|
69
|
+
IssueExpanded.MAX_VALUE);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
issuesPanelResourceOpened(issueCategory: string, type: string): void {
|
|
@@ -78,8 +77,8 @@ export class UserMetrics {
|
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
82
|
-
|
|
80
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssuesPanelResourceOpened, value,
|
|
81
|
+
IssueResourceOpened.MAX_VALUE);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
issueCreated(code: string): void {
|
|
@@ -87,8 +86,8 @@ export class UserMetrics {
|
|
|
87
86
|
if (issueCreated === undefined) {
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
91
|
-
|
|
89
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssueCreated, issueCreated,
|
|
90
|
+
IssueCreated.MAX_VALUE);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
experimentEnabledAtLaunch(experimentId: string): void {
|
|
@@ -96,13 +95,13 @@ export class UserMetrics {
|
|
|
96
95
|
if (experiment === undefined) {
|
|
97
96
|
return;
|
|
98
97
|
}
|
|
99
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
100
|
-
|
|
98
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.ExperimentEnabledAtLaunch, experiment,
|
|
99
|
+
DevtoolsExperiments.MAX_VALUE);
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
navigationSettingAtFirstTimelineLoad(state: TimelineNavigationSetting): void {
|
|
104
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
105
|
-
|
|
103
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.TimelineNavigationSettingState, state,
|
|
104
|
+
TimelineNavigationSetting.MAX_VALUE);
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
experimentDisabledAtLaunch(experimentId: string): void {
|
|
@@ -110,8 +109,8 @@ export class UserMetrics {
|
|
|
110
109
|
if (experiment === undefined) {
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
114
|
-
|
|
112
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.ExperimentDisabledAtLaunch, experiment,
|
|
113
|
+
DevtoolsExperiments.MAX_VALUE);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
experimentChanged(experimentId: string, isEnabled: boolean): void {
|
|
@@ -127,16 +126,16 @@ export class UserMetrics {
|
|
|
127
126
|
if (developerResourceLoaded >= DeveloperResourceLoaded.MAX_VALUE) {
|
|
128
127
|
return;
|
|
129
128
|
}
|
|
130
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
131
|
-
|
|
129
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.DeveloperResourceLoaded,
|
|
130
|
+
developerResourceLoaded, DeveloperResourceLoaded.MAX_VALUE);
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
developerResourceScheme(developerResourceScheme: DeveloperResourceScheme): void {
|
|
135
134
|
if (developerResourceScheme >= DeveloperResourceScheme.MAX_VALUE) {
|
|
136
135
|
return;
|
|
137
136
|
}
|
|
138
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
139
|
-
|
|
137
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.DeveloperResourceScheme,
|
|
138
|
+
developerResourceScheme, DeveloperResourceScheme.MAX_VALUE);
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
language(language: Intl.UnicodeBCP47LocaleIdentifier): void {
|
|
@@ -144,8 +143,8 @@ export class UserMetrics {
|
|
|
144
143
|
if (languageCode === undefined) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
148
|
-
|
|
146
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.Language, languageCode,
|
|
147
|
+
Language.MAX_VALUE);
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
syncSetting(devtoolsSyncSettingEnabled: boolean): void {
|
|
@@ -158,54 +157,54 @@ export class UserMetrics {
|
|
|
158
157
|
SyncSetting.DEVTOOLS_SYNC_SETTING_DISABLED;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
162
|
-
|
|
160
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.SyncSetting, settingValue,
|
|
161
|
+
SyncSetting.MAX_VALUE);
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
recordingToggled(value: RecordingToggled): void {
|
|
167
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
168
|
-
|
|
166
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.RecordingToggled, value,
|
|
167
|
+
RecordingToggled.MAX_VALUE);
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
recordingReplayFinished(value: RecordingReplayFinished): void {
|
|
172
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
173
|
-
|
|
171
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.RecordingReplayFinished, value,
|
|
172
|
+
RecordingReplayFinished.MAX_VALUE);
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
recordingReplayStarted(value: RecordingReplayStarted): void {
|
|
177
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
178
|
-
|
|
176
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.RecordingReplayStarted, value,
|
|
177
|
+
RecordingReplayStarted.MAX_VALUE);
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
lighthouseModeRun(type: LighthouseModeRun): void {
|
|
182
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
183
|
-
|
|
181
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.LighthouseModeRun, type,
|
|
182
|
+
LighthouseModeRun.MAX_VALUE);
|
|
184
183
|
}
|
|
185
184
|
|
|
186
185
|
lighthouseCategoryUsed(type: LighthouseCategoryUsed): void {
|
|
187
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
188
|
-
|
|
186
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.LighthouseCategoryUsed, type,
|
|
187
|
+
LighthouseCategoryUsed.MAX_VALUE);
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
swatchActivated(swatch: SwatchType): void {
|
|
192
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
193
|
-
|
|
191
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.SwatchActivated, swatch,
|
|
192
|
+
SwatchType.MAX_VALUE);
|
|
194
193
|
}
|
|
195
194
|
|
|
196
195
|
workspacesPopulated(wallClockTimeInMilliseconds: number): void {
|
|
197
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
198
|
-
|
|
196
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Workspaces.PopulateWallClocktime',
|
|
197
|
+
wallClockTimeInMilliseconds);
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
visualLoggingProcessingDone(timeInMilliseconds: number): void {
|
|
202
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
203
|
-
|
|
201
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.VisualLogging.ProcessingTime',
|
|
202
|
+
timeInMilliseconds);
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
freestylerQueryLength(numberOfCharacters: number): void {
|
|
207
|
-
InspectorFrontendHostInstance.recordCountHistogram(
|
|
208
|
-
|
|
206
|
+
InspectorFrontendHostInstance.recordCountHistogram('DevTools.Freestyler.QueryLength', numberOfCharacters, 0,
|
|
207
|
+
100_000, 100);
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
freestylerEvalResponseSize(bytes: number): void {
|
|
@@ -213,23 +212,23 @@ export class UserMetrics {
|
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
builtInAiAvailability(availability: BuiltInAiAvailability): void {
|
|
216
|
-
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
217
|
-
|
|
215
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.BuiltInAiAvailability, availability,
|
|
216
|
+
BuiltInAiAvailability.MAX_VALUE);
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
consoleInsightTeaserGenerated(timeInMilliseconds: number): void {
|
|
221
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
222
|
-
|
|
220
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.TeaserGenerationTime',
|
|
221
|
+
timeInMilliseconds);
|
|
223
222
|
}
|
|
224
223
|
|
|
225
224
|
consoleInsightTeaserGeneratedMedium(timeInMilliseconds: number): void {
|
|
226
|
-
InspectorFrontendHostInstance.recordPerformanceHistogramMedium(
|
|
227
|
-
|
|
225
|
+
InspectorFrontendHostInstance.recordPerformanceHistogramMedium('DevTools.Insights.TeaserGenerationTimeMedium',
|
|
226
|
+
timeInMilliseconds);
|
|
228
227
|
}
|
|
229
228
|
|
|
230
229
|
consoleInsightTeaserFirstChunkGenerated(timeInMilliseconds: number): void {
|
|
231
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
232
|
-
|
|
230
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.TeaserFirstChunkGenerationTime',
|
|
231
|
+
timeInMilliseconds);
|
|
233
232
|
}
|
|
234
233
|
|
|
235
234
|
consoleInsightTeaserFirstChunkGeneratedMedium(timeInMilliseconds: number): void {
|
|
@@ -238,28 +237,28 @@ export class UserMetrics {
|
|
|
238
237
|
}
|
|
239
238
|
|
|
240
239
|
consoleInsightTeaserChunkToEndMedium(timeInMilliseconds: number): void {
|
|
241
|
-
InspectorFrontendHostInstance.recordPerformanceHistogramMedium(
|
|
242
|
-
|
|
240
|
+
InspectorFrontendHostInstance.recordPerformanceHistogramMedium('DevTools.Insights.TeaserChunkToEndMedium',
|
|
241
|
+
timeInMilliseconds);
|
|
243
242
|
}
|
|
244
243
|
|
|
245
244
|
consoleInsightTeaserAbortedAfterFirstCharacter(timeInMilliseconds: number): void {
|
|
246
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
247
|
-
|
|
245
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.TeaserAfterFirstCharacterAbortionTime',
|
|
246
|
+
timeInMilliseconds);
|
|
248
247
|
}
|
|
249
248
|
|
|
250
249
|
consoleInsightTeaserAbortedBeforeFirstCharacter(timeInMilliseconds: number): void {
|
|
251
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
252
|
-
|
|
250
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.TeaserBeforeFirstCharacterAbortionTime',
|
|
251
|
+
timeInMilliseconds);
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
consoleInsightLongTeaserGenerated(timeInMilliseconds: number): void {
|
|
256
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
257
|
-
|
|
255
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.LongTeaserGenerationTime',
|
|
256
|
+
timeInMilliseconds);
|
|
258
257
|
}
|
|
259
258
|
|
|
260
259
|
consoleInsightShortTeaserGenerated(timeInMilliseconds: number): void {
|
|
261
|
-
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
262
|
-
|
|
260
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram('DevTools.Insights.ShortTeaserGenerationTime',
|
|
261
|
+
timeInMilliseconds);
|
|
263
262
|
}
|
|
264
263
|
}
|
|
265
264
|
|
|
@@ -270,11 +269,11 @@ export class UserMetrics {
|
|
|
270
269
|
* custom frontend, the enum boundary values exactly match what the host
|
|
271
270
|
* Chrome binary expects (which is provided via devtools_compatibility.js).
|
|
272
271
|
*/
|
|
273
|
-
function createDynamicEnumProxy<T>(enumName: string): T {
|
|
274
|
-
return new Proxy(
|
|
272
|
+
function createDynamicEnumProxy<T extends object>(enumName: string, fallbackEnum: T): T {
|
|
273
|
+
return new Proxy(fallbackEnum, {
|
|
275
274
|
get(_target, prop) {
|
|
276
275
|
if (typeof prop === 'symbol') {
|
|
277
|
-
return Reflect.get(
|
|
276
|
+
return Reflect.get(fallbackEnum, prop);
|
|
278
277
|
}
|
|
279
278
|
|
|
280
279
|
const metrics =
|
|
@@ -291,14 +290,13 @@ function createDynamicEnumProxy<T>(enumName: string): T {
|
|
|
291
290
|
const value = Number(prop);
|
|
292
291
|
for (const [key, val] of Object.entries(enumObj || {})) {
|
|
293
292
|
if (val === value) {
|
|
294
|
-
return key;
|
|
293
|
+
return key as keyof T;
|
|
295
294
|
}
|
|
296
295
|
}
|
|
297
296
|
}
|
|
298
297
|
|
|
299
|
-
//
|
|
300
|
-
|
|
301
|
-
return undefined;
|
|
298
|
+
// Fallback to the compile-time TypeScript enum if DevToolsMetrics is missing
|
|
299
|
+
return Reflect.get(fallbackEnum, prop);
|
|
302
300
|
},
|
|
303
301
|
|
|
304
302
|
has(_target, prop) {
|
|
@@ -312,7 +310,7 @@ function createDynamicEnumProxy<T>(enumName: string): T {
|
|
|
312
310
|
if (typeof prop === 'string' && /^\d+$/.test(prop)) {
|
|
313
311
|
return Object.values(enumObj || {}).includes(Number(prop));
|
|
314
312
|
}
|
|
315
|
-
return
|
|
313
|
+
return Reflect.has(fallbackEnum, prop);
|
|
316
314
|
},
|
|
317
315
|
|
|
318
316
|
ownKeys(_target) {
|
|
@@ -320,7 +318,7 @@ function createDynamicEnumProxy<T>(enumName: string): T {
|
|
|
320
318
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
321
319
|
(globalThis as {DevToolsMetrics?: Record<string, Record<string, number|string>>}).DevToolsMetrics;
|
|
322
320
|
const enumObj = metrics && metrics[enumName];
|
|
323
|
-
return enumObj ? Reflect.ownKeys(enumObj) :
|
|
321
|
+
return enumObj ? Reflect.ownKeys(enumObj) : Reflect.ownKeys(fallbackEnum);
|
|
324
322
|
},
|
|
325
323
|
|
|
326
324
|
getOwnPropertyDescriptor(_target, prop) {
|
|
@@ -329,7 +327,7 @@ function createDynamicEnumProxy<T>(enumName: string): T {
|
|
|
329
327
|
(globalThis as {DevToolsMetrics?: Record<string, Record<string, number|string>>}).DevToolsMetrics;
|
|
330
328
|
const enumObj = metrics && metrics[enumName];
|
|
331
329
|
if (!enumObj) {
|
|
332
|
-
return
|
|
330
|
+
return Reflect.getOwnPropertyDescriptor(fallbackEnum, prop);
|
|
333
331
|
}
|
|
334
332
|
return Reflect.getOwnPropertyDescriptor(enumObj, prop);
|
|
335
333
|
},
|
|
@@ -337,110 +335,122 @@ function createDynamicEnumProxy<T>(enumName: string): T {
|
|
|
337
335
|
}
|
|
338
336
|
|
|
339
337
|
export type Action = Enums.Action;
|
|
340
|
-
export const Action = createDynamicEnumProxy<typeof Enums.Action>('Action');
|
|
338
|
+
export const Action = createDynamicEnumProxy<typeof Enums.Action>('Action', Enums.Action);
|
|
341
339
|
|
|
342
340
|
export type PanelCodes = Enums.PanelCodes;
|
|
343
|
-
export const PanelCodes = createDynamicEnumProxy<typeof Enums.PanelCodes>('PanelCodes');
|
|
341
|
+
export const PanelCodes = createDynamicEnumProxy<typeof Enums.PanelCodes>('PanelCodes', Enums.PanelCodes);
|
|
344
342
|
|
|
345
343
|
export type MediaTypes = Enums.MediaTypes;
|
|
346
|
-
export const MediaTypes = createDynamicEnumProxy<typeof Enums.MediaTypes>('MediaTypes');
|
|
344
|
+
export const MediaTypes = createDynamicEnumProxy<typeof Enums.MediaTypes>('MediaTypes', Enums.MediaTypes);
|
|
347
345
|
|
|
348
346
|
export type KeybindSetSettings = Enums.KeybindSetSettings;
|
|
349
|
-
export const KeybindSetSettings =
|
|
347
|
+
export const KeybindSetSettings =
|
|
348
|
+
createDynamicEnumProxy<typeof Enums.KeybindSetSettings>('KeybindSetSettings', Enums.KeybindSetSettings);
|
|
350
349
|
|
|
351
350
|
export type KeyboardShortcutAction = Enums.KeyboardShortcutAction;
|
|
352
351
|
export const KeyboardShortcutAction =
|
|
353
|
-
createDynamicEnumProxy<typeof Enums.KeyboardShortcutAction>('KeyboardShortcutAction');
|
|
352
|
+
createDynamicEnumProxy<typeof Enums.KeyboardShortcutAction>('KeyboardShortcutAction', Enums.KeyboardShortcutAction);
|
|
354
353
|
|
|
355
354
|
export type IssueOpener = Enums.IssueOpener;
|
|
356
|
-
export const IssueOpener = createDynamicEnumProxy<typeof Enums.IssueOpener>('IssueOpener');
|
|
355
|
+
export const IssueOpener = createDynamicEnumProxy<typeof Enums.IssueOpener>('IssueOpener', Enums.IssueOpener);
|
|
357
356
|
|
|
358
357
|
export type DevtoolsExperiments = Enums.DevtoolsExperiments;
|
|
359
|
-
export const DevtoolsExperiments =
|
|
358
|
+
export const DevtoolsExperiments =
|
|
359
|
+
createDynamicEnumProxy<typeof Enums.DevtoolsExperiments>('DevtoolsExperiments', Enums.DevtoolsExperiments);
|
|
360
360
|
|
|
361
361
|
export type IssueExpanded = Enums.IssueExpanded;
|
|
362
|
-
export const IssueExpanded = createDynamicEnumProxy<typeof Enums.IssueExpanded>('IssueExpanded');
|
|
362
|
+
export const IssueExpanded = createDynamicEnumProxy<typeof Enums.IssueExpanded>('IssueExpanded', Enums.IssueExpanded);
|
|
363
363
|
|
|
364
364
|
export type IssueResourceOpened = Enums.IssueResourceOpened;
|
|
365
|
-
export const IssueResourceOpened =
|
|
365
|
+
export const IssueResourceOpened =
|
|
366
|
+
createDynamicEnumProxy<typeof Enums.IssueResourceOpened>('IssueResourceOpened', Enums.IssueResourceOpened);
|
|
366
367
|
|
|
367
368
|
export type IssueCreated = Enums.IssueCreated;
|
|
368
|
-
export const IssueCreated = createDynamicEnumProxy<typeof Enums.IssueCreated>('IssueCreated');
|
|
369
|
+
export const IssueCreated = createDynamicEnumProxy<typeof Enums.IssueCreated>('IssueCreated', Enums.IssueCreated);
|
|
369
370
|
|
|
370
371
|
export type DeveloperResourceLoaded = Enums.DeveloperResourceLoaded;
|
|
371
|
-
export const DeveloperResourceLoaded =
|
|
372
|
-
|
|
372
|
+
export const DeveloperResourceLoaded = createDynamicEnumProxy<typeof Enums.DeveloperResourceLoaded>(
|
|
373
|
+
'DeveloperResourceLoaded', Enums.DeveloperResourceLoaded);
|
|
373
374
|
|
|
374
375
|
export type DeveloperResourceScheme = Enums.DeveloperResourceScheme;
|
|
375
|
-
export const DeveloperResourceScheme =
|
|
376
|
-
|
|
376
|
+
export const DeveloperResourceScheme = createDynamicEnumProxy<typeof Enums.DeveloperResourceScheme>(
|
|
377
|
+
'DeveloperResourceScheme', Enums.DeveloperResourceScheme);
|
|
377
378
|
|
|
378
379
|
export type Language = Enums.Language;
|
|
379
|
-
export const Language = createDynamicEnumProxy<typeof Enums.Language>('Language');
|
|
380
|
+
export const Language = createDynamicEnumProxy<typeof Enums.Language>('Language', Enums.Language);
|
|
380
381
|
|
|
381
382
|
export type SyncSetting = Enums.SyncSetting;
|
|
382
|
-
export const SyncSetting = createDynamicEnumProxy<typeof Enums.SyncSetting>('SyncSetting');
|
|
383
|
+
export const SyncSetting = createDynamicEnumProxy<typeof Enums.SyncSetting>('SyncSetting', Enums.SyncSetting);
|
|
383
384
|
|
|
384
385
|
export type RecordingToggled = Enums.RecordingToggled;
|
|
385
|
-
export const RecordingToggled =
|
|
386
|
+
export const RecordingToggled =
|
|
387
|
+
createDynamicEnumProxy<typeof Enums.RecordingToggled>('RecordingToggled', Enums.RecordingToggled);
|
|
386
388
|
|
|
387
389
|
export type RecordingAssertion = Enums.RecordingAssertion;
|
|
388
|
-
export const RecordingAssertion =
|
|
390
|
+
export const RecordingAssertion =
|
|
391
|
+
createDynamicEnumProxy<typeof Enums.RecordingAssertion>('RecordingAssertion', Enums.RecordingAssertion);
|
|
389
392
|
|
|
390
393
|
export type RecordingReplayFinished = Enums.RecordingReplayFinished;
|
|
391
|
-
export const RecordingReplayFinished =
|
|
392
|
-
|
|
394
|
+
export const RecordingReplayFinished = createDynamicEnumProxy<typeof Enums.RecordingReplayFinished>(
|
|
395
|
+
'RecordingReplayFinished', Enums.RecordingReplayFinished);
|
|
393
396
|
|
|
394
397
|
export type RecordingReplaySpeed = Enums.RecordingReplaySpeed;
|
|
395
|
-
export const RecordingReplaySpeed =
|
|
398
|
+
export const RecordingReplaySpeed =
|
|
399
|
+
createDynamicEnumProxy<typeof Enums.RecordingReplaySpeed>('RecordingReplaySpeed', Enums.RecordingReplaySpeed);
|
|
396
400
|
|
|
397
401
|
export type RecordingReplayStarted = Enums.RecordingReplayStarted;
|
|
398
402
|
export const RecordingReplayStarted =
|
|
399
|
-
createDynamicEnumProxy<typeof Enums.RecordingReplayStarted>('RecordingReplayStarted');
|
|
403
|
+
createDynamicEnumProxy<typeof Enums.RecordingReplayStarted>('RecordingReplayStarted', Enums.RecordingReplayStarted);
|
|
400
404
|
|
|
401
405
|
export type RecordingEdited = Enums.RecordingEdited;
|
|
402
|
-
export const RecordingEdited =
|
|
406
|
+
export const RecordingEdited =
|
|
407
|
+
createDynamicEnumProxy<typeof Enums.RecordingEdited>('RecordingEdited', Enums.RecordingEdited);
|
|
403
408
|
|
|
404
409
|
export type RecordingExported = Enums.RecordingExported;
|
|
405
|
-
export const RecordingExported =
|
|
410
|
+
export const RecordingExported =
|
|
411
|
+
createDynamicEnumProxy<typeof Enums.RecordingExported>('RecordingExported', Enums.RecordingExported);
|
|
406
412
|
|
|
407
413
|
export type RecordingCodeToggled = Enums.RecordingCodeToggled;
|
|
408
|
-
export const RecordingCodeToggled =
|
|
414
|
+
export const RecordingCodeToggled =
|
|
415
|
+
createDynamicEnumProxy<typeof Enums.RecordingCodeToggled>('RecordingCodeToggled', Enums.RecordingCodeToggled);
|
|
409
416
|
|
|
410
417
|
export type RecordingCopiedToClipboard = Enums.RecordingCopiedToClipboard;
|
|
411
|
-
export const RecordingCopiedToClipboard =
|
|
412
|
-
|
|
418
|
+
export const RecordingCopiedToClipboard = createDynamicEnumProxy<typeof Enums.RecordingCopiedToClipboard>(
|
|
419
|
+
'RecordingCopiedToClipboard', Enums.RecordingCopiedToClipboard);
|
|
413
420
|
|
|
414
421
|
export type ManifestSectionCodes = Enums.ManifestSectionCodes;
|
|
415
|
-
export const ManifestSectionCodes =
|
|
422
|
+
export const ManifestSectionCodes =
|
|
423
|
+
createDynamicEnumProxy<typeof Enums.ManifestSectionCodes>('ManifestSectionCodes', Enums.ManifestSectionCodes);
|
|
416
424
|
|
|
417
425
|
export type LighthouseModeRun = Enums.LighthouseModeRun;
|
|
418
|
-
export const LighthouseModeRun =
|
|
426
|
+
export const LighthouseModeRun =
|
|
427
|
+
createDynamicEnumProxy<typeof Enums.LighthouseModeRun>('LighthouseModeRun', Enums.LighthouseModeRun);
|
|
419
428
|
|
|
420
429
|
export type LighthouseCategoryUsed = Enums.LighthouseCategoryUsed;
|
|
421
430
|
export const LighthouseCategoryUsed =
|
|
422
|
-
createDynamicEnumProxy<typeof Enums.LighthouseCategoryUsed>('LighthouseCategoryUsed');
|
|
431
|
+
createDynamicEnumProxy<typeof Enums.LighthouseCategoryUsed>('LighthouseCategoryUsed', Enums.LighthouseCategoryUsed);
|
|
423
432
|
|
|
424
433
|
export type SwatchType = Enums.SwatchType;
|
|
425
|
-
export const SwatchType = createDynamicEnumProxy<typeof Enums.SwatchType>('SwatchType');
|
|
434
|
+
export const SwatchType = createDynamicEnumProxy<typeof Enums.SwatchType>('SwatchType', Enums.SwatchType);
|
|
426
435
|
|
|
427
436
|
export type BadgeType = Enums.BadgeType;
|
|
428
|
-
export const BadgeType = createDynamicEnumProxy<typeof Enums.BadgeType>('BadgeType');
|
|
437
|
+
export const BadgeType = createDynamicEnumProxy<typeof Enums.BadgeType>('BadgeType', Enums.BadgeType);
|
|
429
438
|
|
|
430
439
|
export type AnimationsPlaybackRate = Enums.AnimationsPlaybackRate;
|
|
431
440
|
export const AnimationsPlaybackRate =
|
|
432
|
-
createDynamicEnumProxy<typeof Enums.AnimationsPlaybackRate>('AnimationsPlaybackRate');
|
|
441
|
+
createDynamicEnumProxy<typeof Enums.AnimationsPlaybackRate>('AnimationsPlaybackRate', Enums.AnimationsPlaybackRate);
|
|
433
442
|
|
|
434
443
|
export type TimelineNavigationSetting = Enums.TimelineNavigationSetting;
|
|
435
|
-
export const TimelineNavigationSetting =
|
|
436
|
-
|
|
444
|
+
export const TimelineNavigationSetting = createDynamicEnumProxy<typeof Enums.TimelineNavigationSetting>(
|
|
445
|
+
'TimelineNavigationSetting', Enums.TimelineNavigationSetting);
|
|
437
446
|
|
|
438
447
|
export type BuiltInAiAvailability = Enums.BuiltInAiAvailability;
|
|
439
448
|
export const BuiltInAiAvailability =
|
|
440
|
-
createDynamicEnumProxy<typeof Enums.BuiltInAiAvailability>('BuiltInAiAvailability');
|
|
449
|
+
createDynamicEnumProxy<typeof Enums.BuiltInAiAvailability>('BuiltInAiAvailability', Enums.BuiltInAiAvailability);
|
|
441
450
|
|
|
442
451
|
export type ResendRequestType = Enums.ResendRequestType;
|
|
443
|
-
export const ResendRequestType =
|
|
452
|
+
export const ResendRequestType =
|
|
453
|
+
createDynamicEnumProxy<typeof Enums.ResendRequestType>('ResendRequestType', Enums.ResendRequestType);
|
|
444
454
|
|
|
445
455
|
const resendRequestTypeMap = new Map<Common.ResourceType.ResourceType, keyof typeof Enums.ResendRequestType>([
|
|
446
456
|
[Common.ResourceType.resourceTypes.XHR, 'XHR'],
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as Puppeteer from '../../third_party/puppeteer/puppeteer.js';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as CDPConnection from './CDPConnection.js';
|
|
8
8
|
|
|
9
9
|
// Hardcoded string literals corresponding to Puppeteer's CDPSessionEvent.SessionAttached ('sessionattached')
|
|
10
10
|
// and CDPSessionEvent.SessionDetached ('sessiondetached'). We redeclare these strings directly so we can use
|
|
@@ -23,7 +23,13 @@ const SESSION_DETACHED: Puppeteer.CDPSessionEventSessionDetached = 'sessiondetac
|
|
|
23
23
|
export class PuppeteerDevToolsConnection implements CDPConnection.CDPConnection {
|
|
24
24
|
readonly #connection: Puppeteer.Connection;
|
|
25
25
|
readonly #observers = new Set<CDPConnection.CDPConnectionObserver>();
|
|
26
|
-
readonly #sessionEventHandlers = new Map<string,
|
|
26
|
+
readonly #sessionEventHandlers = new Map<string, {
|
|
27
|
+
handler: Puppeteer.Handler<unknown>,
|
|
28
|
+
session: Puppeteer.CDPSession,
|
|
29
|
+
}>();
|
|
30
|
+
readonly #rootSession: Puppeteer.CDPSession;
|
|
31
|
+
readonly #sessionAttachedHandler: Puppeteer.Handler<Puppeteer.CDPSession>;
|
|
32
|
+
readonly #sessionDetachedHandler: Puppeteer.Handler<Puppeteer.CDPSession>;
|
|
27
33
|
|
|
28
34
|
constructor(session: Puppeteer.CDPSession) {
|
|
29
35
|
const connection = session.connection();
|
|
@@ -31,14 +37,17 @@ export class PuppeteerDevToolsConnection implements CDPConnection.CDPConnection
|
|
|
31
37
|
throw new Error('CDPSession has no connection');
|
|
32
38
|
}
|
|
33
39
|
this.#connection = connection;
|
|
40
|
+
this.#rootSession = session;
|
|
41
|
+
this.#sessionAttachedHandler = this.#startForwardingCdpEvents.bind(this) as Puppeteer.Handler<Puppeteer.CDPSession>;
|
|
42
|
+
this.#sessionDetachedHandler = this.#stopForwardingCdpEvents.bind(this) as Puppeteer.Handler<Puppeteer.CDPSession>;
|
|
34
43
|
|
|
35
44
|
session.on(
|
|
36
45
|
SESSION_ATTACHED,
|
|
37
|
-
this.#
|
|
46
|
+
this.#sessionAttachedHandler,
|
|
38
47
|
);
|
|
39
48
|
session.on(
|
|
40
49
|
SESSION_DETACHED,
|
|
41
|
-
this.#
|
|
50
|
+
this.#sessionDetachedHandler,
|
|
42
51
|
);
|
|
43
52
|
|
|
44
53
|
this.#startForwardingCdpEvents(session);
|
|
@@ -56,7 +65,12 @@ export class PuppeteerDevToolsConnection implements CDPConnection.CDPConnection
|
|
|
56
65
|
}
|
|
57
66
|
const session = this.#connection.session(sessionId);
|
|
58
67
|
if (!session) {
|
|
59
|
-
|
|
68
|
+
return Promise.resolve({
|
|
69
|
+
error: {
|
|
70
|
+
code: CDPConnection.CDPErrorStatus.SESSION_NOT_FOUND,
|
|
71
|
+
message: 'Unknown session ' + sessionId,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
60
74
|
}
|
|
61
75
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
62
76
|
return session.send(method as any, params).then(result => ({result})).catch(error => ({
|
|
@@ -82,18 +96,37 @@ export class PuppeteerDevToolsConnection implements CDPConnection.CDPConnection
|
|
|
82
96
|
this,
|
|
83
97
|
session.id(),
|
|
84
98
|
) as Puppeteer.Handler<unknown>;
|
|
85
|
-
this.#sessionEventHandlers.set(session.id(), handler);
|
|
99
|
+
this.#sessionEventHandlers.set(session.id(), {handler, session});
|
|
86
100
|
session.on('*', handler);
|
|
87
101
|
}
|
|
88
102
|
|
|
89
103
|
#stopForwardingCdpEvents(session: Puppeteer.CDPSession): void {
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
session.off('*', handler);
|
|
104
|
+
const entry = this.#sessionEventHandlers.get(session.id());
|
|
105
|
+
if (entry) {
|
|
106
|
+
session.off('*', entry.handler);
|
|
93
107
|
this.#sessionEventHandlers.delete(session.id());
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
|
|
111
|
+
dispose(reason: string): void {
|
|
112
|
+
this.#rootSession.off(
|
|
113
|
+
SESSION_ATTACHED,
|
|
114
|
+
this.#sessionAttachedHandler,
|
|
115
|
+
);
|
|
116
|
+
this.#rootSession.off(
|
|
117
|
+
SESSION_DETACHED,
|
|
118
|
+
this.#sessionDetachedHandler,
|
|
119
|
+
);
|
|
120
|
+
for (const {handler, session} of this.#sessionEventHandlers.values()) {
|
|
121
|
+
session.off('*', handler);
|
|
122
|
+
}
|
|
123
|
+
this.#sessionEventHandlers.clear();
|
|
124
|
+
for (const observer of this.#observers) {
|
|
125
|
+
observer.onDisconnect(reason);
|
|
126
|
+
}
|
|
127
|
+
this.#observers.clear();
|
|
128
|
+
}
|
|
129
|
+
|
|
97
130
|
#handleEvent(
|
|
98
131
|
sessionId: string,
|
|
99
132
|
type: string|symbol|number,
|