@@ -4597,7 +4597,8 @@ NetworkCommand = (
4597
4597
network.ContinueWithAuth //
4598
4598
network.FailRequest //
4599
4599
network.ProvideResponse //
4600
- network.RemoveIntercept
4600
+ network.RemoveIntercept //
4601
+ network.SetCacheMode //
4601
4602
)
4602
4603
4603
4604
</pre>
@@ -4624,6 +4625,13 @@ A [=remote end=] has a <dfn>before request sent map</dfn> which is initially an
4624
4625
empty map. It's used to track the network events for which a
4625
4626
<code> network.beforeRequestSent</code> event has already been sent.
4626
4627
4628
+ A [=remote end=] has a <dfn>default cache mode override</dfn> which is null or a
4629
+ string. It is initially null.
4630
+
4631
+ A [=remote end=] has a <dfn>cache mode override map</dfn> which is initially an
4632
+ empty weak map. It's used to track the cache mode to use for requests from
4633
+ specific browsing contexts.
4634
+
4627
4635
### Network Intercepts ### {#network-intercepts}
4628
4636
4629
4637
A <dfn>network intercept</dfn> is a mechanism to allow remote ends to intercept
@@ -4870,7 +4878,6 @@ request in addition to the context.
4870
4878
<div algorithm>
4871
4879
To <dfn>process a network event</dfn> given |session|, |event|, and |request|:
4872
4880
4873
-
4874
4881
1. Let |request data| be the result of [=get the request data=] with |request|.
4875
4882
4876
4883
<!-- TODO: update this to "[=request/navigation id=] once the fetch parts land-->
@@ -6438,6 +6445,90 @@ requests will be affected.
6438
6445
6439
6446
</div>
6440
6447
6448
+ #### The network.setCacheMode Command #### {#command-network-setCacheMode}
6449
+
6450
+ The <dfn export for=commands>network.removeSetCacheMode</dfn> command overrides
6451
+ the network cache behaviour for certain requests.
6452
+
6453
+ <dl>
6454
+ <dt> Command Type</dt>
6455
+ <dd>
6456
+ <pre class="cddl remote-cddl">
6457
+ network.SetCacheMode = (
6458
+ method: "network.setCacheMode",
6459
+ params: network.SetCacheModeParameters
6460
+ )
6461
+
6462
+ network.SetCacheModeParameters = {
6463
+ mode: "no-store" / null,
6464
+ ? contexts: [browsingContext.BrowsingContext]
6465
+ }
6466
+ </pre>
6467
+ </dd>
6468
+ <dt> Return Type</dt>
6469
+ <dd>
6470
+ <pre class="cddl">
6471
+ EmptyResult
6472
+ </pre>
6473
+ </dd>
6474
+ </dl>
6475
+
6476
+ <div algorithm>
6477
+ The <dfn export>WebDriver BiDi update request cache mode</dfn> steps given
6478
+ |request| are:
6479
+
6480
+ 1. Let |context| be null.
6481
+
6482
+ 1. If |request|'s [=request/window=] is an [=environment settings object=] :
6483
+
6484
+ 1. Let |environment settings| be |request|'s [=request/window=]
6485
+
6486
+ 1. If there is a [=/browsing context=] whose [=active window=] is |environment
6487
+ settings|' [=environment settings object/global object=] , set |context| to
6488
+ the [=top-level browsing context=] for that context.
6489
+
6490
+ 1. If |context| is not null:
6491
+
6492
+ 1. If [=cache mode override map=] [=map/contains=] |context|, set
6493
+ |request|'s [=request/cache mode=] to [=cache mode override
6494
+ map=] [|context|] and return.
6495
+
6496
+ 1. If [=default cache mode override=] is not null, set
6497
+ |request|'s [=request/cache mode=] to [=default cache mode override=] .
6498
+
6499
+ </div>
6500
+
6501
+ <div algorithm="remote end steps for network.setCacheMode">
6502
+ The [=remote end steps=] given <var ignore> session</var> and |command parameters| are:
6503
+
6504
+ 1. Let |mode| be |command parameters|["<code>mode</code>"] .
6505
+
6506
+ 1. If |command parameters| does not [=map/contain=] "<code> contexts</code> ", set
6507
+ the [=default cache mode override=] to |mode| and return [=success=] with
6508
+ data null.
6509
+
6510
+ 1. Let |contexts| be an empty [=/list=] .
6511
+
6512
+ 1. For each |context id| of |command parameters|["<code>contexts</code>"] :
6513
+
6514
+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
6515
+ with |context id|.
6516
+
6517
+ 1. If |context| is not a [=top-level browsing context=] , return [=error=]
6518
+ with [=error code=] [=invalid argument=] .
6519
+
6520
+ 1. [=list/Append=] |context| to |contexts|.
6521
+
6522
+ 1. For each |context| in |contexts|:
6523
+
6524
+ 1. If |mode| is null and [=cache mode override map=] [=map/contains=]
6525
+ |context| [=map/remove=] |context| from [=cache mode override map=] .
6526
+
6527
+ 1. Otherwise, set [=cache mode override map=] [|context|] to |mode|.
6528
+
6529
+ 1. Return [=success=] with data null.
6530
+
6531
+ </div>
6441
6532
6442
6533
### Events ### {#module-network-event}
6443
6534
0 commit comments