Populate PerformanceNavigationTiming::deliveryType with the value
"navigational-prefetch".
Per https://github.com/WICG/nav-speculation/pull/180,
PerformanceNavigationTiming::deliveryType will
have value "navigational-prefetch" if the navigation is toward a
prefetched URL.
PrefetchService now sets a new enum on the response header, which will
be checked in NavigationRequest::CommitNavigation for its value. If the
value is kNavigationPrefetch, NavigationRequest::CommitNavigation sets
the new navigational_delivery_type entry in the CommitParam, which is
eventually sent to the renderer side DocumentLoader, used to construct
the PerformanceNavigationTiming object.
With this CL, the delivery_type_ of PerformanceResourceTiming and
PerformanceNavigationTiming is set by the following:
"navigational-prefetch" always takes highest precedence if presented;
else, delivery_type_ is deduced by the cache state.
TAO is not tested because we always observe the navigation timing at
the destination, which is always same-origin to the document
(prefetched or not). This matches the behavior of
PerformanceNavigationTiming::AllowTimingDetails [1], that TAO check
passes unconditionally.
The WPT will remain tentative until the spec is updated.
[1]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/performance_navigation_timing.cc;drc=87d6bd2db3e1ac920d1e289126bf264a2a9a313f;l=111
Bug: 1358591
Low-Coverage-Reason: tested by WPT.
Change-Id: I5db2d6aaa05a15afb0a5d769d4474088a67c75bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3976228
Commit-Queue: William Liu <[email protected]>
Reviewed-by: Jeremy Roman <[email protected]>
Reviewed-by: Max Curran <[email protected]>
Reviewed-by: Rakina Zata Amni <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1065435}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index c996cac..978ceb2 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -101,6 +101,7 @@
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
+#include "services/network/public/mojom/url_response_head.mojom-shared.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
@@ -3969,7 +3970,9 @@
GURL() /* fallback_srcdoc_baseurl_value */,
false /* should_load_data_url */,
/*ancestor_or_self_has_cspee=*/node->AncestorOrSelfHasCSPEE(),
- std::string() /* reduced_accept_language */);
+ std::string() /* reduced_accept_language */,
+ /*navigation_delivery_type=*/
+ network::mojom::NavigationDeliveryType::kDefault);
#if BUILDFLAG(IS_ANDROID)
if (ValidateDataURLAsString(params.data_url_as_string)) {
commit_params->data_url_as_string = params.data_url_as_string->data();