diff --git a/index.bs b/index.bs index 4157ba0b..6ed580c9 100644 --- a/index.bs +++ b/index.bs @@ -93,6 +93,8 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ text: no such alert; url: dfn-no-such-alert text: no such element; url: dfn-no-such-element text: no such frame; url: dfn-no-such-frame + text: no such response; url: dfn-no-such-response + text: no response body; url: dfn-no-response-body text: parse a page range; url: dfn-parse-a-page-range text: handler; for: prompt handler configuration; url: dfn-handler text: process capabilities; url: dfn-capabilities-processing @@ -659,6 +661,7 @@ ErrorCode = "invalid argument" / "invalid session id" / "invalid web extension" / "move target out of bounds" / + "no response body" / "no such alert" / "no such element" / "no such frame" / @@ -667,6 +670,7 @@ ErrorCode = "invalid argument" / "no such intercept" / "no such node" / "no such request" / + "no such response" / "no such script" / "no such storage partition" / "no such user context" / @@ -5283,6 +5287,7 @@ NetworkCommand = ( network.ContinueResponse // network.ContinueWithAuth // network.FailRequest // + network.GetResponseBody // network.ProvideResponse // network.RemoveIntercept // network.SetCacheBehavior @@ -5312,6 +5317,9 @@ A [=remote end=] has a before request sent map which is initially an empty map. It's used to track the network events for which a network.beforeRequestSent event has already been sent. +A [=remote end=] has a response map that maps a [=request id=] +to [=/response=]. Implementations may remove data from [=response map=] map at any time. + A [=remote end=] has a default cache behavior which is a string. It is initially "default". @@ -7056,6 +7064,59 @@ The [=remote end steps=] given |session| and |command parameters| are: +#### The network.getResponseBody Command #### {#command-network-getResponseBody} + +The network.getResponseBody command retrieved the +response body data if it is available. + +
+
Command Type
+
+
+      network.GetResponseBody = (
+        method: "network.getResponseBody",
+        params: network.GetResponseBodyParameters
+      )
+
+      network.GetResponseBodyParameters = {
+        request: network.Request,
+      }
+      
+
+
Return Type
+
+
+      script.GetResponseBodyResult = {
+        body: network.BytesValue,
+      }
+    
+
+
+ +
+The [=remote end steps=] given session and |command parameters| are: + +1. Let |request id| be |command parameters|["request"]. + +1. If [=response map=] does not [=map/contain=] |request id|: + + 1. Return [=error=] with [=error code=] [=no such response=]. + +1. Let |response| be [=response map=][|request id|]. + +1. If |response|'s [=response/body=] is null, + + 1. Return [=error=] with [=error code=] [=no response body=]. + +1. Let |body| be a [=/map=] matching the script.GetResponseBodyResult production, + with the body field set to base-64 encoded value of |response|'s [=response/body=]. + TODO: specify exact steps how to read the body. + +1. Return [=success=] with data |body|. + +
+ + #### The network.provideResponse Command #### {#command-network-provideResponse} The network.provideResponse command continues a @@ -7553,6 +7614,9 @@ completed steps given |request| and |response|: [=request/client=]. Otherwise let |related navigables| be an empty set. +1. If the implementation is configured to save response data for |request|, + set [=response map=][|request|'s [=request id=]] to |response|. + 1. For each |session| in the [=set of sessions for which an event is enabled=] given "network.responseCompleted" and |related navigables|: