@@ -2737,7 +2737,6 @@ The <dfn export for=commands>browsingContext.captureScreenshot</dfn> command
2737
2737
captures an image of the given browsing context, and returns it as a
2738
2738
Base64-encoded string.
2739
2739
2740
-
2741
2740
<dl>
2742
2741
<dt> Command Type</dt>
2743
2742
<dd>
@@ -3687,7 +3686,7 @@ NetworkCookie = {
3687
3686
};
3688
3687
</pre>
3689
3688
3690
- The <code> NetworkCookie </code> type represents a cookie.
3689
+ The <code> Cookie </code> type represents a cookie.
3691
3690
3692
3691
If the cookie value can be represented as a UTF-8 encoded string, the
3693
3692
<code> value</code> field will be present. Otherwise the <code> binaryValue</code>
@@ -3717,7 +3716,7 @@ NetworkFetchTimingInfo = {
3717
3716
};
3718
3717
</pre>
3719
3718
3720
- The <code> NetworkFetchTimingInfo </code> type represents the time of each part of
3719
+ The <code> FetchTimingInfo </code> type represents the time of each part of
3721
3720
the request, relative to <code> requestTime</code> .
3722
3721
3723
3722
TODO: Add service worker fields
@@ -3734,13 +3733,41 @@ NetworkHeader = {
3734
3733
};
3735
3734
</pre>
3736
3735
3737
- The <code> NetworkHeader </code> type represents a single request header.
3736
+ The <code> Header </code> type represents a single request header.
3738
3737
3739
3738
If the header value can be represented as a UTF-8 encoded string, the
3740
3739
<code> value</code> field will be present. Otherwise the <code> binaryValue</code>
3741
3740
field will be present and consist of an array of integers representing the bytes
3742
3741
of the header.
3743
3742
3743
+ <div algorithm>
3744
+
3745
+ To <dfn>get a Header</dfn> given |name bytes| and |value bytes|:
3746
+
3747
+ 1. Let |name| be the result of [=UTF-8 decode=] with |name bytes|.
3748
+
3749
+ Assert: Since header names are constrained to be ASCII-only this cannot fail.
3750
+
3751
+ 1. Let |utf8 decoded value| be the result of [=UTF-8 decode without BOM or fail=]
3752
+ with |value byes|.
3753
+
3754
+ 1. If |utf8 decoded value| is failure, then:
3755
+
3756
+ 1. let |value| be null and |binary value| be a list.
3757
+
3758
+ 1. For each |byte| in |value bytes|:
3759
+
3760
+ 1. Append the [=value=] of |byte| to |binary value|.
3761
+
3762
+ Otherwise: let |value| be |utf8 decoded value| and let |binary value|
3763
+ be null.
3764
+
3765
+ 1. Return a map matching the <code> NetworkHeader</code> production, with the
3766
+ <code> name</code> field set to |string name|, the <code> value</code> field
3767
+ set to |value| if it's not null, or omitted otherwise, and the
3768
+ <code> binaryValue</code> field set to |binary value| if it's not null, or
3769
+ omitted otherwise.
3770
+
3744
3771
#### The network.Initiator type #### {#type-network-Initiator}
3745
3772
3746
3773
[=Remote end definition=] and [=local end definition=]
@@ -3755,7 +3782,7 @@ NetworkInitiator = {
3755
3782
};
3756
3783
</pre>
3757
3784
3758
- The <code> NetworkInitiatior </code> type represents the source of a network request.
3785
+ The <code> Initiatior </code> type represents the source of a network request.
3759
3786
3760
3787
TODO: Align more closely with Fetch here?
3761
3788
@@ -3780,15 +3807,62 @@ NetworkRequestData = {
3780
3807
method: text,
3781
3808
headers: [ *NetworkHeader ] ,
3782
3809
cookies: [ *NetworkCookie ] ,
3783
- ?body: text,
3784
3810
headersSize: uint,
3785
3811
bodySize: uint,
3786
3812
};
3787
3813
</pre>
3788
3814
3789
3815
The <code> RequestData</code> type represents an ongoing network request.
3790
3816
3791
- TODO: Body is actually bytes, not clear how to handle it as text
3817
+ <div algorithm>
3818
+
3819
+ To <dfn>get the request data</div> given |request|:
3820
+
3821
+ 1. Let |url| be the result of running the [=URL serializer=] with |request|'s
3822
+ [=URL=].
3823
+
3824
+ 1. Let |method| be |request|'s [=method=].
3825
+
3826
+ 1. let |body size| be 0.
3827
+
3828
+ 1. Let |body| be request's [=body=].
3829
+
3830
+ 1. If |body| is a [=byte sequence=], let |body size| be the length of that
3831
+ sequence. Otherwise if |body| is a [=body=] then let |body size| be that
3832
+ body's [=length=] if it's not null, or 0 otherwise.
3833
+
3834
+ TODO: Should we handle the case where the body length is not yet known?
3835
+
3836
+ 1. Let |headers size| be the size in bytes of |request|'s [=headers list=] when
3837
+ serialized as mandated by [=HTTP=].
3838
+
3839
+ Note: for protocols which allow header compression, this is the compressed
3840
+ size of the headers, as sent over the network.
3841
+
3842
+ 1. Let |headers| be an empty list.
3843
+
3844
+ 1. Let |cookies| be an empty list.
3845
+
3846
+ 1. For each (|name|, |value|) in |request|'s [=headers list=]:
3847
+
3848
+ 1. Append the result of [=get a Header=] with |name| and |value| to |headers|.
3849
+
3850
+ 1. If |name| is a [=byte-case-insensitive=] match for "<code>Cookie</code>" then:
3851
+
3852
+ 1. TODO: Add cookies
3853
+
3854
+ CDP puts all cookies in the cookie store for the destination URL into the
3855
+ request object, and then marks the ones that were not actual sent with the
3856
+ request with the reason they were blocked.
3857
+
3858
+ It's not clear if we want to do the same, or just include the cookies that
3859
+ were actually sent.
3860
+
3861
+ 1. Return a map matching the <code>NetworkRequestData</code>
3862
+ production, with the <code>url</code> field set to |url|, the
3863
+ <code>method</code> field set to |method|, the <code>headers</code> field set
3864
+ to |headers|, the <code>headersSize</code> field set to |headers size| and
3865
+ the <code>bodySize</code> field set to |body size|.
3792
3866
3793
3867
#### The network.ResponseContent type #### {#type-network-ResponseContent}
3794
3868
@@ -3853,6 +3927,10 @@ The <code>RequestData</code> type represents the response to a netowrk request.
3853
3927
</dd>
3854
3928
</dl>
3855
3929
3930
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi before
3931
+ request send</dfn> steps given |request|:
3932
+
3933
+
3856
3934
#### The network.fetchError Event #### {#event-network-fetchError}
3857
3935
3858
3936
<dl>
@@ -3921,6 +3999,12 @@ After the full response body is received.
3921
3999
3922
4000
After the response headers are received but before the body.
3923
4001
4002
+ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi before
4003
+ response started</dfn> steps given |request| and |response|:
4004
+
4005
+ 1. Let |request data| be the result of [=get the request data=] given |request|.
4006
+
4007
+
3924
4008
## The script Module ## {#module-script}
3925
4009
3926
4010
The <dfn export for=modules>script</dfn> module contains commands and events
0 commit comments