@@ -208,7 +208,7 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
208
208
text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
209
209
spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
210
210
type: dfn
211
- text: default User-Agent value; url: #default-user-agent-value
211
+ text: default ` User-Agent` value; url: #default-user-agent-value
212
212
text: HTTP-network-or-cache fetch; url: #concept-http-network-or-cache-fetch
213
213
text: request; url: #fetch-params-request
214
214
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
@@ -3149,9 +3149,6 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
3149
3149
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3150
3150
weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
3151
3151
3152
- A [=remote end=] has a <dfn>user agent overrides map</dfn> which is a weak map
3153
- between [=navigables=] or [=user contexts=] and string or null.
3154
-
3155
3152
A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
3156
3153
map between [=navigables=] or [=user contexts=] and boolean or null.
3157
3154
@@ -5837,11 +5834,19 @@ EmulationCommand = (
5837
5834
emulation.SetScreenOrientationOverride //
5838
5835
emulation.SetScriptingEnabled //
5839
5836
emulation.SetTimezoneOverride
5840
- emulation.SetScreenOrientationOverride //
5841
5837
emulation.SetUserAgentOverride
5842
5838
)
5843
5839
</pre>
5844
5840
5841
+ A [=BiDi session=] has an <dfn for=session>emulated user agent</dfn> which is a
5842
+ [=struct=] with an [=struct/item=] named
5843
+ <dfn for="emulated user agent">default user agent</dfn> , which is a string or null,
5844
+ an [=struct/item=] named
5845
+ <dfn for="emulated user agent">user context user agent</dfn> , which is a weak map
5846
+ between [=user contexts=] and string, and an [=struct/item=] named
5847
+ <dfn for="emulated user agent">navigable user agent</dfn> , which is a weak map
5848
+ between [=navigables=] and string.
5849
+
5845
5850
A [=remote end=] has a <dfn>forced colors mode theme overrides map</dfn> which is a weak map
5846
5851
between [=user contexts=] and string or null.
5847
5852
@@ -6317,58 +6322,40 @@ User-Agent on the given top-level traversables or user contexts.
6317
6322
</dd>
6318
6323
</dl>
6319
6324
6320
- <div algorithm="updated `User-Agent` getter steps">
6321
- The [=default User-Agent value=] getter steps is implementation defined. A
6322
- WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6323
- steps:
6324
-
6325
- 1. Let |related navigables| be an empty list.
6326
-
6327
- 1. If [=default User-Agent value=] was accessed during execution of the
6328
- [=HTTP-network-or-cache fetch=] algorithm with |fetchParams|:
6329
-
6330
- 1. Let |request| be |fetchParams|’s [=request=] .
6331
-
6332
- 1. If |request|'s [=request/client=] is not null, let |related navigables|
6333
- be the result of [=get related navigables=] with |request|'s
6334
- [=request/client=] .
6335
-
6336
- 1. If [=default User-Agent value=] was accessed from [=NavigatorID=] interface:
6337
-
6338
- 1. Let |realm| be [=current Realm Record=] .
6325
+ <div algorithm>
6326
+ The <dfn export>WebDriver BiDi emulated User-Agent</dfn> steps given
6327
+ [=environment settings object=] |environment settings| are:
6339
6328
6340
- 1. Let |environment settings | be the [=environment settings object =] whose
6341
- [=realm execution context=] 's Realm component is |realm |.
6329
+ 1. Let |related navigables | be the result of [=get related navigables =] with
6330
+ |environment settings |.
6342
6331
6343
- 1. Let |related navigables| be the result of [=get related navigables=] given
6344
- |environment settings|.
6332
+ 1. For each |navigable| or |related navigables|:
6345
6333
6346
- 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6347
- |related navigables|.
6334
+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6348
6335
6349
- 1. If |emulated user agent| is not null, return |emulated user agent| .
6336
+ 1. Let | user context| be |top-level navigable|'s [=associated user context=] .
6350
6337
6351
- 1. Return the result of implementation-defined steps in accordance with the
6352
- requirements of the [=default User-Agent value=] specification.
6338
+ 1. For each |session| in [=active BiDi sessions=] :
6353
6339
6354
- </div>
6340
+ 1. If |session|'s [=emulated user agent=]' s [=navigable user agent=] contains
6341
+ |top-level navigable|, return |session|'s [=emulated user agent=]' s
6342
+ [=navigable user agent=] [|top-level navigable|] .
6355
6343
6356
- <div algorithm>
6357
- To <dfn>get emulated user agent</dfn> given |navigables|:
6358
-
6359
- 1. For each |navigable| or |navigables|:
6344
+ 1. For each |session| in [=active BiDi sessions=] :
6360
6345
6361
- 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6346
+ 1. If |session|'s [=emulated user agent=]' s [=user context user agent=]
6347
+ contains |user context|, return |session|'s [=emulated user agent=]' s
6348
+ [=user context user agent=] [|user context|] .
6362
6349
6363
- 1. If [=user agent overrides map=] contains |top-level navigable|, return
6364
- [=user agent overrides map=] [|top-level navigable|] .
6350
+ 1. For each |session| in [=active BiDi sessions=] :
6365
6351
6366
- 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6352
+ 1. Let |default emulated user agent| be |session|'s [=emulated user agent=]' s
6353
+ [=default user agent=] .
6367
6354
6368
- 1. If [= user agent overrides map=] contains |user context| , return
6369
- [=user agent overrides map=] [| user context|] .
6355
+ 1. If |default emulated user agent| is not null , return
6356
+ |default emulated user agent| .
6370
6357
6371
- 1. Return null.
6358
+ 1. Return null.
6372
6359
6373
6360
</div>
6374
6361
@@ -6380,45 +6367,45 @@ The [=remote end steps=] with |command parameters| are:
6380
6367
and |command parameters| [=map/contains=] "<code> context</code> ",
6381
6368
return [=error=] with [=error code=] [=invalid argument=] .
6382
6369
6383
- 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6384
- and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6385
- return [=error=] with [=error code=] [=invalid argument=] .
6386
-
6387
6370
1. Let |emulated user agent| be null.
6388
6371
6389
6372
1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6390
6373
6391
6374
1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6392
6375
6393
- 1. Let |navigables| be a [=/set=] .
6394
-
6395
- 1. If the <code> contexts</code> field of |command parameters| is present:
6376
+ 1. If |command parameters| [=map/contains=] "<code> context</code> ":
6396
6377
6397
6378
1. Let |navigables| be the result of [=trying=] to
6398
6379
[=get valid top-level traversables by ids=] with
6399
6380
|command parameters|["<code>contexts</code>"] .
6400
6381
6401
- 1. Otherwise :
6382
+ 1. For each |navigable| of |navigables| :
6402
6383
6403
- 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6384
+ 1. If |emulated user agent| is null, [=map/remove=] |navigable| from
6385
+ |session|'s [=emulated user agent=]' s [=navigable user agent=] .
6386
+
6387
+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]' s
6388
+ [=navigable user agent=] [|navigable|] to |emulated user agent|.
6389
+
6390
+ 1. Return [=success=] with data null.
6391
+
6392
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> ":
6404
6393
6405
6394
1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6406
6395
with |command parameters|["<code>userContexts</code>"] .
6407
6396
6408
6397
1. For each |user context| of |user contexts|:
6409
6398
6410
- 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6411
- |emulated user agent|.
6412
-
6413
- 1. [=list/For each=] |top-level traversable| of the list of all
6414
- [=/top-level traversables=] whose [=associated user context=] is
6415
- |user context|:
6399
+ 1. If |emulated user agent| is null, [=map/remove=] |navigable| from
6400
+ |session|'s [=emulated user agent=]' s [=user context user agent=] .
6416
6401
6417
- 1. [=list/Append=] |top-level traversable| to |navigables|.
6402
+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]' s
6403
+ [=user context user agent=] [|navigable|] to |emulated user agent|.
6418
6404
6419
- 1. For each |navigable| of |navigables|:
6405
+ 1. Return [=success=] with data null.
6420
6406
6421
- 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6407
+ 1. [=map/Set=] |session|'s [=emulated user agent=]' s [=default user agent=] to
6408
+ |emulated user agent|.
6422
6409
6423
6410
1. Return [=success=] with data null.
6424
6411
0 commit comments