@@ -1435,10 +1435,27 @@ To <dfn>cleanup the session</dfn> given |session|:
1435
1435
1436
1436
1. [=Close the WebSocket connections=] with |session|.
1437
1437
1438
+ 1. If [=active sessions=] is [=list/empty=] , [=cleanup remote end state=] .
1439
+
1438
1440
1. Perform any implementation-specific cleanup steps.
1439
1441
1440
1442
</div>
1441
1443
1444
+ <div algorithm>
1445
+ To <dfn>cleanup remote end state</dfn> .
1446
+
1447
+ 1. [=map/Clear=] the [=before request sent map=] .
1448
+
1449
+ 1. Set the [=default cache behavior=] to "<code> default</code> ".
1450
+
1451
+ 1. [=map/Clear=] the [=navigable cache behavior map=] .
1452
+
1453
+ 1. Perform implementation-defined steps to enable any
1454
+ implementation-specific resource caches that are usually enabled in the
1455
+ current [=remote end=] configuration.
1456
+
1457
+ </div>
1458
+
1442
1459
<div algorithm>
1443
1460
To <dfn>update the event map</dfn> , given
1444
1461
|session|, |requested event names|, |browsing contexts|, and |enabled|:
@@ -2333,6 +2350,9 @@ BrowsingContextEvent = (
2333
2350
A [=remote end=] has a <dfn>device pixel ratio overrides</dfn> which is a weak map
2334
2351
between [=navigables=] and device pixel ratio overrides. It is initially empty.
2335
2352
2353
+ Note: this map is not cleared when the final session ends i.e. device pixel
2354
+ ratio overrides outlive any WebDriver session.
2355
+
2336
2356
### Types ### {#module-browsingcontext-types}
2337
2357
2338
2358
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -4230,6 +4250,10 @@ the <dfn export>WebDriver BiDi navigable created</dfn> steps given
4230
4250
4231
4251
1. Let |context| be |navigable|'s [=active browsing context=] .
4232
4252
4253
+ 1. If the [=context cache behavior=] with |context| is "<code> bypass</code> ",
4254
+ then perform implementation-defined steps to disable any implementation-specific
4255
+ resource caches for network requests originating from |context|.
4256
+
4233
4257
1. Set |context|'s [=original opener=] to |opener navigable|' s [=active browsing context=] ,
4234
4258
if |opener navigable| is provided.
4235
4259
@@ -4698,7 +4722,8 @@ NetworkCommand = (
4698
4722
network.ContinueWithAuth //
4699
4723
network.FailRequest //
4700
4724
network.ProvideResponse //
4701
- network.RemoveIntercept
4725
+ network.RemoveIntercept //
4726
+ network.SetCacheBehavior
4702
4727
)
4703
4728
4704
4729
</pre>
@@ -4725,6 +4750,13 @@ A [=remote end=] has a <dfn>before request sent map</dfn> which is initially an
4725
4750
empty map. It's used to track the network events for which a
4726
4751
<code> network.beforeRequestSent</code> event has already been sent.
4727
4752
4753
+ A [=remote end=] has a <dfn>default cache behavior</dfn> which is a string. It is
4754
+ initially "<code> default</code> ".
4755
+
4756
+ A [=remote end=] has a <dfn>navigable cache behavior map</dfn> which is a weak
4757
+ map between [=/top-level traversables=] and strings representing cache
4758
+ behavior. It is initially empty.
4759
+
4728
4760
### Network Intercepts ### {#network-intercepts}
4729
4761
4730
4762
A <dfn>network intercept</dfn> is a mechanism to allow remote ends to intercept
@@ -4981,7 +5013,6 @@ request in addition to the context.
4981
5013
<div algorithm>
4982
5014
To <dfn>process a network event</dfn> given |session|, |event|, and |request|:
4983
5015
4984
-
4985
5016
1. Let |request data| be the result of [=get the request data=] with |request|.
4986
5017
4987
5018
<!-- TODO: update this to "[=request/navigation id=] once the fetch parts land-->
@@ -6563,6 +6594,134 @@ requests will be affected.
6563
6594
6564
6595
</div>
6565
6596
6597
+ #### The network.setCacheBehavior Command #### {#command-network-setCacheBehavior}
6598
+
6599
+ The <dfn export for=commands>network.setCacheBehavior</dfn> command configures
6600
+ the network cache behavior for certain requests.
6601
+
6602
+ <dl>
6603
+ <dt> Command Type</dt>
6604
+ <dd>
6605
+ <pre class="cddl remote-cddl">
6606
+ network.SetCacheBehavior = (
6607
+ method: "network.setCacheBehavior",
6608
+ params: network.SetCacheBehaviorParameters
6609
+ )
6610
+
6611
+ network.SetCacheBehaviorParameters = {
6612
+ cacheBehavior: "default" / "bypass",
6613
+ ? contexts: [+browsingContext.BrowsingContext]
6614
+ }
6615
+ </pre>
6616
+ </dd>
6617
+ <dt> Return Type</dt>
6618
+ <dd>
6619
+ <pre class="cddl">
6620
+ EmptyResult
6621
+ </pre>
6622
+ </dd>
6623
+ </dl>
6624
+
6625
+ <div algorithm>
6626
+ The <dfn export>WebDriver BiDi cache behavior</dfn> steps given |request| are:
6627
+
6628
+ 1. Let |context| be null.
6629
+
6630
+ 1. If |request|'s [=request/window=] is an [=environment settings object=] :
6631
+
6632
+ 1. Let |environment settings| be |request|'s [=request/window=]
6633
+
6634
+ 1. If there is a [=/browsing context=] whose [=active window=] is |environment
6635
+ settings|' [=environment settings object/global object=] , set |context| to
6636
+ the [=top-level browsing context=] for that browsing context.
6637
+
6638
+ 1. If |context| is not null and [=navigable cache behavior map=] [=set/contains=]
6639
+ |context|, return [=navigable cache behavior map=] [|context|] .
6640
+
6641
+ 1. Return [=default cache behavior=] .
6642
+
6643
+ </div>
6644
+
6645
+ <div algorithm>
6646
+ The <dfn>context cache behavior</dfn> steps given |context| are:
6647
+
6648
+ 1. Set |top-level context| to the [=top-level browsing context=] for |context|.
6649
+
6650
+ 1. If [=navigable cache behavior map=] [=map/contains=] |top-level context|, return
6651
+ [=navigable cache behavior map=] [|top-level context|] .
6652
+
6653
+ 1. Return [=default cache behavior=] .
6654
+
6655
+ </div>
6656
+
6657
+ <div algorithm="remote end steps for network.setCacheBehavior">
6658
+ The [=remote end steps=] given <var ignore> session</var> and |command parameters| are:
6659
+
6660
+ 1. Let |behavior| be |command parameters|["<code>cacheBehavior</code>"] .
6661
+
6662
+ 1. If |command parameters| does not [=map/contain=] "<code> contexts</code> ":
6663
+
6664
+ 1. Set the [=default cache behavior=] to |behavior|.
6665
+
6666
+ 1. [=map/Clear=] [=navigable cache behavior map=] .
6667
+
6668
+ 1. Switch on the value of behavior:
6669
+ <dl>
6670
+ <dt> "<code> bypass</code> "
6671
+ <dd> Perform implementation-defined steps to disable any
6672
+ implementation-specific resource caches.
6673
+ <dt> "<code> default</code> "
6674
+ <dd> Perform implementation-defined steps to enable any
6675
+ implementation-specific resource caches that are usually enabled in the
6676
+ current [=remote end=] configuration.
6677
+ </dl>
6678
+
6679
+ 1. Return [=success=] with data null.
6680
+
6681
+ 1. Let |contexts| be an empty [=/set=] .
6682
+
6683
+ 1. For each |context id| of |command parameters|["<code>contexts</code>"] :
6684
+
6685
+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
6686
+ with |context id|.
6687
+
6688
+ 1. If |context| is not a [=top-level browsing context=] , return [=error=]
6689
+ with [=error code=] [=invalid argument=] .
6690
+
6691
+ 1. [=list/Append=] |context| to |contexts|.
6692
+
6693
+ 1. For each |context| in |contexts|:
6694
+
6695
+ 1. If [=navigable cache behavior map=] [=map/contains=] |context|, and
6696
+ [=navigable cache behavior map=] [|context|] is equal to |behavior| then
6697
+ continue.
6698
+
6699
+ 1. Switch on the value of behavior:
6700
+ <dl>
6701
+ <dt> "<code> bypass</code> "
6702
+ <dd> Perform implementation-defined steps to disable any implementation-specific
6703
+ resource caches for network requests originating from any browsing
6704
+ context for which |context| is the [=top-level browsing context=] .
6705
+ <dt> "<code> default</code> "
6706
+ <dd> Perform implementation-defined steps to enable any
6707
+ implementation-specific resource caches that are usually enabled in the
6708
+ current [=remote end=] configuration for network requests
6709
+ originating from any browsing context for which |context| is the
6710
+ [=top-level browsing context=] .
6711
+ </dl>
6712
+
6713
+ 1. If |behavior| is equal to [=default cache behavior=] :
6714
+
6715
+ 1. If [=navigable cache behavior map=] [=map/contains=] |context|,
6716
+ [=map/remove=] [=navigable cache behavior map=] [|context|] .
6717
+
6718
+ 1. Otherwise:
6719
+
6720
+ 1. Set [=navigable cache behavior map=] [|context|] to |behavior|.
6721
+
6722
+ 1. Return [=success=] with data null.
6723
+
6724
+ </div>
6566
6725
6567
6726
### Events ### {#module-network-event}
6568
6727
0 commit comments