Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceTiming - deliveryType #204

Open
jeremyroman opened this issue Jun 13, 2023 · 2 comments
Open

ResourceTiming - deliveryType #204

jeremyroman opened this issue Jun 13, 2023 · 2 comments
Labels

Comments

@jeremyroman
Copy link

WebKittens

@achristensen07, @annevk

Title of the spec

ResourceTiming - deliveryType

URL to the spec

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

URL to the spec's repository

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

Issue Tracker URL

No response

Explainer URL

https://gist.github.com/jeremyroman/43f8f290f1f404d3b7f6cb708601c7f0

TAG Design Review URL

w3ctag/design-reviews#858

Mozilla standards-positions issue URL

mozilla/standards-positions#824

WebKit Bugzilla URL

No response

Radar URL

No response

Description

The Resource Timing text currently only covers "" and "cache".

Chromium also implements "navigational-prefetch" as part of https://wicg.github.io/nav-speculation/prefetch.html (currently behind a flag). some of that work might be covered by #54.

@annevk
Copy link
Contributor

annevk commented Jun 14, 2023

The security questionnaire suggests Timing-Allow-Origin applies, but generally that's not a good fit for navigations. How exactly does it end up applying? Consider that a variety of origins might have initiated the navigation, which could all be different from the parent frame origin, etc.

(I thought of raising this as an issue, but it's not clear where.)

@jeremyroman
Copy link
Author

For navigations, the TAO check trivially succeeds (since it is tautologically same-origin to itself), as you note. Consequently, a document can always tell if it, itself, was loaded from cache or was the object of navigational prefetch.

Whether it was served from cache is already knowable due to the magic number 300 in transferSize (which is available on the navigation, since it's same-origin). Whether it was served from a navigational prefetch isn't directly expressed yet, but might be inferred from the very small timestamps available (again, since documents can observe their own timing), or the pace of elements being added by the parser, or various other ways the document can observe its own loading. Nonetheless, authors benefit from a more ergonomic way to determine this.

For other resources, the ability to distinguish between "" and "cache" (i.e., to tell if a cross-origin subresource was cached) is limited by Timing-Allow-Origin, in the same way as transferSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants