@@ -2777,7 +2777,6 @@ The <dfn export for=commands>browsingContext.captureScreenshot</dfn> command
2777
2777
captures an image of the given browsing context, and returns it as a
2778
2778
Base64-encoded string.
2779
2779
2780
-
2781
2780
<dl>
2782
2781
<dt> Command Type</dt>
2783
2782
<dd>
@@ -3756,7 +3755,7 @@ NetworkCookie = {
3756
3755
};
3757
3756
</pre>
3758
3757
3759
- The <code> NetworkCookie </code> type represents a cookie.
3758
+ The <code> Cookie </code> type represents a cookie.
3760
3759
3761
3760
If the cookie value can be represented as a UTF-8 encoded string, the
3762
3761
<code> value</code> field will be present. Otherwise the <code> binaryValue</code>
@@ -3786,7 +3785,7 @@ NetworkFetchTimingInfo = {
3786
3785
};
3787
3786
</pre>
3788
3787
3789
- The <code> NetworkFetchTimingInfo </code> type represents the time of each part of
3788
+ The <code> FetchTimingInfo </code> type represents the time of each part of
3790
3789
the request, relative to <code> requestTime</code> .
3791
3790
3792
3791
TODO: Add service worker fields
@@ -3803,13 +3802,41 @@ NetworkHeader = {
3803
3802
};
3804
3803
</pre>
3805
3804
3806
- The <code> NetworkHeader </code> type represents a single request header.
3805
+ The <code> Header </code> type represents a single request header.
3807
3806
3808
3807
If the header value can be represented as a UTF-8 encoded string, the
3809
3808
<code> value</code> field will be present. Otherwise the <code> binaryValue</code>
3810
3809
field will be present and consist of an array of integers representing the bytes
3811
3810
of the header.
3812
3811
3812
+ <div algorithm>
3813
+
3814
+ To <dfn>get a Header</dfn> given |name bytes| and |value bytes|:
3815
+
3816
+ 1. Let |name| be the result of [=UTF-8 decode=] with |name bytes|.
3817
+
3818
+ Assert: Since header names are constrained to be ASCII-only this cannot fail.
3819
+
3820
+ 1. Let |utf8 decoded value| be the result of [=UTF-8 decode without BOM or fail=]
3821
+ with |value byes|.
3822
+
3823
+ 1. If |utf8 decoded value| is failure, then:
3824
+
3825
+ 1. let |value| be null and |binary value| be a list.
3826
+
3827
+ 1. For each |byte| in |value bytes|:
3828
+
3829
+ 1. Append the [=value=] of |byte| to |binary value|.
3830
+
3831
+ Otherwise: let |value| be |utf8 decoded value| and let |binary value|
3832
+ be null.
3833
+
3834
+ 1. Return a map matching the <code> NetworkHeader</code> production, with the
3835
+ <code> name</code> field set to |string name|, the <code> value</code> field
3836
+ set to |value| if it's not null, or omitted otherwise, and the
3837
+ <code> binaryValue</code> field set to |binary value| if it's not null, or
3838
+ omitted otherwise.
3839
+
3813
3840
#### The network.Initiator type #### {#type-network-Initiator}
3814
3841
3815
3842
[=Remote end definition=] and [=local end definition=]
@@ -3824,7 +3851,7 @@ NetworkInitiator = {
3824
3851
};
3825
3852
</pre>
3826
3853
3827
- The <code> NetworkInitiatior </code> type represents the source of a network request.
3854
+ The <code> Initiatior </code> type represents the source of a network request.
3828
3855
3829
3856
TODO: Align more closely with Fetch here?
3830
3857
@@ -3849,15 +3876,62 @@ NetworkRequestData = {
3849
3876
method: text,
3850
3877
headers: [ *NetworkHeader ] ,
3851
3878
cookies: [ *NetworkCookie ] ,
3852
- ?body: text,
3853
3879
headersSize: uint,
3854
3880
bodySize: uint,
3855
3881
};
3856
3882
</pre>
3857
3883
3858
3884
The <code> RequestData</code> type represents an ongoing network request.
3859
3885
3860
- TODO: Body is actually bytes, not clear how to handle it as text
3886
+ <div algorithm>
3887
+
3888
+ To <dfn>get the request data</div> given |request|:
3889
+
3890
+ 1. Let |url| be the result of running the [=URL serializer=] with |request|'s
3891
+ [=URL=].
3892
+
3893
+ 1. Let |method| be |request|'s [=method=].
3894
+
3895
+ 1. let |body size| be 0.
3896
+
3897
+ 1. Let |body| be request's [=body=].
3898
+
3899
+ 1. If |body| is a [=byte sequence=], let |body size| be the length of that
3900
+ sequence. Otherwise if |body| is a [=body=] then let |body size| be that
3901
+ body's [=length=] if it's not null, or 0 otherwise.
3902
+
3903
+ TODO: Should we handle the case where the body length is not yet known?
3904
+
3905
+ 1. Let |headers size| be the size in bytes of |request|'s [=headers list=] when
3906
+ serialized as mandated by [=HTTP=].
3907
+
3908
+ Note: for protocols which allow header compression, this is the compressed
3909
+ size of the headers, as sent over the network.
3910
+
3911
+ 1. Let |headers| be an empty list.
3912
+
3913
+ 1. Let |cookies| be an empty list.
3914
+
3915
+ 1. For each (|name|, |value|) in |request|'s [=headers list=]:
3916
+
3917
+ 1. Append the result of [=get a Header=] with |name| and |value| to |headers|.
3918
+
3919
+ 1. If |name| is a [=byte-case-insensitive=] match for "<code>Cookie</code>" then:
3920
+
3921
+ 1. TODO: Add cookies
3922
+
3923
+ CDP puts all cookies in the cookie store for the destination URL into the
3924
+ request object, and then marks the ones that were not actual sent with the
3925
+ request with the reason they were blocked.
3926
+
3927
+ It's not clear if we want to do the same, or just include the cookies that
3928
+ were actually sent.
3929
+
3930
+ 1. Return a map matching the <code>NetworkRequestData</code>
3931
+ production, with the <code>url</code> field set to |url|, the
3932
+ <code>method</code> field set to |method|, the <code>headers</code> field set
3933
+ to |headers|, the <code>headersSize</code> field set to |headers size| and
3934
+ the <code>bodySize</code> field set to |body size|.
3861
3935
3862
3936
#### The network.ResponseContent type #### {#type-network-ResponseContent}
3863
3937
@@ -3922,6 +3996,10 @@ The <code>RequestData</code> type represents the response to a netowrk request.
3922
3996
</dd>
3923
3997
</dl>
3924
3998
3999
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi before
4000
+ request send</dfn> steps given |request|:
4001
+
4002
+
3925
4003
#### The network.fetchError Event #### {#event-network-fetchError}
3926
4004
3927
4005
<dl>
@@ -3990,6 +4068,12 @@ After the full response body is received.
3990
4068
3991
4069
After the response headers are received but before the body.
3992
4070
4071
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi before
4072
+ response started</dfn> steps given |request| and |response|:
4073
+
4074
+ 1. Let |request data| be the result of [=get the request data=] given |request|.
4075
+
4076
+
3993
4077
## The script Module ## {#module-script}
3994
4078
3995
4079
The <dfn export for=modules>script</dfn> module contains commands and events
0 commit comments