Closed jgraham closed 4 months ago
Draft Fetch PR: https://github.com/whatwg/fetch/pull/1756
One question here is whether this interacts with cache-mode specific headers in the expected way. In particular this will end up setting the headers so that not only do we not use the local cache, but we also don't populate any HTTP caches for this request.
@sadym-chromium would you mind reviewing?
Had a quick look at how Firefox behaves when disabling cache from DevTools (which we intend to reuse for BiDi).
So I'm not really sure what to do with this.
It seems like talking in terms of the cache mode has made an interop difference visible: Firefox neither reads from nor writes to the cache, but Chrome does write to it. That would affect what happens if you do a no-cache request followed by a cached request.
However for the non-HTTP caches, working purely in terms of the cache mode on the request seems like it maybe doesn't work well? Per fetch it seems like requests use the CORS preflight cache irrespective of their cache-mode. So we could have a webdriver-specific rule that we should clear the preflight cache for a request if the override mode is, say, no-store
or reload
, but then the WebDriver API has different behaviour from the DOM API. Or we could have a separate flag to bypass the CORS cache (i.e. something like network.setCacheMode({cacheMode, contexts, bypassCORS})`, but that seems potentially unwieldy.
This also applies to all the possible in-memory caches, but even more so since the details may differ between browsers.
Or the other option is to just support the bare "bypass all caches" use case instead of specifying a specific cache mode i.e. make the command network.setCacheBypass({bypass, contexts})
. That seems close to what CDP has, but it's rather inflexible if we want to offer more control (similar to existing DOM APIs) in the future.
The Browser Testing and Tools Working Group just discussed Bypass network cache behaviour
.
I'm going to update the existing tentative tests (which failed to merge upstream) via https://bugzilla.mozilla.org/show_bug.cgi?id=1906100.
This currently only allows setting the request cache mode to 'no-store' which bypasses the cache entirely. If we have future use cases for setting different cache modes, this appraoch would be extensible to those use cases.
Preview | Diff