From 48fc0f93357c440fe83a1431c61cddef73a4915c Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 29 May 2024 12:21:46 +0100 Subject: [PATCH] Allow WebDriver BiDi to override the cache mode The primary use case here is allowing WebDriver to enforce that requests do not use the network cache, including the CORS preflight cache. But for future extension the this works by calling into WebDriver BiDi to get a cache behavior for the request, which is then translated into specific implementation on the fetch side (e.g. setting the request's cache mode, or not using the preflight cache). For now the only possible values of the cache behavior are "default" and "bypass", so we only need to check for the latter value. --- fetch.bs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index b44c83990..9127c50c2 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5237,6 +5237,8 @@ these steps:
  • There is at least one item in the CORS-unsafe request-header names with request's header list for which there is no header-name cache entry match using request. + +
  • WebDriver BiDi cache behavior with request is "bypass".

    Then: @@ -5615,6 +5617,9 @@ run these steps: default `User-Agent` value) to httpRequest's header list. +

  • If WebDriver BiDi cache behavior with request is "bypass, then + set httpRequest's cache mode to "no-store". +

  • If httpRequest's cache mode is "default" and httpRequest's header list contains `If-Modified-Since`, @@ -6495,8 +6500,9 @@ populates the CORS-preflight cache to minimize the number of these

  • If max-age is greater than an imposed limit on max-age, then set max-age to the imposed limit. -

  • If the user agent does not provide for a cache, then - return response. +

  • If the user agent does not provide for a cache, + or WebDriver BiDi cache behavior with request is "bypass", + then return response.

  • For each method in methods for which there is a method cache entry match using request, set matching entry's