From cc4ea59e5e6b73527275a4ba910336251c4964fd Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 5 Jul 2023 14:34:01 +0100 Subject: [PATCH] Rebase onto network.BytesValue --- index.bs | 65 +++++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/index.bs b/index.bs index 40e36be21..4d975a334 100644 --- a/index.bs +++ b/index.bs @@ -3502,7 +3502,7 @@ intecept id and a [=tuple=] with fields url patterns and is initially empty. A [=BiDi session=] has an blocked request map, used to track the -requests which are actively being blocked. It is an [=map=] between request id +requests which are actively being blocked. It is an [=/map=] between request id and a [=tuple=] with fields request, phase, and response. It is initially empty. It's @@ -3681,39 +3681,6 @@ To process a network event given |session|, |event|, and |request|: -#### The network.Body Type #### {#type-network-Body} - -
-network.Body = network.StringBody / network.Base64Body;
-
-network.StringBody = {
-  type: "string",
-  value: text,
-}
-
-network.Base64Body = {
-  type: "base64",
-  value: text
-}
-
- -The network.Body type represents a request or response body, -possibly encoded. - -
-To get the body given |protocol body|: - -1. If |protocol body| matches the network.StringBody production, - let |body| be |protocol body|["value"]. - -1. Otherwise if |protocol body| matches the - network.Base64Bodyproduction. Let |body| be [=forgiving-base64 - decode=] |protocol body|["value"]. - -1. Return |body| - -
- #### The network.BytesValue Type #### {#type-network-Body}
@@ -3736,7 +3703,7 @@ type, any other data is represented in Base64-encoded form as
 network.Base64Body.
 
 
-To deserialize protocol bytes given |protocol bytes|: +To deserialize protocol bytes given |protocol bytes|: Note: this takes bytes encoded as a network.BytesValue and returns a [=byte sequence=]. @@ -3789,7 +3756,7 @@ network.Cookie = { The network.Cookie type represents a cookie.
-To get a cookie given |stored cookie|: +To serialize cookie given |stored cookie|: Note: The definitions of |stored cookie|'s fields are from [[COOKIES]], except samesite-flag, which is from [[SAME-SITE-COOKIES]]. @@ -3954,21 +3921,12 @@ To serialize header given |name bytes| and |value bytes|:
-To serialize a header given |header|: - -1. Let |name| be the result of [=UTF-8 encode=] with - |header|["name"]. - -1. If |header| [=map/contains=] "value", let |value| be [=UTF-8 - encode=] |header|["value"]. +To deserialize header given |protocol header|: -1. If |header| [=map/contains=] "binaryValue": +1. Let |name| be [=UTF-8 encode=] |protocol header|["name"]. - 1. Let value be an empty [=byte sequence=]. - - 1. For each |byte| in |header|["binaryValue"]: - - 1. Append |byte| to |value| +1. Let |value| be [=deserialize protocol bytes=] with |protocol + header|["value"]. 1. Return a [=/header=] (|name|, |value|). @@ -4114,7 +4072,7 @@ To get the request data given |request|: the store can be included in a request, but user agents are free to impose additional constraints. - 1. Append the result of [=get a cookie=] given |cookie| to |cookies|. + 1. Append the result of [=serialize cookie=] given |cookie| to |cookies|. 1. Let |timings| be [=get the fetch timings=] with |request|. @@ -4403,7 +4361,7 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. If |command parameters| [=map/contains=] "body": - 1. Let |body| be [=deserialize bytes=] with |command + 1. Let |body| be [=deserialize protocol bytes=] with |command parameters|["body"]. 1. Set |request|'s [=request/body=] to |body|. @@ -4671,7 +4629,7 @@ response and bypassing any further network request processing. network.ProvideResponseParameters = { request: network.Request, - ?body: network.Body, + ?body: network.BytesValue, ?headers: [*network.Header], ?reasonPhrase: text, ?statusCode: js-uint, @@ -4696,7 +4654,8 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. If |command parameters| [=map/contains=] "body": - 1. Let |body| be [=get the body=] with |command parameters["body"]. + 1. Let |body| be [=deserialize protocol bytes=] with |command + parameters["body"]. 1. Set |response|'s [=response/body=] to |body| [=as a body=].