Use issueTime when calculating load times for prefetched documents
When navigating to a prefetched page, requestStart is much earlier
than when the actual navigation starts, leading to the durations
displayed in the Network summary tab (like DOMContentLoaded) being
much longer than it actually is. We use issueTime instead, which
corresponds more closely to when the navigation starts.
Bug: 339498841
Change-Id: I7cd25a5ac3ae9909836c0bf995fd514e14f2d83f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5545675
Commit-Queue: Adithya Srinivasan <[email protected]>
Reviewed-by: Simon Zünd <[email protected]>
diff --git a/front_end/panels/network/NetworkLogView.ts b/front_end/panels/network/NetworkLogView.ts
index 62c0034..05e973b 100644
--- a/front_end/panels/network/NetworkLogView.ts
+++ b/front_end/panels/network/NetworkLogView.ts
@@ -1209,7 +1209,11 @@
if (networkManager && request.url() === networkManager.target().inspectedURL() &&
request.resourceType() === Common.ResourceType.resourceTypes.Document &&
networkManager.target().parentTarget()?.type() !== SDK.Target.Type.Frame) {
- baseTime = request.startTime;
+ // If the primary main frame's document was fetched from the prefetch cache,
+ // we should use the issueTime (i.e. when the navigation request was about to start)
+ // instead of startTime, which is when the prefetch network request started
+ // (which is typically well before the navigation starts).
+ baseTime = request.fromPrefetchCache() ? request.issueTime() : request.startTime;
}
if (request.endTime > maxTime) {
maxTime = request.endTime;