Open Bug 1905759 Opened 1 year ago Updated 1 month ago

ResourceTiming and NavigationTiming nextHopProtocol should be empty for cached resources

Categories

(Core :: DOM: Performance APIs, defect, P2)

Firefox 127
defect

Tracking

()

UNCONFIRMED

People

(Reporter: nic, Unassigned)

Details

Steps to reproduce:

  1. Navigate to https://dev.nicj.net/nexthopprotocol-transfersize.html
  2. This repro page reports the nextHopProtocol and transferSize of the page (NavigationTiming) and a simple Fetch (ResourceTiming)
  3. On the initial page load, you should see h2 and some amount of bytes transferred
  4. If you click on "navigate to same page on domain 1" it'll re-navigate to the same page, which should be in the HTTP cache
  5. The nextHopProtocol is still listed as h2 even though transferSize=0 (it's loaded from the disk or memory cache)

Actual results:

The nextHopProtocol is still listed as h2 even though transferSize=0 (it's loaded from the disk or memory cache)

Expected results:

ResourceTiming specifies that content fetched from application caches should have nextHopProtocol be empty:

https://w3c.github.io/resource-timing/#sec-performanceresourcetiming

Component: Untriaged → DOM: Performance
Product: Firefox → Core

The severity field is not set for this bug.
:fdoty, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(fdoty)
Severity: -- → S3
Flags: needinfo?(fdoty)

@Nic I'm unable to open https://dev.nicj.net/nexthopprotocol-transfersize.html. Can you confirm if this is still an issue? Also, do you know if there's a web platform test for this? A quick look shows that it could be covered here.

Flags: needinfo?(nic)
Priority: -- → P2

@Dave apologies, I've fixed the repro URL: https://dev.nicj.net/nexthopprotocol-transfersize.html

Firefox 142.0.1 shows the same behavior as reported above, where nextHopProtocol is 'h2' or 'h3' instead of '' upon cache hit. Chrome v139 does as well FWIW.

https://github.com/web-platform-tests/wpt/blob/master/resource-timing/sizes-cache.any.js looks like it's doing a similar scenario, though it's not checking nextHopProtocol as far as I can tell.

Flags: needinfo?(nic)

Thanks Nic! I had a look through the Resource Timing spec and I only see nextHopProtocol being empty for cross-origin resources without TAO. I couldn’t find anything that says it should be empty when the resource comes from application caches. Maybe I’m missing something, or maybe the spec has evolved since this was reported?

Flags: needinfo?(nic)

I've been trying to interpret the specs a bit as well: between Resource Timing and Fetch, I think it would suggest the nextHopProtocol should be blank in case no actual connection is established.

Starting with this text:

The nextHopProtocol getter steps are to isomorphic decode this's timing info's final connection timing info's ALPN negotiated protocol. See Recording connection timing info for more info.

That links out to these sections of Fetch:

It's a bit hard to follow everything, but it feels like if no new connection was established then either the "timing info" should be null, or, its' nextHopProtocol should be null.

The ResourceTiming spec itself has a callout for the transferSize getter steps which sets transferSize to 0 for local cache. Maybe we should be doing something similar for nextHopProtocol? I'll open an issue to discuss.

Flags: needinfo?(nic)

FWIW I think we had spec language specifying nextHopProtocol should be empty string prior to our alignment with Fetch; see

https://github.com/w3c/resource-timing/issues/73
https://github.com/w3c/resource-timing/pull/78

New issue opened:

https://github.com/w3c/resource-timing/issues/419

You need to log in before you can comment on or make changes to this bug.