Closed OrKoN closed 1 month ago
Note that at the moment the browsingContext.reload
command has a ignoreCache
argument, and browsingContext.navigate
doesn't care about that itself.
So the question is if each command should get such a ignoreCache
argument, or if it should be enabled/disabled for all commands based on single other new command.
CC @jgraham
For loads originating from WebDriver, I would make it per-command myself, since that seems more flexible and less stateful.
But there's also the question of what happens to requests not originating from WebDriver itself. If we want to disable the cache for those (without doing some hideous network request interception thing to ensure they never hit the cache) we perhaps need the global state (or a less hideous way to intercept requests and mark them as bypassing the cache, but that might be quite high overhead).
@OrKoN do you have some feedback into how CDP handles that and what exactly should be affected by that feature?
After a quick look:
1) setting cache to disabled, evicts all resources from memory cache within one renderer https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/memory_cache.h;l=70;drc=67d90538f11c6b232dbfd716075db52aeb34fd15 2) The MemoryCache resources are also evicted on committing load 3) For outgoing network requests, the request mode is set to bypass cache or force cache hit. Not sure how many caches are there on the network layer. 4) CORS preflight requests are also forced when cache is disabled 5) Also it affects the media player loading
I think the expectation is that it applies to all requests in the scope, even if they are not originating from the driver.
I think all devtools offer a "disable cache" feature, which for Firefox is scoped per top-level browsing context (ie doesn't impact other tabs, even if they also have devtools open).
But for BiDi, maybe this would make sense as a command on the network
domain, with an optional contexts
argument to restrict it to only certain top level contexts?
The Browser Testing and Tools Working Group just discussed Ability to bypass network cache
.
I believe this can be closed since https://w3c.github.io/webdriver-bidi/#command-network-setCacheBehavior provides the required functionality.
CDP offers a command to disable the network cache for a given browsing context (s) https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCacheDisabled
Puppeteer exposes it as https://pptr.dev/api/puppeteer.page.setcacheenabled/
cc @whimboo