@@ -209,7 +209,7 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
209
209
text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
210
210
spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
211
211
type: dfn
212
- text: default User-Agent value; url: #default-user-agent-value
212
+ text: default ` User-Agent` value; url: #default-user-agent-value
213
213
text: HTTP-network-or-cache fetch; url: #concept-http-network-or-cache-fetch
214
214
text: request; url: #fetch-params-request
215
215
spec: 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
3151
3151
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3152
3152
weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
3153
3153
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
-
3157
3154
A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
3158
3155
map between [=navigables=] or [=user contexts=] and boolean or null.
3159
3156
@@ -5838,12 +5835,20 @@ EmulationCommand = (
5838
5835
emulation.SetLocaleOverride //
5839
5836
emulation.SetScreenOrientationOverride //
5840
5837
emulation.SetScriptingEnabled //
5841
- emulation.SetTimezoneOverride
5842
- emulation.SetScreenOrientationOverride //
5838
+ emulation.SetTimezoneOverride //
5843
5839
emulation.SetUserAgentOverride
5844
5840
)
5845
5841
</pre>
5846
5842
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
+
5847
5852
A [=remote end=] has a <dfn>forced colors mode theme overrides map</dfn> which is a weak map
5848
5853
between [=user contexts=] and string or null.
5849
5854
@@ -6319,58 +6324,40 @@ User-Agent on the given top-level traversables or user contexts.
6319
6324
</dd>
6320
6325
</dl>
6321
6326
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:
6341
6330
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 |.
6344
6333
6345
- 1. Let |related navigables| be the result of [=get related navigables=] given
6346
- |environment settings|.
6334
+ 1. For each |navigable| or |related navigables|:
6347
6335
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=] .
6350
6337
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=] .
6352
6339
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=] :
6355
6341
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|] .
6357
6345
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=] :
6362
6347
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|] .
6364
6351
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=] :
6367
6353
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=] .
6369
6356
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| .
6372
6359
6373
- 1. Return null.
6360
+ 1. Return null.
6374
6361
6375
6362
</div>
6376
6363
@@ -6382,45 +6369,45 @@ The [=remote end steps=] with |command parameters| are:
6382
6369
and |command parameters| [=map/contains=] "<code> context</code> ",
6383
6370
return [=error=] with [=error code=] [=invalid argument=] .
6384
6371
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
-
6389
6372
1. Let |emulated user agent| be null.
6390
6373
6391
6374
1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6392
6375
6393
6376
1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6394
6377
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> ":
6398
6379
6399
6380
1. Let |navigables| be the result of [=trying=] to
6400
6381
[=get valid top-level traversables by ids=] with
6401
6382
|command parameters|["<code>contexts</code>"] .
6402
6383
6403
- 1. Otherwise :
6384
+ 1. For each |navigable| of |navigables| :
6404
6385
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> ":
6406
6395
6407
6396
1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6408
6397
with |command parameters|["<code>userContexts</code>"] .
6409
6398
6410
6399
1. For each |user context| of |user contexts|:
6411
6400
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=] .
6418
6403
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|.
6420
6406
6421
- 1. For each |navigable| of |navigables|:
6407
+ 1. Return [=success=] with data null.
6422
6408
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|.
6424
6411
6425
6412
1. Return [=success=] with data null.
6426
6413
0 commit comments