Re: [ServiceWorker] Define some way for foreign fetch to decide on opaqueness of responses (#841)

My new preferred plan is something like this:

* Instead of `makeVisibleTo`, `respondWith()` on `ForeignFetchEvent` is somewhat different and passed a promise for a dictionary, consisting of `{response: ..., origin: ..., headers: ...}`.
* You always need to pass a dictionary, even when you're not passing origin/headers.
* If you pass headers without origin it'll result in a network error.
* Fetch uses this metadata to construct a network error, opaque response, or foreign-fetch filtered response.
* Foreign-fetch filtered responses's will need some kind of header safelist stored on them (or maybe on the internal response).

Optionally, `ForeignFetchEvent` also has a `validateRepondWith()` with method, that takes a dictionary (not a promise for one) and tells you whether it'll result in a network error, opaque response, or foreign-fetch filtered response. We should only add that after we're absolutely sure that's feasible though. So after all the code paths are worked out and we have the complete setup.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/841#issuecomment-189601139

Received on Saturday, 27 February 2016 07:44:40 UTC