[whatwg/fetch] Add a "revalidated" cache state (#1232)

<!--
Thank you for contributing to the Fetch Standard! Please describe the change you are making and complete the checklist below if your change is not editorial.
-->

While [implementing](https://chromium-review.googlesource.com/c/chromium/src/+/2878693) the recent [Resource Timing transferSize changes](https://github.com/w3c/resource-timing/pull/266), I realized that the current spec is not sufficient to implement what was discussed in the WG, and more importantly, insufficient to maintain backwards compatibility with current `transferSize` values.

Essentially, we want `transferSize` to return different values for the cases of local caching (in which case it needs to return 0), full fetch from the network (in which case it needs to return the encoded body size + a constant) as well as the *successful revalidation* case (where it needs to return *just* the constant representing the headers used to revalidate the response).

For that purpose, the "cache state" in Fetch needs to change. This PR implements that change. 

- [ ] At least two implementers are interested (and none opposed):
   * Chrome
   * …
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * …
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=1185801

   * Firefox: …
   * Safari: …

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)

You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/fetch/pull/1232


-- Commit Summary --

  * Add a "revalidated" cache state

-- File Changes --

    M fetch.bs (6)

-- Patch Links --

https://github.com/whatwg/fetch/pull/1232.patch

https://github.com/whatwg/fetch/pull/1232.diff


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1232

Received on Friday, 7 May 2021 08:34:18 UTC