w3c / resource-timing

Resource Timing
https://w3c.github.io/resource-timing/
Other
119 stars 35 forks source link

Should data: urls be reported in resource timing? #386

Closed clelland closed 2 months ago

clelland commented 2 months ago

Context: https://issues.chromium.org/issues/333831248

The "Resources included" section of the spec says (in a non-normative list) that

If an HTML IMG element has a data: URI as its source [RFC2397], then this resource will not be included as a PerformanceResourceTiming object in the Performance Timeline. By definition data: URI contains embedded data and does not require a fetch.

This text has been present in the spec as far back as I can trace its history -- back to 2011, at least. However, since 2013, data: urls have been handled by fetch (see https://fetch.spec.whatwg.org/#data-urls), and there's no normative spec text in resource timing that I can see that prohibits them.

There's no WPT validating either behaviour, and I think that user agents may be in disagreement on whether to include them or not.

Should we remove that note? Or add a check in the spec to exclude data: urls? (and possibly blob urls, and anything else that shouldn't require a network fetch)

clelland commented 2 months ago

@noamr points out that mark resource timing is called by fetch as part of the report timing steps, the first step of which is to return early if the URL being fetched has a non-http(s) scheme.

So data: urls should be excluded, and the only action here might be to clarify why exactly that happens, although it's not urgent as the text in question is non-normative.

noamr commented 2 months ago

Yea the only action item here would be to add an informative note.

noamr commented 2 months ago

Oh actually there is one already, in the introduction: https://w3c.github.io/resource-timing/#introduction-0 Perhaps we can close this?

clelland commented 2 months ago

It's just the reasoning there that is incorrect. It's not that these URLs aren't handled by fetch; it's that only resources fetched through HTTP(s) URLs report timing.