Skip to content

Commit e35f5e7

Browse files
committed
Replace setCacheBypass with setCacheBehavior
Also correctly specify how to handle mixed per-navigable and global settings, so that: * Updating the global setting always overrides any per-navigable settings. * Per-navigable settings are only stored where they're different to the global setting. This should match the behavior of subscribing to events.
1 parent fb9e9ee commit e35f5e7

File tree

1 file changed

+63
-38
lines changed

1 file changed

+63
-38
lines changed

index.bs

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,9 @@ To <dfn>cleanup remote end state</dfn>.
14461446

14471447
1. [=map/Clear=] the [=before request sent map=].
14481448

1449-
1. Set the [=default cache bypass=] to false.
1449+
1. Set the [=default cache behavior=] to "<code>default</code>".
14501450

1451-
1. [=set/Empty=] the [=navigable cache bypass set=].
1451+
1. [=map/Clear=] the [=navigable cache behavior map=].
14521452

14531453
</div>
14541454

@@ -4733,12 +4733,12 @@ A [=remote end=] has a <dfn>before request sent map</dfn> which is initially an
47334733
empty map. It's used to track the network events for which a
47344734
<code>network.beforeRequestSent</code> event has already been sent.
47354735

4736-
A [=remote end=] has a <dfn>default cache bypass</dfn> which is a boolean. It is
4737-
initially false.
4736+
A [=remote end=] has a <dfn>default cache behavior</dfn> which is a string. It is
4737+
initially "<code>default</code>".
47384738

4739-
A [=remote end=] has a <dfn>navigable cache bypass set</dfn> which is initially an
4740-
empty weak set. It's used to track the [=/top-level traversables=] in which
4741-
network caches are bypassed.
4739+
A [=remote end=] has a <dfn>navigable cache behavior map</dfn> which is a weak
4740+
map between [=/top-level traversables=] and strings representing cache
4741+
behavior. It is initially empty.
47424742

47434743
### Network Intercepts ### {#network-intercepts}
47444744

@@ -6577,22 +6577,22 @@ requests will be affected.
65776577

65786578
</div>
65796579

6580-
#### The network.setCacheBypass Command #### {#command-network-setCacheBypass}
6580+
#### The network.setCacheBehavior Command #### {#command-network-setCacheBehavior}
65816581

6582-
The <dfn export for=commands>network.setCacheBypass</dfn> command bypasses the
6583-
network cache for certain requests.
6582+
The <dfn export for=commands>network.setCacheBehavior</dfn> command configures
6583+
the network cache behavior for certain requests.
65846584

