@@ -209,7 +209,7 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
209209 text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
210210spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
211211 type: dfn
212- text: default User-Agent value; url: #default-user-agent-value
212+ text: default ` User-Agent` value; url: #default-user-agent-value
213213 text: HTTP-network-or-cache fetch; url: #concept-http-network-or-cache-fetch
214214 text: request; url: #fetch-params-request
215215spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
@@ -3151,9 +3151,6 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
31513151A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
31523152weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
31533153
3154- A [=remote end=] has a <dfn>user agent overrides map</dfn> which is a weak map
3155- between [=navigables=] or [=user contexts=] and string or null.
3156-
31573154A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
31583155map between [=navigables=] or [=user contexts=] and boolean or null.
31593156
@@ -5838,12 +5835,20 @@ EmulationCommand = (
58385835 emulation.SetLocaleOverride //
58395836 emulation.SetScreenOrientationOverride //
58405837 emulation.SetScriptingEnabled //
5841- emulation.SetTimezoneOverride
5842- emulation.SetScreenOrientationOverride //
5838+ emulation.SetTimezoneOverride //
58435839 emulation.SetUserAgentOverride
58445840)
58455841</pre>
58465842
5843+ A [=BiDi session=] has an <dfn for=session>emulated user agent</dfn> which is a
5844+ [=struct=] with an [=struct/item=] named
5845+ <dfn for="emulated user agent">default user agent</dfn> , which is a string or null,
5846+ an [=struct/item=] named
5847+ <dfn for="emulated user agent">user context user agent</dfn> , which is a weak map
5848+ between [=user contexts=] and string, and an [=struct/item=] named
5849+ <dfn for="emulated user agent">navigable user agent</dfn> , which is a weak map
5850+ between [=navigables=] and string.
5851+
58475852A [=remote end=] has a <dfn>forced colors mode theme overrides map</dfn> which is a weak map
58485853between [=user contexts=] and string or null.
58495854
@@ -6319,58 +6324,40 @@ User-Agent on the given top-level traversables or user contexts.
63196324 </dd>
63206325</dl>
63216326
6322- <div algorithm="updated `User-Agent` getter steps">
6323- The [=default User-Agent value=] getter steps is implementation defined. A
6324- WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6325- steps:
6326-
6327- 1. Let |related navigables| be an empty list.
6328-
6329- 1. If [=default User-Agent value=] was accessed during execution of the
6330- [=HTTP-network-or-cache fetch=] algorithm with |fetchParams|:
6331-
6332- 1. Let |request| be |fetchParams|’s [=request=] .
6333-
6334- 1. If |request|'s [=request/client=] is not null, let |related navigables|
6335- be the result of [=get related navigables=] with |request|'s
6336- [=request/client=] .
6337-
6338- 1. If [=default User-Agent value=] was accessed from [=NavigatorID=] interface:
6339-
6340- 1. Let |realm| be [=current Realm Record=] .
6327+ <div algorithm>
6328+ The <dfn export>WebDriver BiDi emulated User-Agent</dfn> steps given
6329+ [=environment settings object=] |environment settings| are:
63416330
6342- 1. Let |environment settings | be the [=environment settings object =] whose
6343- [=realm execution context=] 's Realm component is |realm |.
6331+ 1. Let |related navigables | be the result of [=get related navigables =] with
6332+ |environment settings |.
63446333
6345- 1. Let |related navigables| be the result of [=get related navigables=] given
6346- |environment settings|.
6334+ 1. For each |navigable| or |related navigables|:
63476335
6348- 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6349- |related navigables|.
6336+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
63506337
6351- 1. If |emulated user agent| is not null, return |emulated user agent| .
6338+ 1. Let | user context| be |top-level navigable|'s [=associated user context=] .
63526339
6353- 1. Return the result of implementation-defined steps in accordance with the
6354- requirements of the [=default User-Agent value=] specification.
6340+ 1. For each |session| in [=active BiDi sessions=] :
63556341
6356- </div>
6342+ 1. If |session|'s [=emulated user agent=]' s [=navigable user agent=] contains
6343+ |top-level navigable|, return |session|'s [=emulated user agent=]' s
6344+ [=navigable user agent=] [|top-level navigable|] .
63576345
6358- <div algorithm>
6359- To <dfn>get emulated user agent</dfn> given |navigables|:
6360-
6361- 1. For each |navigable| or |navigables|:
6346+ 1. For each |session| in [=active BiDi sessions=] :
63626347
6363- 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6348+ 1. If |session|'s [=emulated user agent=]' s [=user context user agent=]
6349+ contains |user context|, return |session|'s [=emulated user agent=]' s
6350+ [=user context user agent=] [|user context|] .
63646351
6365- 1. If [=user agent overrides map=] contains |top-level navigable|, return
6366- [=user agent overrides map=] [|top-level navigable|] .
6352+ 1. For each |session| in [=active BiDi sessions=] :
63676353
6368- 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6354+ 1. Let |default emulated user agent| be |session|'s [=emulated user agent=]' s
6355+ [=default user agent=] .
63696356
6370- 1. If [= user agent overrides map=] contains |user context| , return
6371- [=user agent overrides map=] [| user context|] .
6357+ 1. If |default emulated user agent| is not null , return
6358+ |default emulated user agent| .
63726359
6373- 1. Return null.
6360+ 1. Return null.
63746361
63756362</div>
63766363
@@ -6382,45 +6369,45 @@ The [=remote end steps=] with |command parameters| are:
63826369 and |command parameters| [=map/contains=] "<code> context</code> ",
63836370 return [=error=] with [=error code=] [=invalid argument=] .
63846371
6385- 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6386- and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6387- return [=error=] with [=error code=] [=invalid argument=] .
6388-
638963721. Let |emulated user agent| be null.
63906373
639163741. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
63926375
63936376 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
63946377
6395- 1. Let |navigables| be a [=/set=] .
6396-
6397- 1. If the <code> contexts</code> field of |command parameters| is present:
6378+ 1. If |command parameters| [=map/contains=] "<code> context</code> ":
63986379
63996380 1. Let |navigables| be the result of [=trying=] to
64006381 [=get valid top-level traversables by ids=] with
64016382 |command parameters|["<code>contexts</code>"] .
64026383
6403- 1. Otherwise :
6384+ 1. For each |navigable| of |navigables| :
64046385
6405- 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6386+ 1. If |emulated user agent| is null, [=map/remove=] |navigable| from
6387+ |session|'s [=emulated user agent=]' s [=navigable user agent=] .
6388+
6389+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]' s
6390+ [=navigable user agent=] [|navigable|] to |emulated user agent|.
6391+
6392+ 1. Return [=success=] with data null.
6393+
6394+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> ":
64066395
64076396 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
64086397 with |command parameters|["<code>userContexts</code>"] .
64096398
64106399 1. For each |user context| of |user contexts|:
64116400
6412- 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6413- |emulated user agent|.
6414-
6415- 1. [=list/For each=] |top-level traversable| of the list of all
6416- [=/top-level traversables=] whose [=associated user context=] is
6417- |user context|:
6401+ 1. If |emulated user agent| is null, [=map/remove=] |user context| from
6402+ |session|'s [=emulated user agent=]' s [=user context user agent=] .
64186403
6419- 1. [=list/Append=] |top-level traversable| to |navigables|.
6404+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]' s
6405+ [=user context user agent=] [|user context|] to |emulated user agent|.
64206406
6421- 1. For each |navigable| of |navigables|:
6407+ 1. Return [=success=] with data null.
64226408
6423- 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6409+ 1. [=map/Set=] |session|'s [=emulated user agent=]' s [=default user agent=] to
6410+ |emulated user agent|.
64246411
642564121. Return [=success=] with data null.
64266413
0 commit comments