chrome-ai-bridge 1.0.3 → 1.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/build/node_modules/chrome-devtools-frontend/front_end/core/common/Base64.js +20 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Gzip.js +11 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Object.js +6 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ParsedURL.js +3 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ResourceType.js +6 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Settings.js +18 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostStub.js +3 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/ResourceLoader.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +17 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/ArrayUtilities.js +10 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/StringUtilities.js +63 -12
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/CDPConnection.js +1 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +4 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +44 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMetadata.js +6 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DOMModel.js +169 -12
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IsolateManager.js +6 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +18 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +7 -21
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/OverlayModel.js +17 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +5 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +8 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +14 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapManager.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js +11 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Target.js +3 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/ARIAProperties.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/Deprecation.js +1 -16
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +35 -14
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +197 -101
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +10 -16
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +97 -26
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +35 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/annotations/AnnotationRepository.js +163 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/annotations/AnnotationType.js +10 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/annotations/annotations.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +5 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +7 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/DeviceModeModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/EmulatedDevices.js +14 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +8 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/models/greendev/Prototypes.js +33 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/greendev/greendev.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceImpl.js +70 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +82 -30
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/EventsSerializer.js +7 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/LanternComputationData.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Processor.js +18 -19
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Styles.js +12 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/Initiators.js +46 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js +4 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/extras.js +1 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LargestImagePaintHandler.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +6 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/NetworkRequestsHandler.js +10 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/PageLoadMetricsHandler.js +44 -27
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js +9 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Common.js +1 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +2 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +3 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +30 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +28 -13
- package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +4 -0
- package/build/src/tools/chatgpt-web.js +68 -49
- package/build/src/tools/gemini-web.js +66 -22
- package/build/src/tools/pages.js +0 -1
- package/package.json +1 -1
|
@@ -307,6 +307,10 @@ const UIStrings = {
|
|
|
307
307
|
* @description Text in Timeline UIUtils of the Performance panel
|
|
308
308
|
*/
|
|
309
309
|
largestContentfulPaint: 'Largest Contentful Paint',
|
|
310
|
+
/**
|
|
311
|
+
* @description Text in Timeline UIUtils of the Performance panel
|
|
312
|
+
*/
|
|
313
|
+
softLargestContentfulPaint: 'Soft Largest Contentful Paint',
|
|
310
314
|
/**
|
|
311
315
|
* @description Text for timestamps of items
|
|
312
316
|
*/
|
|
@@ -684,6 +688,7 @@ export function maybeInitSylesMap() {
|
|
|
684
688
|
["firstPaint" /* Types.Events.Name.MARK_FIRST_PAINT */]: new TimelineRecordStyle(i18nString(UIStrings.firstPaint), defaultCategoryStyles.painting, true),
|
|
685
689
|
["firstContentfulPaint" /* Types.Events.Name.MARK_FCP */]: new TimelineRecordStyle(i18nString(UIStrings.firstContentfulPaint), defaultCategoryStyles.rendering, true),
|
|
686
690
|
["largestContentfulPaint::Candidate" /* Types.Events.Name.MARK_LCP_CANDIDATE */]: new TimelineRecordStyle(i18nString(UIStrings.largestContentfulPaint), defaultCategoryStyles.rendering, true),
|
|
691
|
+
["largestContentfulPaint::CandidateForSoftNavigation" /* Types.Events.Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */]: new TimelineRecordStyle(i18nString(UIStrings.softLargestContentfulPaint), defaultCategoryStyles.rendering, true),
|
|
687
692
|
["TimeStamp" /* Types.Events.Name.TIME_STAMP */]: new TimelineRecordStyle(i18nString(UIStrings.timestamp), defaultCategoryStyles.scripting),
|
|
688
693
|
["ConsoleTime" /* Types.Events.Name.CONSOLE_TIME */]: new TimelineRecordStyle(i18nString(UIStrings.consoleTime), defaultCategoryStyles.scripting),
|
|
689
694
|
["UserTiming" /* Types.Events.Name.USER_TIMING */]: new TimelineRecordStyle(i18nString(UIStrings.userTiming), defaultCategoryStyles.scripting),
|
|
@@ -795,13 +800,16 @@ export function markerDetailsForEvent(event) {
|
|
|
795
800
|
color = 'var(--sys-color-green-bright)';
|
|
796
801
|
title = "FCP" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.FCP */;
|
|
797
802
|
}
|
|
798
|
-
if (Types.Events.
|
|
803
|
+
if (Types.Events.isAnyLargestContentfulPaintCandidate(event)) {
|
|
799
804
|
color = 'var(--sys-color-green)';
|
|
800
|
-
title =
|
|
805
|
+
title = Types.Events.isSoftLargestContentfulPaintCandidate(event) ?
|
|
806
|
+
"LCP*" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.SOFT_LCP */ :
|
|
807
|
+
"LCP" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP */;
|
|
801
808
|
}
|
|
802
|
-
if (Types.Events.isNavigationStart(event)) {
|
|
809
|
+
if (Types.Events.isNavigationStart(event) || Types.Events.isSoftNavigationStart(event)) {
|
|
803
810
|
color = 'var(--color-text-primary)';
|
|
804
|
-
title = "Nav" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.
|
|
811
|
+
title = Types.Events.isSoftNavigationStart(event) ? "Nav*" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.SOFT_NAV */ :
|
|
812
|
+
"Nav" /* Handlers.ModelHandlers.PageLoadMetrics.MetricName.NAV */;
|
|
805
813
|
}
|
|
806
814
|
if (Types.Events.isMarkDOMContent(event)) {
|
|
807
815
|
color = 'var(--color-text-disabled)';
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/Initiators.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { get as getStackTrace } from './StackTraceForEvent.js';
|
|
2
|
+
/**
|
|
3
|
+
* There are bugs in the backend tracing that means that network requests are
|
|
4
|
+
* often incorrectly tied to an initiator. This function exists as a utility to
|
|
5
|
+
* look up an event's initiator regardless of the type of event, but also to
|
|
6
|
+
* provide a post-parsing fix for network initiators.
|
|
7
|
+
* The TL;DR is that images injected by a script will incorrectly have their
|
|
8
|
+
* initiator set to the root document. To fix this, we look at the stack trace
|
|
9
|
+
* when the request was sent, and use that.
|
|
10
|
+
*/
|
|
11
|
+
export function getNetworkInitiator(data, event) {
|
|
12
|
+
const networkHandlerInitiator = data.NetworkRequests.incompleteInitiator.get(event);
|
|
13
|
+
if (networkHandlerInitiator?.args.data.mimeType === 'text/css') {
|
|
14
|
+
// The bugs in tracing & initiators apply mostly to scripts; we have not
|
|
15
|
+
// seen a case where the trace events identify a CSS stylesheet as the
|
|
16
|
+
// initiator that is incorrect. Therefore, if a stylesheet is identified as
|
|
17
|
+
// the initiator, we trust that it is accurate and can exit early.
|
|
18
|
+
return networkHandlerInitiator;
|
|
19
|
+
}
|
|
20
|
+
// For network requests, it is more reliable to calculate the initiator via
|
|
21
|
+
// the stack trace if we have one.
|
|
22
|
+
// We have to use the raw source event (`ResourceSendRequest`) as that is
|
|
23
|
+
// the event with the `sampleStackId` property which is required to
|
|
24
|
+
// calculate this stacktrace correctly.
|
|
25
|
+
const stack = getStackTrace(event.rawSourceEvent, data);
|
|
26
|
+
// If the resource was injected by a script, it will have a parent call
|
|
27
|
+
// frame that points to the script. Otherwise, there is no parent and
|
|
28
|
+
// therefore we fallthrough to looking at the initiator directly on the
|
|
29
|
+
// network request.
|
|
30
|
+
const initiatorCallFrame = stack?.parent?.callFrames.at(0);
|
|
31
|
+
if (!initiatorCallFrame) {
|
|
32
|
+
return networkHandlerInitiator;
|
|
33
|
+
}
|
|
34
|
+
// Find all the requests for the URL we are searching for. Most of the time
|
|
35
|
+
// there is only 1, but there can be multiple requests for the same URL. The
|
|
36
|
+
// filtering by the timestamp ensures that we can never pick an initiator
|
|
37
|
+
// that happened after the initiated event.
|
|
38
|
+
const matchingRequestIds = data.NetworkRequests.requestIdsByURL.get(initiatorCallFrame.url) ?? [];
|
|
39
|
+
const matchingRequests = matchingRequestIds.map(id => data.NetworkRequests.byId.get(id))
|
|
40
|
+
.filter(req => req !== undefined)
|
|
41
|
+
.filter(req => req.ts < event.ts);
|
|
42
|
+
// Now we have filtered and have a list of requests that are before the
|
|
43
|
+
// event, we take the last one - the one closest to the initiated event.
|
|
44
|
+
// In the case that there are >1 requests, this is an educated guess.
|
|
45
|
+
return matchingRequests.at(-1);
|
|
46
|
+
}
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js
CHANGED
|
@@ -413,8 +413,9 @@ export class BottomUpRootNode extends Node {
|
|
|
413
413
|
node.totalTime += totalTimeById.get(id) || 0;
|
|
414
414
|
totalTimeById.delete(id);
|
|
415
415
|
}
|
|
416
|
-
//
|
|
417
|
-
|
|
416
|
+
// An item on this stack means that this current node has a caller. Therefore,
|
|
417
|
+
// in a bottom-up view it has children.
|
|
418
|
+
if (idStack.length > 0) {
|
|
418
419
|
node.setHasChildren(true);
|
|
419
420
|
}
|
|
420
421
|
}
|
|
@@ -587,7 +588,7 @@ export function generateEventID(event) {
|
|
|
587
588
|
SamplesIntegrator.nativeGroup(event.callFrame.functionName) :
|
|
588
589
|
event.callFrame.functionName;
|
|
589
590
|
const location = event.callFrame.scriptId || event.callFrame.url || '';
|
|
590
|
-
return `f:${name}@${location}`;
|
|
591
|
+
return `f:${name}@${location}:${event.callFrame.lineNumber}:${event.callFrame.columnNumber}`;
|
|
591
592
|
}
|
|
592
593
|
if (Types.Events.isConsoleTimeStamp(event) && event.args.data) {
|
|
593
594
|
return `${event.name}:${event.args.data.name}`;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
export * as FilmStrip from './FilmStrip.js';
|
|
5
|
+
export * as Initiators from './Initiators.js';
|
|
5
6
|
export * as MainThreadActivity from './MainThreadActivity.js';
|
|
6
7
|
export * as ScriptDuplication from './ScriptDuplication.js';
|
|
7
8
|
export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
@@ -43,9 +43,9 @@ export async function finalize() {
|
|
|
43
43
|
const { traceBounds, navigationsByNavigationId } = metaData();
|
|
44
44
|
const metricScoresByFrameId = pageLoadMetricsData().metricScoresByFrameId;
|
|
45
45
|
for (const [navigationId, navigation] of navigationsByNavigationId) {
|
|
46
|
-
const lcpMetric = metricScoresByFrameId.get(navigation.args.frame)?.get(
|
|
46
|
+
const lcpMetric = metricScoresByFrameId.get(navigation.args.frame)?.get(navigation)?.get("LCP" /* MetricName.LCP */);
|
|
47
47
|
const lcpEvent = lcpMetric?.event;
|
|
48
|
-
if (!lcpEvent || !Types.Events.
|
|
48
|
+
if (!lcpEvent || !Types.Events.isAnyLargestContentfulPaintCandidate(lcpEvent)) {
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
51
|
const nodeId = lcpEvent.args.data?.nodeId;
|
|
@@ -395,7 +395,7 @@ async function buildLayoutShiftsClusters() {
|
|
|
395
395
|
// Update the cluster's worst layout shift.
|
|
396
396
|
if (worstShiftEvent) {
|
|
397
397
|
cluster.worstShiftEvent = worstShiftEvent;
|
|
398
|
-
cluster.rawSourceEvent = worstShiftEvent;
|
|
398
|
+
cluster.rawSourceEvent = worstShiftEvent.rawSourceEvent;
|
|
399
399
|
}
|
|
400
400
|
// layout shifts are already sorted by time ascending.
|
|
401
401
|
// Capture the time range of the cluster.
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js
CHANGED
|
@@ -47,6 +47,7 @@ let traceBounds = makeNewTraceBounds();
|
|
|
47
47
|
*/
|
|
48
48
|
let navigationsByFrameId = new Map();
|
|
49
49
|
let navigationsByNavigationId = new Map();
|
|
50
|
+
let softNavigationsById = new Map();
|
|
50
51
|
let finalDisplayUrlByNavigationId = new Map();
|
|
51
52
|
let mainFrameNavigations = [];
|
|
52
53
|
// Represents all the threads in the trace, organized by process. This is mostly for internal
|
|
@@ -76,6 +77,7 @@ const CHROME_WEB_TRACE_EVENTS = new Set([
|
|
|
76
77
|
export function reset() {
|
|
77
78
|
navigationsByFrameId = new Map();
|
|
78
79
|
navigationsByNavigationId = new Map();
|
|
80
|
+
softNavigationsById = new Map();
|
|
79
81
|
finalDisplayUrlByNavigationId = new Map();
|
|
80
82
|
processNames = new Map();
|
|
81
83
|
mainFrameNavigations = [];
|
|
@@ -276,6 +278,9 @@ export function handleEvent(event) {
|
|
|
276
278
|
}
|
|
277
279
|
return;
|
|
278
280
|
}
|
|
281
|
+
if (Types.Events.isSoftNavigationStart(event)) {
|
|
282
|
+
softNavigationsById.set(event.args.context.performanceTimelineNavigationId, event);
|
|
283
|
+
}
|
|
279
284
|
// Update `finalDisplayUrlByNavigationId` to reflect the latest redirect for each navigation.
|
|
280
285
|
if (Types.Events.isResourceSendRequest(event)) {
|
|
281
286
|
if (event.args.data.resourceType !== 'Document') {
|
|
@@ -393,6 +398,7 @@ export function data() {
|
|
|
393
398
|
mainFrameURL,
|
|
394
399
|
navigationsByFrameId,
|
|
395
400
|
navigationsByNavigationId,
|
|
401
|
+
softNavigationsById,
|
|
396
402
|
finalDisplayUrlByNavigationId,
|
|
397
403
|
threadsInProcess,
|
|
398
404
|
rendererProcessesByFrame: rendererProcessesByFrameId,
|
|
@@ -13,6 +13,10 @@ let linkPreconnectEvents = [];
|
|
|
13
13
|
let requestMap = new Map();
|
|
14
14
|
let requestsById = new Map();
|
|
15
15
|
let requestsByTime = [];
|
|
16
|
+
/**
|
|
17
|
+
* URL => RequestId[]. There can be multiple requests for a single URL.
|
|
18
|
+
*/
|
|
19
|
+
let requestIdsByURL = new Map();
|
|
16
20
|
let networkRequestEventByInitiatorUrl = new Map();
|
|
17
21
|
let eventToInitiatorMap = new Map();
|
|
18
22
|
/**
|
|
@@ -61,6 +65,7 @@ export function reset() {
|
|
|
61
65
|
networkRequestEventByInitiatorUrl = new Map();
|
|
62
66
|
eventToInitiatorMap = new Map();
|
|
63
67
|
webSocketData = new Map();
|
|
68
|
+
requestIdsByURL = new Map();
|
|
64
69
|
entityMappings = {
|
|
65
70
|
eventsByEntity: new Map(),
|
|
66
71
|
entityByEvent: new Map(),
|
|
@@ -476,6 +481,9 @@ export async function finalize() {
|
|
|
476
481
|
// the captured requests, so here we store all of them together.
|
|
477
482
|
requestsByTime.push(networkEvent);
|
|
478
483
|
requestsById.set(networkEvent.args.data.requestId, networkEvent);
|
|
484
|
+
const requestsForUrl = requestIdsByURL.get(networkEvent.args.data.url) ?? [];
|
|
485
|
+
requestsForUrl.push(networkEvent.args.data.requestId);
|
|
486
|
+
requestIdsByURL.set(networkEvent.args.data.url, requestsForUrl);
|
|
479
487
|
// Update entity relationships for network events
|
|
480
488
|
HandlerHelpers.addNetworkRequestToEntityMapping(networkEvent, entityMappings, request);
|
|
481
489
|
// Establish initiator relationships
|
|
@@ -501,7 +509,8 @@ export function data() {
|
|
|
501
509
|
return {
|
|
502
510
|
byId: requestsById,
|
|
503
511
|
byTime: requestsByTime,
|
|
504
|
-
|
|
512
|
+
requestIdsByURL,
|
|
513
|
+
incompleteInitiator: eventToInitiatorMap,
|
|
505
514
|
webSocket: [...webSocketData.values()],
|
|
506
515
|
entityMappings: {
|
|
507
516
|
entityByEvent: entityMappings.entityByEvent,
|
|
@@ -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 =
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js
CHANGED
|
@@ -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;
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Common.js
CHANGED
|
@@ -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/node_modules/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/node_modules/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);
|
|
@@ -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) {
|
package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js
CHANGED
|
@@ -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;
|
|
@@ -285,10 +301,13 @@ export function isLayoutInvalidationTracking(event) {
|
|
|
285
301
|
return event.name === "LayoutInvalidationTracking" /* Name.LAYOUT_INVALIDATION_TRACKING */;
|
|
286
302
|
}
|
|
287
303
|
export function isFirstContentfulPaint(event) {
|
|
288
|
-
return event.name ===
|
|
304
|
+
return event.name === "firstContentfulPaint" /* Name.MARK_FCP */;
|
|
305
|
+
}
|
|
306
|
+
export function isAnyLargestContentfulPaintCandidate(event) {
|
|
307
|
+
return event.name === "largestContentfulPaint::Candidate" /* Name.MARK_LCP_CANDIDATE */ || event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */;
|
|
289
308
|
}
|
|
290
|
-
export function
|
|
291
|
-
return event.name === "largestContentfulPaint::
|
|
309
|
+
export function isSoftLargestContentfulPaintCandidate(event) {
|
|
310
|
+
return event.name === "largestContentfulPaint::CandidateForSoftNavigation" /* Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION */;
|
|
292
311
|
}
|
|
293
312
|
export function isLargestImagePaintCandidate(event) {
|
|
294
313
|
return event.name === 'LargestImagePaint::Candidate';
|
|
@@ -297,13 +316,13 @@ export function isLargestTextPaintCandidate(event) {
|
|
|
297
316
|
return event.name === 'LargestTextPaint::Candidate';
|
|
298
317
|
}
|
|
299
318
|
export function isMarkLoad(event) {
|
|
300
|
-
return event.name ===
|
|
319
|
+
return event.name === "MarkLoad" /* Name.MARK_LOAD */;
|
|
301
320
|
}
|
|
302
321
|
export function isFirstPaint(event) {
|
|
303
|
-
return event.name ===
|
|
322
|
+
return event.name === "firstPaint" /* Name.MARK_FIRST_PAINT */;
|
|
304
323
|
}
|
|
305
324
|
export function isMarkDOMContent(event) {
|
|
306
|
-
return event.name ===
|
|
325
|
+
return event.name === "MarkDOMContent" /* Name.MARK_DOM_CONTENT */;
|
|
307
326
|
}
|
|
308
327
|
export function isInteractiveTime(event) {
|
|
309
328
|
return event.name === 'InteractiveTime';
|
|
@@ -369,7 +388,7 @@ export function isPrePaint(event) {
|
|
|
369
388
|
}
|
|
370
389
|
/** A VALID navigation start (as it has a populated documentLoaderURL) */
|
|
371
390
|
export function isNavigationStart(event) {
|
|
372
|
-
return event.name ===
|
|
391
|
+
return event.name === "navigationStart" /* Name.NAVIGATION_START */ && event.args?.data?.documentLoaderURL !== '';
|
|
373
392
|
}
|
|
374
393
|
export function isDidCommitSameDocumentNavigation(event) {
|
|
375
394
|
return event.name === 'RenderFrameHostImpl::DidCommitSameDocumentNavigation' && event.ph === "X" /* Phase.COMPLETE */;
|