65856585
<dl>
65866586
<dt>Command Type</dt>
65876587
<dd>
65886588
<pre class="cddl remote-cddl">
6589-
network.SetCacheBypass = (
6590-
method: "network.setCacheBypass",
6591-
params: network.SetCacheBypassParameters
6589+
network.SetCacheBehavior = (
6590+
method: "network.setCacheBehavior",
6591+
params: network.SetCacheBehaviorParameters
65926592
)
65936593

6594-
network.SetCacheBypassParameters = {
6595-
bypass: bool,
6594+
network.SetCacheBehaviorParameters = {
6595+
cacheBehavior: "default" / "bypass",
65966596
? contexts: [+browsingContext.BrowsingContext]
65976597
}
65986598
</pre>
@@ -6606,7 +6606,7 @@ network cache for certain requests.
66066606
</dl>
66076607

66086608
<div algorithm>
6609-
The <dfn export>WebDriver BiDi bypass cache</dfn> steps given |request| are:
6609+
The <dfn export>WebDriver BiDi cache behavior</dfn> steps given |request| are:
66106610

66116611
1. Let |context| be null.
66126612

@@ -6618,53 +6618,78 @@ The <dfn export>WebDriver BiDi bypass cache</dfn> steps given |request| are:
66186618
settings|' [=environment settings object/global object=], set |context| to
66196619
the [=top-level browsing context=] for that browsing context.
66206620

6621-
1. If |context| is not null and [=navigable cache bypass set=] [=set/contains=]
6622-
|context|, return true.
6621+
1. If |context| is not null and [=navigable cache behavior map=] [=set/contains=]
6622+
|context|, return [=navigable cache behavior map=][|context|].
66236623

6624-
1. Return [=default cache bypass=].
6624+
1. Return [=default cache behavior=].
66256625

66266626
</div>
66276627

6628-
<div algorithm="remote end steps for network.setCacheBypass">
6628+
<div algorithm="remote end steps for network.setCacheBehavior">
66296629
The [=remote end steps=] given <var ignore>session</var> and |command parameters| are:
66306630

6631-
1. Let |bypass| be |command parameters|["<code>bypass</code>"].
6631+
1. Let |behavior| be |command parameters|["<code>cacheBehavior</code>"].
66326632

66336633
1. If |command parameters| does not [=map/contain=] "<code>contexts</code>":
66346634

6635-
1. Set the [=default cache bypass=] to |bypass|.
6635+
1. Set the [=default cache behavior=] to |behavior|.
66366636

6637-
1. If |bypass| is true, perform implementation-defined steps to disable any
6638-
implementation-specific resource caches for network requests. Otherwise
6639-
re-enable any implementation-specific resource caches for all contexts.
6637+
1. [=map/Clear=] [=navigable cache behavior map=].
66406638

6641-
1. Return [=success=] with data null.
6639+
1. Switch on the value of behavior:
6640+
<dl>
6641+
<dt>"<code>bypass</code>"
6642+
<dd>Perform implementation-defined steps to disable any
6643+
implementation-specific resource caches for all future
6644+
network requests.
6645+
<dt>"<code>default</code>"
6646+
<dd>Perform implementation-defined steps to enable any
6647+
implementation-specific resource caches that are usually enabled in the
6648+
current [=remote end=] configuration for all future network requests.
6649+
</dl>
6650+
6651+
1. Return [=success=] with data null.
66426652

66436653
1. Let |contexts| be an empty [=/set=].
66446654

66456655
1. For each |context id| of |command parameters|["<code>contexts</code>"]:
66466656

6647-
1. Let |context| be the result of [=trying=] to [=get a browsing context=]
6657+
1. Let |context| be the result of [=trying=] to [=get a browsing context=]
66486658
with |context id|.
66496659

6650-
1. If |context| is not a [=top-level browsing context=], return [=error=]
6651-
with [=error code=] [=invalid argument=].
6660+
1. If |context| is not a [=top-level browsing context=], return [=error=]
6661+
with [=error code=] [=invalid argument=].
66526662

6653-
1. [=list/Append=] |context| to |contexts|.
6663+
1. [=list/Append=] |context| to |contexts|.
66546664

66556665
1. For each |context| in |contexts|:
66566666

6657-
1. If |bypass| is true:
6667+
1. If [=navigable cache behavior map=] [=map/contains=] |context|, and
6668+
[=navigable cache behavior map=][|context|] is equal to |behavior| then
6669+
continue.
6670+
6671+
1. Switch on the value of behavior:
6672+
<dl>
6673+
<dt>"<code>bypass</code>"
6674+
<dd>Perform implementation-defined steps to disable any implementation-specific
6675+
resource caches for network requests originating from any browsing
6676+
context for which |context| is the [=top-level browsing context=].
6677+
<dt>"<code>default</code>"
6678+
<dd>Perform implementation-defined steps to enable any
6679+
implementation-specific resource caches that are usually enabled in the
6680+
current [=remote end=] configuration for network requests
6681+
originating from any browsing context for which |context| is the
6682+
[=top-level browsing context=].
6683+
</dl>
6684+
6685+
1. If |behavior| is equal to [=default cache behavior=]:
66586686

6659-
1. [=set/append=] |context| to [=navigable cache bypass set=].
6687+
1. If [=navigable cache behavior map=] [=map/contains=] |context|,
6688+
[=map/remove=] [=navigable cache behavior map=][|context|].
66606689

6661-
1. Perform implementation-defined steps to disable any implementation-specific
6662-
resource caches for network requests originating from |context|.
6690+
1. Otherwise:
66636691

6664-
1. Otherwise, if [=navigable cache bypass set=] [=set/contains=]
6665-
|context|, [=set/remove=] |context| from [=navigable cache bypass set=] and
6666-
re-enable any implementation-specific resource caches for network requests
6667-
originating from |context|.
6692+
1. Set [=navigable cache behavior map=][|context|] to |behavior|.
66686693

66696694
1. Return [=success=] with data null.
66706695

0 commit comments

Comments
 (0)