Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch: Track protocol information in Response.
This CL plumbs three protocol related fields through the fetch API Response internal representation: 1) The |alpn_negotiated_protocol| which is set for TLS negotiated protocols like H2. 2) The |connection_info| enumeration which includes information on older protocols like H1. 3) The |was_fetched_via_spdy| boolean which is set for H2. The first two values, |alpn_negotiated_protocol| and |connection_info|, are collectively used to populate the `PerformanceResourceTiming.nextHopProtocol` value. They are also both used to populate the correct protocol information in the devtools network panel. The |was_fetched_via_spdy| boolean is used to the deprecated `navigator.chrome.loadTimes().wasFetchedViaSpdy` property. Without this plumbing the resulting exposed values will generally be wrong if the page loaded via a service worker with a FetchEvent handler. For example, `PerformanceResourceTiming.nextHopeProtocol` is always the empty string for resources loaded via a service worker that does a pass-through or cached load. This CL also plumbs these values through the cache_storage layer. While that may seem unintuitive at first, since the data is coming from disk, it matches the behavior when loading from http cache. Generally the values represent the protocol used to originally load the response and are persisted in the cache. I believe this also matches the cache_storage spec where Response objects are effectively held in an array without any serialization or deserialization where data would be lost: https://w3c.github.io/ServiceWorker/#cache-objects Although the spec is not currently clear if the protocol information lives on the response object, its not clear where else it could be stored. This should become clearer once the Resource Timing spec is integrated with the fetch spec in: w3c/resource-timing#39 This CL includes an automated WPT test for the `PerformanceResourceTiming.nextHopProtocol` value since we can verify that its populated with "http/1.1" instead of the empty string. Unfortunately it was not possible to writes for the other attributes since we do not currently have the ability to test against an http2 server. Both `wasFetchedViaSpdy` and the devtools output effectively need an http2 server to observe differences. These parts of the CL were manually tested. Bug: 1069813 Change-Id: I84819ef5a53e9246f9e383e56b6d7e5901a7a243
- Loading branch information