@@ -4689,7 +4689,8 @@ NetworkCommand = (
4689
4689
network.ContinueWithAuth //
4690
4690
network.FailRequest //
4691
4691
network.ProvideResponse //
4692
- network.RemoveIntercept
4692
+ network.RemoveIntercept //
4693
+ network.SetCacheMode //
4693
4694
)
4694
4695
4695
4696
</pre>
@@ -4716,6 +4717,13 @@ A [=remote end=] has a <dfn>before request sent map</dfn> which is initially an
4716
4717
empty map. It's used to track the network events for which a
4717
4718
<code> network.beforeRequestSent</code> event has already been sent.
4718
4719
4720
+ A [=remote end=] has a <dfn>default cache mode override</dfn> which is null or a
4721
+ string. It is initially null.
4722
+
4723
+ A [=remote end=] has a <dfn>cache mode override map</dfn> which is initially an
4724
+ empty weak map. It's used to track the cache mode to use for requests from
4725
+ specific browsing contexts.
4726
+
4719
4727
### Network Intercepts ### {#network-intercepts}
4720
4728
4721
4729
A <dfn>network intercept</dfn> is a mechanism to allow remote ends to intercept
@@ -4972,7 +4980,6 @@ request in addition to the context.
4972
4980
<div algorithm>
4973
4981
To <dfn>process a network event</dfn> given |session|, |event|, and |request|:
4974
4982
4975
-
4976
4983
1. Let |request data| be the result of [=get the request data=] with |request|.
4977
4984
4978
4985
<!-- TODO: update this to "[=request/navigation id=] once the fetch parts land-->
@@ -6554,6 +6561,90 @@ requests will be affected.
6554
6561
6555
6562
</div>
6556
6563
6564
+ #### The network.setCacheMode Command #### {#command-network-setCacheMode}
6565
+
6566
+ The <dfn export for=commands>network.removeSetCacheMode</dfn> command overrides
6567
+ the network cache behaviour for certain requests.
6568
+
6569
+ <dl>
6570
+ <dt> Command Type</dt>
6571
+ <dd>
6572
+ <pre class="cddl remote-cddl">
6573
+ network.SetCacheMode = (
6574
+ method: "network.setCacheMode",
6575
+ params: network.SetCacheModeParameters
6576
+ )
6577
+
6578
+ network.SetCacheModeParameters = {
6579
+ mode: "no-store" / null,
6580
+ ? contexts: [browsingContext.BrowsingContext]
6581
+ }
6582
+ </pre>
6583
+ </dd>
6584
+ <dt> Return Type</dt>
6585
+ <dd>
6586
+ <pre class="cddl">
6587
+ EmptyResult
6588
+ </pre>
6589
+ </dd>
6590
+ </dl>
6591
+
6592
+ <div algorithm>
6593
+ The <dfn export>WebDriver BiDi update request cache mode</dfn> steps given
6594
+ |request| are:
6595
+
6596
+ 1. Let |context| be null.
6597
+
6598
+ 1. If |request|'s [=request/window=] is an [=environment settings object=] :
6599
+
6600
+ 1. Let |environment settings| be |request|'s [=request/window=]
6601
+
6602
+ 1. If there is a [=/browsing context=] whose [=active window=] is |environment
6603
+ settings|' [=environment settings object/global object=] , set |context| to
6604
+ the [=top-level browsing context=] for that context.
6605
+
6606
+ 1. If |context| is not null:
6607
+
6608
+ 1. If [=cache mode override map=] [=map/contains=] |context|, set
6609
+ |request|'s [=request/cache mode=] to [=cache mode override
6610
+ map=] [|context|] and return.
6611
+
6612
+ 1. If [=default cache mode override=] is not null, set
6613
+ |request|'s [=request/cache mode=] to [=default cache mode override=] .
6614
+
6615
+ </div>
6616
+
6617
+ <div algorithm="remote end steps for network.setCacheMode">
6618
+ The [=remote end steps=] given <var ignore> session</var> and |command parameters| are:
6619
+
6620
+ 1. Let |mode| be |command parameters|["<code>mode</code>"] .
6621
+
6622
+ 1. If |command parameters| does not [=map/contain=] "<code> contexts</code> ", set
6623
+ the [=default cache mode override=] to |mode| and return [=success=] with
6624
+ data null.
6625
+
6626
+ 1. Let |contexts| be an empty [=/list=] .
6627
+
6628
+ 1. For each |context id| of |command parameters|["<code>contexts</code>"] :
6629
+
6630
+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
6631
+ with |context id|.
6632
+
6633
+ 1. If |context| is not a [=top-level browsing context=] , return [=error=]
6634
+ with [=error code=] [=invalid argument=] .
6635
+
6636
+ 1. [=list/Append=] |context| to |contexts|.
6637
+
6638
+ 1. For each |context| in |contexts|:
6639
+
6640
+ 1. If |mode| is null and [=cache mode override map=] [=map/contains=]
6641
+ |context| [=map/remove=] |context| from [=cache mode override map=] .
6642
+
6643
+ 1. Otherwise, set [=cache mode override map=] [|context|] to |mode|.
6644
+
6645
+ 1. Return [=success=] with data null.
6646
+
6647
+ </div>
6557
6648
6558
6649
### Events ### {#module-network-event}
6559
6650
0 commit comments