chrome-har icon indicating copy to clipboard operation
chrome-har copied to clipboard

Early hints requests do not appear in HAR

Open benschwarz opened this issue 8 months ago • 5 comments

On a page with verified early hints requests we can see requests initiated by early hints:

image

Running that page with npx browsertime --chrome.collectPerfLog -n 1 $URL and inspecting the HAR we can see:

  • Link headers on the main document indicating that early hint requests should be made
  • No early hints requests are present, e.g.: no .css requests
  • SVG requests initiated by .css stylesheets

Inspecting the devtools log I can see that the request made to master-cb9e9afd3d.css (request ID: 87395.8) has the expected Network.requestWillBeSent, Network.responseReceived, Network.dataReceived, Network.loadingFinished events.

Curiously, I noticed that both fromDiskCache and fromEarlyHints are both true on the Network.responseReceived request:

image

In checking entryFromResponse.js we can see that fromDiskCache and __servedFromCache are used to gate functionality:

https://github.com/sitespeedio/chrome-har/blob/2006c4dce0971180b023dda3fe7c0cd085efeadf/lib/entryFromResponse.js#L93

https://github.com/sitespeedio/chrome-har/blob/2006c4dce0971180b023dda3fe7c0cd085efeadf/lib/entryFromResponse.js#L180

I suspect we'll want to check request entries to see if they've been loaded by early request hints.

In case we need it, there's a Network.responseReceivedEarlyHints event.

benschwarz avatar Jun 12 '24 10:06 benschwarz