diff --git a/index.bs b/index.bs
index 01fcbda28..cce64259d 100644
--- a/index.bs
+++ b/index.bs
@@ -6204,7 +6204,8 @@ NetworkCommand = (
network.ProvideResponse //
network.RemoveDataCollector //
network.RemoveIntercept //
- network.SetCacheBehavior
+ network.SetCacheBehavior //
+ network.SetExtraHeaders
)
@@ -6238,6 +6239,15 @@ A [=remote end=] has a navigable cache behavior map which is a weak
map between [=/top-level traversables=] and strings representing cache
behavior. It is initially empty.
+A [=BiDi session=] has a extra headers which is a
+[=struct=] with an [=struct/item=] named default
+headers, which is a [=/header list=] (initially set to an empty
+[=/header list=]), an [=struct/item=] named
+user context headers, which is a weak map
+between [=user contexts=] and [=/header lists=], and a [=struct/item=] named
+navigable headers, which is a weak map
+between [=navigables=] and [=/header lists=].
+
### Network Data Collection ### {#network-data-collection}
A data is a [=/struct=] consisting of
@@ -6587,21 +6597,8 @@ To update the response given |session|, |command| and |command parame
1. If |command parameters| [=map/contains=] "headers
":
- 1. Let |headers| be an empty [=/header list=].
-
- 1. For |header| in |command parameters|["headers
"]:
-
- 1. Let |deserialized header| be [=deserialize header=] with |header|.
-
- 1. If |deserialized header|'s name does not match the [=field-name token=]
- production, return [=error=] with [=error code=]
- "invalid argument
".
-
- 1. If |deserialized header|'s value does not match the [=header value=]
- production, return [=error=] with [=error code=]
- "invalid argument
".
-
- 1. Append |deserialized header| to |headers|.
+ 1. Let |headers| be the result of [=trying=] to [=create a headers list=] with
+ |command parameters|["headers
"].
1. Set |response|'s [=response/header list=] to |headers|.
@@ -7098,6 +7095,28 @@ To deserialize header given |protocol header|:
+
invalid argument
".
+
+ 1. If |deserialized header|'s value does not match the [=header value=]
+ production, return [=error=] with [=error code=]
+ "invalid argument
".
+
+ 1. Append |deserialized header| to |headers|.
+
+1. Return [=success=] with data |headers|
+
++ network.SetExtraHeaders = ( + method: "network.setExtraHeaders", + params: network.SetExtraHeadersParameters + ) + + network.SetExtraHeadersParameters = { + headers: [+network.Header] + ? contexts: [+browsingContext.BrowsingContext] + ? userContexts: [+browser.UserContext] + } ++
+ EmptyResult
+
+ userContexts
"
+ and |command parameters| [=map/contains=] "contexts
",
+ return [=error=] with [=error code=] [=invalid argument=].
+
+1. Let |headers| be the result of [=trying=] to [=create a headers list=] with
+ |command parameters|["headers
"].
+
+1. If |command parameters| [=map/contains=] "userContexts
":
+
+ 1. Let |user contexts| be an empty [=/list=].
+
+ 1. For |user context id| in |command parameters|["userContexts
"]:
+
+ 1. Let |user context| be [=get user context=] with |user context id|.
+
+ 1. If |user context| is null, return [=error=] with [=error code=] [=invalid argument=].
+
+ 1. [=list/Append=] |user context| to |user contexts|.
+
+ 1. Let |target| be |session|'s [=session/extra headers=]'
+ [=extra headers/user context headers=]
+
+ 1. For |user context| in |user contexts|:
+
+ 1. Set |target|[|user context|] to |headers|.
+
+ 1. Return [=success=] with data null.
+
+1. If |command parameters| [=map/contains=] "contexts
":
+
+ 1. Let |navigables| be the result of [=trying=] to
+ [=get valid top-level traversables by ids=]
+ with |command parameters|["contexts
"].
+
+ 1. Let |target| be |session|'s [=session/extra headers=]'
+ [=extra headers/navigable headers=]
+
+ 1. For |navigable| in |navigables|:
+
+ 1. Set |target|[|navigable|] to |headers|.
+
+ 1. Return [=success=] with data null.
+
+1. Set |session|'s [=session/extra headers=]'
+ [=extra headers/default headers=] to |headers|.
+
+1. Return [=success=] with data null.
+
+incomplete
".
+1. For each |session| in [=active BiDi sessions=]:
+
+ 1. [=Update request headers=] with |session|, |request| and
+ |related navigables|.
+
1. For each |session| in the [=set of sessions for which an event is enabled=]
given "network.beforeRequestSent
" and |related navigables|:
1. Let |params| be the result of [=process a network event=] with |session|,
"network.beforeRequestSent
", and |request|.
- 1. If |params| is null then continue.
-
1. Let |initiator| be the result of [=get the initiator=] with |request|.
1. If |initiator| is not [=map/is empty|empty=], set the initiator
field