@mcp-b/chrome-devtools-mcp 2.0.2 → 2.0.5
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/README.md +120 -10
- package/build/src/McpContext.js +69 -5
- package/build/src/browser.js +157 -51
- package/build/src/cli.js +11 -5
- package/build/src/formatters/IssueFormatter.js +190 -0
- package/build/src/main.js +83 -2
- package/build/src/telemetry/clearcut-logger.js +102 -0
- package/build/src/telemetry/flag-utils.js +45 -0
- package/build/src/telemetry/metric-utils.js +14 -0
- package/build/src/telemetry/persistence.js +53 -0
- package/build/src/telemetry/types.js +33 -0
- package/build/src/telemetry/watchdog/clearcut-sender.js +201 -0
- package/build/src/telemetry/watchdog/main.js +127 -0
- package/build/src/telemetry/watchdog-client.js +60 -0
- package/build/src/third_party/devtools-formatter-worker.js +7 -0
- package/build/src/third_party/index.js +1 -1
- package/build/src/tools/browser.js +92 -0
- package/build/src/tools/extension.js +31 -0
- package/build/src/tools/extensions.js +79 -0
- package/build/src/tools/input.js +6 -1
- package/build/src/tools/pages.js +7 -1
- package/build/src/tools/script.js +31 -4
- package/build/src/tools/tools.js +4 -0
- package/build/src/transports/CDPClientTransport.js +184 -0
- package/build/src/transports/WebMCPBridgeScript.js +11 -2
- package/build/src/utils/ExtensionRegistry.js +35 -0
- package/build/src/utils/string.js +36 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Base64.js +20 -2
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Debouncer.js +8 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Gzip.js +11 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Object.js +6 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/ParsedURL.js +3 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/ResourceType.js +6 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Revealer.js +0 -5
- package/build/vendor/chrome-devtools-frontend/front_end/core/common/Settings.js +18 -8
- package/build/vendor/chrome-devtools-frontend/front_end/core/host/AidaClient.js +24 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostStub.js +11 -3
- package/build/vendor/chrome-devtools-frontend/front_end/core/host/ResourceLoader.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +27 -20
- package/build/vendor/chrome-devtools-frontend/front_end/core/i18n/collect-ui-strings.js +7 -8
- package/build/vendor/chrome-devtools-frontend/front_end/core/i18n/generate-locales-js.js +4 -5
- package/build/vendor/chrome-devtools-frontend/front_end/core/platform/ArrayUtilities.js +10 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/platform/StringUtilities.js +63 -12
- package/build/vendor/chrome-devtools-frontend/front_end/core/protocol_client/CDPConnection.js +1 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +4 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/root/ExperimentNames.js +30 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/root/root.js +2 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/AnimationModel.js +0 -4
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +69 -9
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CSSMetadata.js +6 -6
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +28 -13
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CSSProperty.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js +6 -0
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/ConsoleModel.js +0 -2
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/CookieModel.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/DOMModel.js +170 -13
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +5 -39
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/HeapProfilerModel.js +8 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +20 -5
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +12 -21
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/OverlayModel.js +19 -6
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +5 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +8 -5
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +15 -10
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/SourceMapManager.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js +13 -27
- package/build/vendor/chrome-devtools-frontend/front_end/core/sdk/Target.js +3 -1
- package/build/vendor/chrome-devtools-frontend/front_end/generated/ARIAProperties.js +1 -7
- package/build/vendor/chrome-devtools-frontend/front_end/generated/Deprecation.js +1 -16
- package/build/vendor/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +82 -22
- package/build/vendor/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +265 -123
- package/build/vendor/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +2 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +10 -16
- package/build/vendor/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +97 -26
- package/build/vendor/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +35 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/annotations/AnnotationRepository.js +163 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/annotations/AnnotationType.js +10 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/annotations/annotations.js +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +5 -3
- package/build/vendor/chrome-devtools-frontend/front_end/models/bindings/DebuggerLanguagePlugins.js +29 -58
- package/build/vendor/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +7 -45
- package/build/vendor/chrome-devtools-frontend/front_end/models/emulation/DeviceModeModel.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/emulation/EmulatedDevices.js +14 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +8 -5
- package/build/vendor/chrome-devtools-frontend/front_end/models/greendev/Prototypes.js +33 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/greendev/greendev.js +4 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/ContrastCheckTrigger.js +2 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/CookieIssue.js +0 -21
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/CorsIssue.js +1 -38
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/IssueAggregator.js +8 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/IssuesManager.js +6 -12
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/PermissionElementIssue.js +243 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementActivationDisabled.md +7 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementInvalidType.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementLowContrast.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementRegistrationFailed.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementRequestInProgress.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementTypeNotSupported.md +5 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/permissionElementUntrustedEvent.md +7 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/issues_manager.js +2 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/logs/NetworkLog.js +0 -8
- package/build/vendor/chrome-devtools-frontend/front_end/models/source_map_scopes/NamesResolver.js +4 -8
- package/build/vendor/chrome-devtools-frontend/front_end/models/stack_trace/StackTrace.js +30 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceImpl.js +70 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +82 -30
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/EventsSerializer.js +10 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/LanternComputationData.js +2 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/ModelImpl.js +0 -3
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/Processor.js +18 -19
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/Styles.js +12 -4
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/extras/Initiators.js +46 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js +4 -3
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/extras/extras.js +1 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/handlers/LargestImagePaintHandler.js +2 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +6 -0
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/handlers/NetworkRequestsHandler.js +10 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/handlers/PageLoadMetricsHandler.js +44 -27
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js +9 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/Common.js +1 -6
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +2 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +2 -4
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +3 -2
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +33 -11
- package/build/vendor/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +51 -18
- package/build/vendor/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +1 -1
- package/build/vendor/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +4 -0
- package/build/vendor/chrome-devtools-frontend/mcp/HostBindings.js +4 -0
- package/build/vendor/chrome-devtools-frontend/mcp/mcp.js +4 -0
- package/package.json +28 -21
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteInvalidSameParty.md +0 -8
- package/build/vendor/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteSamePartyCrossPartyContextSet.md +0 -10
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* This handler stores page load metrics, including web vitals,
|
|
6
6
|
* and exports them in the shape of a map with the following shape:
|
|
7
|
-
* Map(FrameId -> Map(
|
|
7
|
+
* Map(FrameId -> Map(navigation -> metrics) )
|
|
8
|
+
*
|
|
9
|
+
* Includes soft navigations.
|
|
8
10
|
*
|
|
9
11
|
* It also exports all markers in a trace in an array.
|
|
10
12
|
*
|
|
@@ -50,10 +52,6 @@ export function handleEvent(event) {
|
|
|
50
52
|
pageLoadEventsArray.push(event);
|
|
51
53
|
}
|
|
52
54
|
function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
53
|
-
const navigationId = navigation.args.data?.navigationId;
|
|
54
|
-
if (!navigationId) {
|
|
55
|
-
throw new Error('Navigation event unexpectedly had no navigation ID.');
|
|
56
|
-
}
|
|
57
55
|
const frameId = getFrameIdForPageLoadEvent(event);
|
|
58
56
|
const { rendererProcessesByFrame } = metaHandlerData();
|
|
59
57
|
// If either of these pieces of data do not exist, the most likely
|
|
@@ -77,14 +75,14 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
77
75
|
const fcpTime = Types.Timing.Micro(event.ts - navigation.ts);
|
|
78
76
|
const classification = scoreClassificationForFirstContentfulPaint(fcpTime);
|
|
79
77
|
const metricScore = { event, metricName: "FCP" /* MetricName.FCP */, classification, navigation, timing: fcpTime };
|
|
80
|
-
storeMetricScore(frameId,
|
|
78
|
+
storeMetricScore(frameId, navigation, metricScore);
|
|
81
79
|
return;
|
|
82
80
|
}
|
|
83
81
|
if (Types.Events.isFirstPaint(event)) {
|
|
84
82
|
const paintTime = Types.Timing.Micro(event.ts - navigation.ts);
|
|
85
83
|
const classification = "unclassified" /* ScoreClassification.UNCLASSIFIED */;
|
|
86
84
|
const metricScore = { event, metricName: "FP" /* MetricName.FP */, classification, navigation, timing: paintTime };
|
|
87
|
-
storeMetricScore(frameId,
|
|
85
|
+
storeMetricScore(frameId, navigation, metricScore);
|
|
88
86
|
return;
|
|
89
87
|
}
|
|
90
88
|
if (Types.Events.isMarkDOMContent(event)) {
|
|
@@ -96,7 +94,7 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
96
94
|
navigation,
|
|
97
95
|
timing: dclTime,
|
|
98
96
|
};
|
|
99
|
-
storeMetricScore(frameId,
|
|
97
|
+
storeMetricScore(frameId, navigation, metricScore);
|
|
100
98
|
return;
|
|
101
99
|
}
|
|
102
100
|
if (Types.Events.isInteractiveTime(event)) {
|
|
@@ -108,7 +106,7 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
108
106
|
navigation,
|
|
109
107
|
timing: ttiValue,
|
|
110
108
|
};
|
|
111
|
-
storeMetricScore(frameId,
|
|
109
|
+
storeMetricScore(frameId, navigation, tti);
|
|
112
110
|
const tbtValue = Helpers.Timing.milliToMicro(Types.Timing.Milli(event.args.args.total_blocking_time_ms));
|
|
113
111
|
const tbt = {
|
|
114
112
|
event,
|
|
@@ -117,7 +115,7 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
117
115
|
navigation,
|
|
118
116
|
timing: tbtValue,
|
|
119
117
|
};
|
|
120
|
-
storeMetricScore(frameId,
|
|
118
|
+
storeMetricScore(frameId, navigation, tbt);
|
|
121
119
|
return;
|
|
122
120
|
}
|
|
123
121
|
if (Types.Events.isMarkLoad(event)) {
|
|
@@ -129,10 +127,10 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
129
127
|
navigation,
|
|
130
128
|
timing: loadTime,
|
|
131
129
|
};
|
|
132
|
-
storeMetricScore(frameId,
|
|
130
|
+
storeMetricScore(frameId, navigation, metricScore);
|
|
133
131
|
return;
|
|
134
132
|
}
|
|
135
|
-
if (Types.Events.
|
|
133
|
+
if (Types.Events.isAnyLargestContentfulPaintCandidate(event)) {
|
|
136
134
|
const candidateIndex = event.args.data?.candidateIndex;
|
|
137
135
|
if (!candidateIndex) {
|
|
138
136
|
throw new Error('Largest Contentful Paint unexpectedly had no candidateIndex.');
|
|
@@ -146,15 +144,15 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
146
144
|
timing: lcpTime,
|
|
147
145
|
};
|
|
148
146
|
const metricsByNavigation = Platform.MapUtilities.getWithDefault(metricScoresByFrameId, frameId, () => new Map());
|
|
149
|
-
const metrics = Platform.MapUtilities.getWithDefault(metricsByNavigation,
|
|
147
|
+
const metrics = Platform.MapUtilities.getWithDefault(metricsByNavigation, navigation, () => new Map());
|
|
150
148
|
const lastLCPCandidate = metrics.get("LCP" /* MetricName.LCP */);
|
|
151
149
|
if (lastLCPCandidate === undefined) {
|
|
152
150
|
selectedLCPCandidateEvents.add(lcp.event);
|
|
153
|
-
storeMetricScore(frameId,
|
|
151
|
+
storeMetricScore(frameId, navigation, lcp);
|
|
154
152
|
return;
|
|
155
153
|
}
|
|
156
154
|
const lastLCPCandidateEvent = lastLCPCandidate.event;
|
|
157
|
-
if (!Types.Events.
|
|
155
|
+
if (!Types.Events.isAnyLargestContentfulPaintCandidate(lastLCPCandidateEvent)) {
|
|
158
156
|
return;
|
|
159
157
|
}
|
|
160
158
|
const lastCandidateIndex = lastLCPCandidateEvent.args.data?.candidateIndex;
|
|
@@ -167,18 +165,21 @@ function storePageLoadMetricAgainstNavigationId(navigation, event) {
|
|
|
167
165
|
if (lastCandidateIndex < candidateIndex) {
|
|
168
166
|
selectedLCPCandidateEvents.delete(lastLCPCandidateEvent);
|
|
169
167
|
selectedLCPCandidateEvents.add(lcp.event);
|
|
170
|
-
storeMetricScore(frameId,
|
|
168
|
+
storeMetricScore(frameId, navigation, lcp);
|
|
171
169
|
}
|
|
172
170
|
return;
|
|
173
171
|
}
|
|
174
172
|
if (Types.Events.isLayoutShift(event)) {
|
|
175
173
|
return;
|
|
176
174
|
}
|
|
175
|
+
if (Types.Events.isSoftNavigationStart(event)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
177
178
|
return Platform.assertNever(event, `Unexpected event type: ${event}`);
|
|
178
179
|
}
|
|
179
|
-
function storeMetricScore(frameId,
|
|
180
|
+
function storeMetricScore(frameId, navigation, metricScore) {
|
|
180
181
|
const metricsByNavigation = Platform.MapUtilities.getWithDefault(metricScoresByFrameId, frameId, () => new Map());
|
|
181
|
-
const metrics = Platform.MapUtilities.getWithDefault(metricsByNavigation,
|
|
182
|
+
const metrics = Platform.MapUtilities.getWithDefault(metricsByNavigation, navigation, () => new Map());
|
|
182
183
|
// If an entry with that metric name is present, delete it so that the new entry that
|
|
183
184
|
// will replace it is added at the end of the map. This way we guarantee the map entries
|
|
184
185
|
// are ordered in ASC manner by timestamp.
|
|
@@ -187,8 +188,9 @@ function storeMetricScore(frameId, navigationId, metricScore) {
|
|
|
187
188
|
}
|
|
188
189
|
export function getFrameIdForPageLoadEvent(event) {
|
|
189
190
|
if (Types.Events.isFirstContentfulPaint(event) || Types.Events.isInteractiveTime(event) ||
|
|
190
|
-
Types.Events.
|
|
191
|
-
Types.Events.
|
|
191
|
+
Types.Events.isAnyLargestContentfulPaintCandidate(event) || Types.Events.isNavigationStart(event) ||
|
|
192
|
+
Types.Events.isSoftNavigationStart(event) || Types.Events.isLayoutShift(event) ||
|
|
193
|
+
Types.Events.isFirstPaint(event)) {
|
|
192
194
|
return event.args.frame;
|
|
193
195
|
}
|
|
194
196
|
if (Types.Events.isMarkDOMContent(event) || Types.Events.isMarkLoad(event)) {
|
|
@@ -201,20 +203,35 @@ export function getFrameIdForPageLoadEvent(event) {
|
|
|
201
203
|
Platform.assertNever(event, `Unexpected event type: ${event}`);
|
|
202
204
|
}
|
|
203
205
|
function getNavigationForPageLoadEvent(event) {
|
|
204
|
-
if (Types.Events.isFirstContentfulPaint(event) || Types.Events.
|
|
206
|
+
if (Types.Events.isFirstContentfulPaint(event) || Types.Events.isAnyLargestContentfulPaintCandidate(event) ||
|
|
205
207
|
Types.Events.isFirstPaint(event)) {
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
const { navigationsByNavigationId, softNavigationsById } = metaHandlerData();
|
|
209
|
+
let navigation;
|
|
210
|
+
if (event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Types.Events.Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */ &&
|
|
211
|
+
event.args.data?.performanceTimelineNavigationId) {
|
|
212
|
+
navigation = softNavigationsById.get(event.args.data.performanceTimelineNavigationId);
|
|
213
|
+
if (!navigation) {
|
|
214
|
+
// The most recent soft navigation must have been before the trace started.
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const navigationId = event.args.data?.navigationId;
|
|
220
|
+
if (!navigationId) {
|
|
221
|
+
throw new Error(`Trace event unexpectedly had no navigation ID: ${JSON.stringify(event, null, 2)}`);
|
|
222
|
+
}
|
|
223
|
+
navigation = navigationsByNavigationId.get(navigationId);
|
|
209
224
|
}
|
|
210
|
-
const { navigationsByNavigationId } = metaHandlerData();
|
|
211
|
-
const navigation = navigationsByNavigationId.get(navigationId);
|
|
212
225
|
if (!navigation) {
|
|
213
226
|
// This event's navigation has been filtered out by the meta handler as a noise event.
|
|
214
227
|
return null;
|
|
215
228
|
}
|
|
216
229
|
return navigation;
|
|
217
230
|
}
|
|
231
|
+
if (Types.Events.isSoftNavigationStart(event)) {
|
|
232
|
+
const { softNavigationsById } = metaHandlerData();
|
|
233
|
+
return softNavigationsById.get(event.args.context.performanceTimelineNavigationId) ?? null;
|
|
234
|
+
}
|
|
218
235
|
if (Types.Events.isMarkDOMContent(event) || Types.Events.isInteractiveTime(event) ||
|
|
219
236
|
Types.Events.isLayoutShift(event) || Types.Events.isMarkLoad(event)) {
|
|
220
237
|
const frameId = getFrameIdForPageLoadEvent(event);
|
|
@@ -329,7 +346,7 @@ export async function finalize() {
|
|
|
329
346
|
const allFinalLCPEvents = gatherFinalLCPEvents();
|
|
330
347
|
const mainFrame = metaHandlerData().mainFrameId;
|
|
331
348
|
// Filter out LCP candidates to use only definitive LCP values
|
|
332
|
-
const allEventsButLCP = pageLoadEventsArray.filter(event => !Types.Events.
|
|
349
|
+
const allEventsButLCP = pageLoadEventsArray.filter(event => !Types.Events.isAnyLargestContentfulPaintCandidate(event));
|
|
333
350
|
const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(Types.Events.isMarkerEvent);
|
|
334
351
|
// Filter by main frame and sort.
|
|
335
352
|
allMarkerEvents =
|
|
@@ -9,9 +9,16 @@ export const secondsToMilli = (value) => Types.Timing.Milli(value * 1000);
|
|
|
9
9
|
export const secondsToMicro = (value) => milliToMicro(secondsToMilli(value));
|
|
10
10
|
export const microToMilli = (value) => Types.Timing.Milli(value / 1000);
|
|
11
11
|
export const microToSeconds = (value) => Types.Timing.Seconds(value / 1000 / 1000);
|
|
12
|
-
export function timeStampForEventAdjustedByClosestNavigation(event, traceBounds, navigationsByNavigationId, navigationsByFrameId) {
|
|
12
|
+
export function timeStampForEventAdjustedByClosestNavigation(event, traceBounds, navigationsByNavigationId, softNavigationsById, navigationsByFrameId) {
|
|
13
13
|
let eventTimeStamp = event.ts - traceBounds.min;
|
|
14
|
-
if (event.
|
|
14
|
+
if (event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Types.Events.Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */ &&
|
|
15
|
+
event.args?.data?.performanceTimelineNavigationId) {
|
|
16
|
+
const navigationForEvent = softNavigationsById.get(event.args.data.performanceTimelineNavigationId);
|
|
17
|
+
if (navigationForEvent) {
|
|
18
|
+
eventTimeStamp = event.ts - navigationForEvent.ts;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else if (event.args?.data?.navigationId) {
|
|
15
22
|
const navigationForEvent = navigationsByNavigationId.get(event.args.data.navigationId);
|
|
16
23
|
if (navigationForEvent) {
|
|
17
24
|
eventTimeStamp = event.ts - navigationForEvent.ts;
|
|
@@ -6,12 +6,7 @@ import * as Types from '../types/types.js';
|
|
|
6
6
|
import { getLogNormalScore } from './Statistics.js';
|
|
7
7
|
const GRAPH_SAVINGS_PRECISION = 50;
|
|
8
8
|
export function getInsight(insightName, insightSet) {
|
|
9
|
-
|
|
10
|
-
if (insight instanceof Error) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
// For some reason typescript won't narrow the type by removing Error, so do it manually.
|
|
14
|
-
return insight;
|
|
9
|
+
return insightSet.model[insightName];
|
|
15
10
|
}
|
|
16
11
|
export function getLCP(insightSet) {
|
|
17
12
|
const insight = getInsight("LCPBreakdown" /* InsightKeys.LCP_BREAKDOWN */, insightSet);
|
package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js
CHANGED
|
@@ -155,13 +155,13 @@ export function generateInsight(data, context) {
|
|
|
155
155
|
if (!frameMetrics) {
|
|
156
156
|
throw new Error('no frame metrics');
|
|
157
157
|
}
|
|
158
|
-
const navMetrics = frameMetrics.get(context.
|
|
158
|
+
const navMetrics = frameMetrics.get(context.navigation);
|
|
159
159
|
if (!navMetrics) {
|
|
160
160
|
throw new Error('no navigation metrics');
|
|
161
161
|
}
|
|
162
162
|
const metricScore = navMetrics.get("LCP" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP */);
|
|
163
163
|
const lcpEvent = metricScore?.event;
|
|
164
|
-
if (!lcpEvent || !Types.Events.
|
|
164
|
+
if (!lcpEvent || !Types.Events.isAnyLargestContentfulPaintCandidate(lcpEvent)) {
|
|
165
165
|
return finalize({ warnings: [InsightWarning.NO_LCP] });
|
|
166
166
|
}
|
|
167
167
|
// This helps calculate the subparts.
|
package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js
CHANGED
|
@@ -81,13 +81,13 @@ export function generateInsight(data, context) {
|
|
|
81
81
|
if (!frameMetrics) {
|
|
82
82
|
throw new Error('no frame metrics');
|
|
83
83
|
}
|
|
84
|
-
const navMetrics = frameMetrics.get(context.
|
|
84
|
+
const navMetrics = frameMetrics.get(context.navigation);
|
|
85
85
|
if (!navMetrics) {
|
|
86
86
|
throw new Error('no navigation metrics');
|
|
87
87
|
}
|
|
88
88
|
const metricScore = navMetrics.get("LCP" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP */);
|
|
89
89
|
const lcpEvent = metricScore?.event;
|
|
90
|
-
if (!lcpEvent || !Types.Events.
|
|
90
|
+
if (!lcpEvent || !Types.Events.isAnyLargestContentfulPaintCandidate(lcpEvent)) {
|
|
91
91
|
return finalize({ warnings: [InsightWarning.NO_LCP] });
|
|
92
92
|
}
|
|
93
93
|
const docRequest = networkRequests.byId.get(context.navigationId);
|
|
@@ -99,8 +99,6 @@ export function generateInsight(data, context) {
|
|
|
99
99
|
return finalize({ lcpEvent });
|
|
100
100
|
}
|
|
101
101
|
const initiatorUrl = lcpRequest.args.data.initiator?.url;
|
|
102
|
-
// TODO(b/372319476): Explore using trace event HTMLDocumentParser::FetchQueuedPreloads to determine if the request
|
|
103
|
-
// is discovered by the preload scanner.
|
|
104
102
|
const initiatedByMainDoc = lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
|
|
105
103
|
const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
|
|
106
104
|
const imageLoadingAttr = lcpEvent.args.data?.loadingAttr;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as Common from '../../../core/common/common.js';
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
6
|
import * as Platform from '../../../core/platform/platform.js';
|
|
7
|
+
import * as Extras from '../extras/extras.js';
|
|
7
8
|
import * as Helpers from '../helpers/helpers.js';
|
|
8
9
|
import * as Types from '../types/types.js';
|
|
9
10
|
import { InsightCategory, } from './types.js';
|
|
@@ -406,8 +407,8 @@ function candidateRequestsByOrigin(data, mainResource, contextRequests, lcpGraph
|
|
|
406
407
|
if (!hasValidTiming(request)) {
|
|
407
408
|
return;
|
|
408
409
|
}
|
|
409
|
-
|
|
410
|
-
if (
|
|
410
|
+
const initiator = Extras.Initiators.getNetworkInitiator(data, request);
|
|
411
|
+
if (initiator === mainResource) {
|
|
411
412
|
return;
|
|
412
413
|
}
|
|
413
414
|
const url = new URL(request.args.data.url);
|
package/build/vendor/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js
CHANGED
|
@@ -130,7 +130,7 @@ export function generateInsight(data, context) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
const firstPaintTs = data.PageLoadMetrics.metricScoresByFrameId.get(context.frameId)
|
|
133
|
-
?.get(context.
|
|
133
|
+
?.get(context.navigation)
|
|
134
134
|
?.get("FP" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.FP */)
|
|
135
135
|
?.event?.ts;
|
|
136
136
|
if (!firstPaintTs) {
|
|
@@ -12,6 +12,9 @@ export function isPhaseAsync(phase) {
|
|
|
12
12
|
export function isFlowPhase(phase) {
|
|
13
13
|
return phase === "s" /* Phase.FLOW_START */ || phase === "t" /* Phase.FLOW_STEP */ || phase === "f" /* Phase.FLOW_END */;
|
|
14
14
|
}
|
|
15
|
+
export function objectIsEvent(obj) {
|
|
16
|
+
return 'cat' in obj && 'name' in obj && 'ts' in obj;
|
|
17
|
+
}
|
|
15
18
|
export function objectIsCallFrame(object) {
|
|
16
19
|
return ('functionName' in object && typeof object.functionName === 'string') &&
|
|
17
20
|
('scriptId' in object && (typeof object.scriptId === 'string' || typeof object.scriptId === 'number')) &&
|
|
@@ -38,17 +41,30 @@ export function isLegacySyntheticScreenshot(event) {
|
|
|
38
41
|
export function isScreenshot(event) {
|
|
39
42
|
return event.name === "Screenshot" /* Name.SCREENSHOT */ && 'source_id' in (event.args ?? {});
|
|
40
43
|
}
|
|
44
|
+
export function isSoftNavigationStart(event) {
|
|
45
|
+
return event.name === "SoftNavigationStart" /* Name.SOFT_NAVIGATION_START */;
|
|
46
|
+
}
|
|
41
47
|
const markerTypeGuards = [
|
|
42
48
|
isMarkDOMContent,
|
|
43
49
|
isMarkLoad,
|
|
44
50
|
isFirstPaint,
|
|
45
51
|
isFirstContentfulPaint,
|
|
46
|
-
|
|
52
|
+
isAnyLargestContentfulPaintCandidate,
|
|
47
53
|
isNavigationStart,
|
|
54
|
+
isSoftNavigationStart,
|
|
55
|
+
];
|
|
56
|
+
export const MarkerName = [
|
|
57
|
+
"MarkDOMContent" /* Name.MARK_DOM_CONTENT */,
|
|
58
|
+
"MarkLoad" /* Name.MARK_LOAD */,
|
|
59
|
+
"firstPaint" /* Name.MARK_FIRST_PAINT */,
|
|
60
|
+
"firstContentfulPaint" /* Name.MARK_FCP */,
|
|
61
|
+
"largestContentfulPaint::Candidate" /* Name.MARK_LCP_CANDIDATE */,
|
|
62
|
+
"largestContentfulPaint::CandidateForSoftNavigation" /* Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */,
|
|
63
|
+
"navigationStart" /* Name.NAVIGATION_START */,
|
|
64
|
+
"SoftNavigationStart" /* Name.SOFT_NAVIGATION_START */,
|
|
48
65
|
];
|
|
49
|
-
export const MarkerName = ['MarkDOMContent', 'MarkLoad', 'firstPaint', 'firstContentfulPaint', 'largestContentfulPaint::Candidate'];
|
|
50
66
|
export function isMarkerEvent(event) {
|
|
51
|
-
if (event.ph === "I" /* Phase.INSTANT */ || event.ph === "R" /* Phase.MARK */) {
|
|
67
|
+
if (event.ph === "I" /* Phase.INSTANT */ || "n" /* Phase.ASYNC_NESTABLE_INSTANT */ || event.ph === "R" /* Phase.MARK */) {
|
|
52
68
|
return markerTypeGuards.some(fn => fn(event));
|
|
53
69
|
}
|
|
54
70
|
return false;
|
|
@@ -58,7 +74,7 @@ const pageLoadEventTypeGuards = [
|
|
|
58
74
|
isInteractiveTime,
|
|
59
75
|
];
|
|
60
76
|
export function eventIsPageLoadEvent(event) {
|
|
61
|
-
if (event.ph === "I" /* Phase.INSTANT */ || event.ph === "R" /* Phase.MARK */) {
|
|
77
|
+
if (event.ph === "I" /* Phase.INSTANT */ || "n" /* Phase.ASYNC_NESTABLE_INSTANT */ || event.ph === "R" /* Phase.MARK */) {
|
|
62
78
|
return pageLoadEventTypeGuards.some(fn => fn(event));
|
|
63
79
|
}
|
|
64
80
|
return false;
|
|
@@ -118,6 +134,9 @@ export function isPipelineReporter(event) {
|
|
|
118
134
|
export function isSyntheticBased(event) {
|
|
119
135
|
return 'rawSourceEvent' in event;
|
|
120
136
|
}
|
|
137
|
+
export function isJSSample(event) {
|
|
138
|
+
return event.name === "JSSample" /* Name.JS_SAMPLE */;
|
|
139
|
+
}
|
|
121
140
|
export function isSyntheticInteraction(event) {
|
|
122
141
|
return Boolean('interactionId' in event && event.args?.data && 'beginEvent' in event.args.data && 'endEvent' in event.args.data);
|
|
123
142
|
}
|
|
@@ -285,10 +304,13 @@ export function isLayoutInvalidationTracking(event) {
|
|
|
285
304
|
return event.name === "LayoutInvalidationTracking" /* Name.LAYOUT_INVALIDATION_TRACKING */;
|
|
286
305
|
}
|
|
287
306
|
export function isFirstContentfulPaint(event) {
|
|
288
|
-
return event.name ===
|
|
307
|
+
return event.name === "firstContentfulPaint" /* Name.MARK_FCP */;
|
|
308
|
+
}
|
|
309
|
+
export function isAnyLargestContentfulPaintCandidate(event) {
|
|
310
|
+
return event.name === "largestContentfulPaint::Candidate" /* Name.MARK_LCP_CANDIDATE */ || event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */;
|
|
289
311
|
}
|
|
290
|
-
export function
|
|
291
|
-
return event.name === "largestContentfulPaint::
|
|
312
|
+
export function isSoftLargestContentfulPaintCandidate(event) {
|
|
313
|
+
return event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */;
|
|
292
314
|
}
|
|
293
315
|
export function isLargestImagePaintCandidate(event) {
|
|
294
316
|
return event.name === 'LargestImagePaint::Candidate';
|
|
@@ -297,13 +319,13 @@ export function isLargestTextPaintCandidate(event) {
|
|
|
297
319
|
return event.name === 'LargestTextPaint::Candidate';
|
|
298
320
|
}
|
|
299
321
|
export function isMarkLoad(event) {
|
|
300
|
-
return event.name ===
|
|
322
|
+
return event.name === "MarkLoad" /* Name.MARK_LOAD */;
|
|
301
323
|
}
|
|
302
324
|
export function isFirstPaint(event) {
|
|
303
|
-
return event.name ===
|
|
325
|
+
return event.name === "firstPaint" /* Name.MARK_FIRST_PAINT */;
|
|
304
326
|
}
|
|
305
327
|
export function isMarkDOMContent(event) {
|
|
306
|
-
return event.name ===
|
|
328
|
+
return event.name === "MarkDOMContent" /* Name.MARK_DOM_CONTENT */;
|
|
307
329
|
}
|
|
308
330
|
export function isInteractiveTime(event) {
|
|
309
331
|
return event.name === 'InteractiveTime';
|
|
@@ -369,7 +391,7 @@ export function isPrePaint(event) {
|
|
|
369
391
|
}
|
|
370
392
|
/** A VALID navigation start (as it has a populated documentLoaderURL) */
|
|
371
393
|
export function isNavigationStart(event) {
|
|
372
|
-
return event.name ===
|
|
394
|
+
return event.name === "navigationStart" /* Name.NAVIGATION_START */ && event.args?.data?.documentLoaderURL !== '';
|
|
373
395
|
}
|
|
374
396
|
export function isDidCommitSameDocumentNavigation(event) {
|
|
375
397
|
return event.name === 'RenderFrameHostImpl::DidCommitSameDocumentNavigation' && event.ph === "X" /* Phase.COMPLETE */;
|
|
@@ -17,14 +17,19 @@ export function decode(sourceMap, options = DEFAULT_DECODE_OPTIONS) {
|
|
|
17
17
|
return decodeMap(sourceMap, opts);
|
|
18
18
|
}
|
|
19
19
|
function decodeMap(sourceMap, options) {
|
|
20
|
-
if (!sourceMap.scopes || !sourceMap.names)
|
|
21
|
-
return { scopes: [], ranges: [] };
|
|
20
|
+
if (!sourceMap.scopes || !sourceMap.names) {
|
|
21
|
+
return { scopes: [], ranges: [], hasVariableAndBindingInfo: false };
|
|
22
|
+
}
|
|
22
23
|
return new Decoder(sourceMap.scopes, sourceMap.names, options).decode();
|
|
23
24
|
}
|
|
24
25
|
function decodeIndexMap(sourceMap, options) {
|
|
25
|
-
const scopeInfo = {
|
|
26
|
+
const scopeInfo = {
|
|
27
|
+
scopes: [],
|
|
28
|
+
ranges: [],
|
|
29
|
+
hasVariableAndBindingInfo: false,
|
|
30
|
+
};
|
|
26
31
|
for (const section of sourceMap.sections) {
|
|
27
|
-
const { scopes, ranges } = decode(section.map, {
|
|
32
|
+
const { scopes, ranges, hasVariableAndBindingInfo } = decode(section.map, {
|
|
28
33
|
...options,
|
|
29
34
|
generatedOffset: section.offset,
|
|
30
35
|
});
|
|
@@ -32,6 +37,7 @@ function decodeIndexMap(sourceMap, options) {
|
|
|
32
37
|
scopeInfo.scopes.push(scope);
|
|
33
38
|
for (const range of ranges)
|
|
34
39
|
scopeInfo.ranges.push(range);
|
|
40
|
+
scopeInfo.hasVariableAndBindingInfo ||= hasVariableAndBindingInfo;
|
|
35
41
|
}
|
|
36
42
|
return scopeInfo;
|
|
37
43
|
}
|
|
@@ -59,6 +65,8 @@ class Decoder {
|
|
|
59
65
|
#rangeStack = [];
|
|
60
66
|
#flatOriginalScopes = [];
|
|
61
67
|
#subRangeBindingsForRange = new Map();
|
|
68
|
+
#seenOriginalScopeVariables = false;
|
|
69
|
+
#seenGeneratedRangeBindings = false;
|
|
62
70
|
constructor(scopes, names, options) {
|
|
63
71
|
this.#encodedScopes = scopes;
|
|
64
72
|
this.#names = names;
|
|
@@ -69,13 +77,12 @@ class Decoder {
|
|
|
69
77
|
decode() {
|
|
70
78
|
const iter = new TokenIterator(this.#encodedScopes);
|
|
71
79
|
while (iter.hasNext()) {
|
|
72
|
-
if (iter.peek() === ",") {
|
|
73
|
-
iter.nextChar(); // Consume ",".
|
|
74
|
-
this.#scopes.push(null); // Add an EmptyItem;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
80
|
const tag = iter.nextUnsignedVLQ();
|
|
78
81
|
switch (tag) {
|
|
82
|
+
case 0 /* Tag.EMPTY */: {
|
|
83
|
+
this.#scopes.push(null);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
79
86
|
case 1 /* Tag.ORIGINAL_SCOPE_START */: {
|
|
80
87
|
const item = {
|
|
81
88
|
flags: iter.nextUnsignedVLQ(),
|
|
@@ -97,6 +104,7 @@ class Decoder {
|
|
|
97
104
|
variableIdxs.push(iter.nextSignedVLQ());
|
|
98
105
|
}
|
|
99
106
|
this.#handleOriginalScopeVariablesItem(variableIdxs);
|
|
107
|
+
this.#seenOriginalScopeVariables = true;
|
|
100
108
|
break;
|
|
101
109
|
}
|
|
102
110
|
case 2 /* Tag.ORIGINAL_SCOPE_END */: {
|
|
@@ -139,6 +147,7 @@ class Decoder {
|
|
|
139
147
|
valueIdxs.push(iter.nextUnsignedVLQ());
|
|
140
148
|
}
|
|
141
149
|
this.#handleGeneratedRangeBindingsItem(valueIdxs);
|
|
150
|
+
this.#seenGeneratedRangeBindings = true;
|
|
142
151
|
break;
|
|
143
152
|
}
|
|
144
153
|
case 7 /* Tag.GENERATED_RANGE_SUBRANGE_BINDING */: {
|
|
@@ -152,12 +161,21 @@ class Decoder {
|
|
|
152
161
|
]);
|
|
153
162
|
}
|
|
154
163
|
this.#recordGeneratedSubRangeBindingItem(variableIndex, bindings);
|
|
164
|
+
this.#seenGeneratedRangeBindings = true;
|
|
155
165
|
break;
|
|
156
166
|
}
|
|
157
167
|
case 8 /* Tag.GENERATED_RANGE_CALL_SITE */: {
|
|
158
168
|
this.#handleGeneratedRangeCallSite(iter.nextUnsignedVLQ(), iter.nextUnsignedVLQ(), iter.nextUnsignedVLQ());
|
|
159
169
|
break;
|
|
160
170
|
}
|
|
171
|
+
case 99 /* Tag.VENDOR_EXTENSION */: {
|
|
172
|
+
const _extensionNameIdx = iter.nextUnsignedVLQ();
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
default: {
|
|
176
|
+
this.#throwInStrictMode(`Encountered illegal item tag ${tag}`);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
161
179
|
}
|
|
162
180
|
// Consume any trailing VLQ and the the ","
|
|
163
181
|
while (iter.hasNext() && iter.peek() !== ",")
|
|
@@ -165,20 +183,23 @@ class Decoder {
|
|
|
165
183
|
if (iter.hasNext())
|
|
166
184
|
iter.nextChar();
|
|
167
185
|
}
|
|
168
|
-
if (iter.currentChar() === ",") {
|
|
169
|
-
// Handle trailing EmptyItem.
|
|
170
|
-
this.#scopes.push(null);
|
|
171
|
-
}
|
|
172
186
|
if (this.#scopeStack.length > 0) {
|
|
173
187
|
this.#throwInStrictMode("Encountered ORIGINAL_SCOPE_START without matching END!");
|
|
174
188
|
}
|
|
175
189
|
if (this.#rangeStack.length > 0) {
|
|
176
190
|
this.#throwInStrictMode("Encountered GENERATED_RANGE_START without matching END!");
|
|
177
191
|
}
|
|
178
|
-
const info = {
|
|
192
|
+
const info = {
|
|
193
|
+
scopes: this.#scopes,
|
|
194
|
+
ranges: this.#ranges,
|
|
195
|
+
hasVariableAndBindingInfo: this.#seenOriginalScopeVariables &&
|
|
196
|
+
this.#seenGeneratedRangeBindings,
|
|
197
|
+
};
|
|
179
198
|
this.#scopes = [];
|
|
180
199
|
this.#ranges = [];
|
|
181
200
|
this.#flatOriginalScopes = [];
|
|
201
|
+
this.#seenOriginalScopeVariables = false;
|
|
202
|
+
this.#seenGeneratedRangeBindings = false;
|
|
182
203
|
return info;
|
|
183
204
|
}
|
|
184
205
|
#throwInStrictMode(message) {
|
|
@@ -285,7 +306,6 @@ class Decoder {
|
|
|
285
306
|
}
|
|
286
307
|
}
|
|
287
308
|
this.#rangeStack.push(range);
|
|
288
|
-
this.#subRangeBindingsForRange.clear();
|
|
289
309
|
}
|
|
290
310
|
#handleGeneratedRangeBindingsItem(valueIdxs) {
|
|
291
311
|
const range = this.#rangeStack.at(-1);
|
|
@@ -303,11 +323,21 @@ class Decoder {
|
|
|
303
323
|
}
|
|
304
324
|
}
|
|
305
325
|
#recordGeneratedSubRangeBindingItem(variableIndex, bindings) {
|
|
306
|
-
|
|
326
|
+
const range = this.#rangeStack.at(-1);
|
|
327
|
+
if (!range) {
|
|
328
|
+
this.#throwInStrictMode("Encountered GENERATED_RANGE_SUBRANGE_BINDING without surrounding GENERATED_RANGE_START");
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
let subRangeBindings = this.#subRangeBindingsForRange.get(range);
|
|
332
|
+
if (!subRangeBindings) {
|
|
333
|
+
subRangeBindings = new Map();
|
|
334
|
+
this.#subRangeBindingsForRange.set(range, subRangeBindings);
|
|
335
|
+
}
|
|
336
|
+
if (subRangeBindings.has(variableIndex)) {
|
|
307
337
|
this.#throwInStrictMode("Encountered multiple GENERATED_RANGE_SUBRANGE_BINDING items for the same variable");
|
|
308
338
|
return;
|
|
309
339
|
}
|
|
310
|
-
|
|
340
|
+
subRangeBindings.set(variableIndex, bindings);
|
|
311
341
|
}
|
|
312
342
|
#handleGeneratedRangeCallSite(sourceIndex, line, column) {
|
|
313
343
|
const range = this.#rangeStack.at(-1);
|
|
@@ -349,7 +379,10 @@ class Decoder {
|
|
|
349
379
|
}
|
|
350
380
|
}
|
|
351
381
|
#handleGeneratedRangeSubRangeBindings(range) {
|
|
352
|
-
|
|
382
|
+
const subRangeBindings = this.#subRangeBindingsForRange.get(range);
|
|
383
|
+
if (!subRangeBindings)
|
|
384
|
+
return;
|
|
385
|
+
for (const [variableIndex, bindings] of subRangeBindings) {
|
|
353
386
|
const value = range.values[variableIndex];
|
|
354
387
|
const subRanges = [];
|
|
355
388
|
range.values[variableIndex] = subRanges;
|
|
@@ -132,6 +132,8 @@ export class McpHostBindings {
|
|
|
132
132
|
}
|
|
133
133
|
recordPerformanceHistogram() {
|
|
134
134
|
}
|
|
135
|
+
recordPerformanceHistogramMedium() {
|
|
136
|
+
}
|
|
135
137
|
recordUserMetricsAction() {
|
|
136
138
|
}
|
|
137
139
|
recordNewBadgeUsage() {
|
|
@@ -219,4 +221,6 @@ export class McpHostBindings {
|
|
|
219
221
|
}
|
|
220
222
|
recordFunctionCall() {
|
|
221
223
|
}
|
|
224
|
+
setChromeFlag() {
|
|
225
|
+
}
|
|
222
226
|
}
|
|
@@ -18,13 +18,17 @@ export * as I18n from '../front_end/core/i18n/i18n.js';
|
|
|
18
18
|
export { ConnectionTransport } from '../front_end/core/protocol_client/ConnectionTransport.js';
|
|
19
19
|
export * as ProtocolClient from '../front_end/core/protocol_client/protocol_client.js';
|
|
20
20
|
export { DebuggerModel } from '../front_end/core/sdk/DebuggerModel.js';
|
|
21
|
+
export { RuntimeModel } from '../front_end/core/sdk/RuntimeModel.js';
|
|
21
22
|
export { Target } from '../front_end/core/sdk/Target.js';
|
|
22
23
|
export { TargetManager } from '../front_end/core/sdk/TargetManager.js';
|
|
23
24
|
export * as Foundation from '../front_end/foundation/foundation.js';
|
|
25
|
+
export * as Protocol from '../front_end/generated/protocol.js';
|
|
24
26
|
export { PerformanceInsightFormatter } from '../front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js';
|
|
25
27
|
export { PerformanceTraceFormatter } from '../front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js';
|
|
26
28
|
export { AgentFocus } from '../front_end/models/ai_assistance/performance/AIContext.js';
|
|
27
29
|
export { DebuggerWorkspaceBinding } from '../front_end/models/bindings/DebuggerWorkspaceBinding.js';
|
|
30
|
+
export { CrUXManager } from '../front_end/models/crux-manager/CrUXManager.js';
|
|
31
|
+
export * as Formatter from '../front_end/models/formatter/formatter.js';
|
|
28
32
|
export { Issue } from '../front_end/models/issues_manager/Issue.js';
|
|
29
33
|
export { AggregatedIssue, IssueAggregator } from '../front_end/models/issues_manager/IssueAggregator.js';
|
|
30
34
|
export { createIssuesFromProtocolIssue, IssuesManager } from '../front_end/models/issues_manager/IssuesManager.js';
|