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

Consider supporting Fetch Metadata. #885

Closed
mikewest opened this issue Mar 24, 2019 · 3 comments · Fixed by #993
Closed

Consider supporting Fetch Metadata. #885

mikewest opened this issue Mar 24, 2019 · 3 comments · Fixed by #993
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@mikewest
Copy link
Member

mikewest commented Mar 24, 2019

https://mikewest.github.io/sec-metadata/ is starting to look pretty reasonable. I plan to put up some PRs to sketch out what the integration would look like, based on the thoughts in https://mikewest.github.io/sec-metadata/#fetch-integration. I think we'd need ~3 changes, but who knows? :)

  1. Add a boolean user activation flag to request objects, defaulting to false. We'd set it in HTML's navigation algorithm, based on whether the navigation was triggered by user activation.

  2. Call set the Fetch Metadata headers for a request. Probably from "main fetch"?

  3. Define "nested-navigate", as per Consider splitting document into document and nested-document. #755.

WDYT?

@annevk
Copy link
Member

annevk commented Mar 25, 2019

What's the expected interaction with service workers? Should service workers see these values exposed in two different places?

Also, if you decide to expose the headers to service workers, you can get in a situation where it appears as if the headers values are preserved, but then when the fetch is made from the service worker, the values get overridden by the fetch algorithm.

@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Mar 25, 2019
@mikewest
Copy link
Member Author

I'm imagining that these headers would be set in main fetch, before we hit the service worker. I could also easily live with the headers being set in HTTP-network-or-cache fetch, after we run through the service worker.

Either way, I'm a bit confused about the expectations for fetches from Service Workers, as my mental model matches what you suggest above ("the values get overridden by the fetch algorithm"), but I've also heard suggestions that "event.respondWith(fetch(event.request)) is the same as if service worker was not there", which would mean that things like destination, et al. carry over. That's not how it works in Chrome today for things like CSP (nor, I believe, does it work that way in Firefox), so it would be helpful to get some clarity.

@jakearchibald and @arturjanc have been discussing this in more detail over the last few days, and might have thoughts to share.

@annevk
Copy link
Member

annevk commented Mar 26, 2019

It's not the same and cannot be. We aim for it mostly being the same (and that it never throws) so developers can use that kind of pattern safely.

mikewest added a commit that referenced this issue Jan 10, 2020
This patch integrates Fetch Metadata processing into Fetch's "main
fetch" algorithm, and defines a "user activation flag" on requests that
will be populated during HTML's "process a navigate fetch" algorithm.

Closes #885.
annevk pushed a commit that referenced this issue Mar 4, 2021
Tests: fetch/metadata.

Closes #885.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

Successfully merging a pull request may close this issue.

2 participants