@@ -207,6 +207,9 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
207
207
text: screen orientation; url: #dom-screenorientation
208
208
text: screen orientation change steps; url: #dfn-screen-orientation-change-steps
209
209
text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
210
+ spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
211
+ type: dfn
212
+ text: default User-Agent value; url: #default-user-agent-value
210
213
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
211
214
type: dfn
212
215
text: 2D context creation algorithm; url: canvas.html#2d-context-creation-algorithm
@@ -3145,6 +3148,9 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
3145
3148
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3146
3149
weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
3147
3150
3151
+ A [=remote end=] has a <dfn>user agent overrides map</dfn> which is a weak map
3152
+ between [=navigables=] or [=user contexts=] and string or null.
3153
+
3148
3154
A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
3149
3155
map between [=navigables=] or [=user contexts=] and boolean or null.
3150
3156
@@ -5830,6 +5836,8 @@ EmulationCommand = (
5830
5836
emulation.SetScreenOrientationOverride //
5831
5837
emulation.SetScriptingEnabled //
5832
5838
emulation.SetTimezoneOverride
5839
+ emulation.SetScreenOrientationOverride //
5840
+ emulation.SetUserAgentOverride
5833
5841
)
5834
5842
</pre>
5835
5843
@@ -6279,6 +6287,126 @@ The [=remote end steps=] with |command parameters| are:
6279
6287
6280
6288
</div>
6281
6289
6290
+ #### The emulation.setUserAgentOverride Command #### {#command-emulation-setUserAgentOverride}
6291
+
6292
+ The <dfn export for=commands>emulation.setUserAgentOverride</dfn> command modifies
6293
+ User-Agent on the given top-level traversables or user contexts.
6294
+
6295
+ <dl>
6296
+ <dt> Command Type</dt>
6297
+ <dd>
6298
+ <pre class="cddl" data-cddl-module="remote-cddl">
6299
+ emulation.SetUserAgentOverride = (
6300
+ method: "emulation.setUserAgentOverride",
6301
+ params: emulation.SetUserAgentOverrideParameters
6302
+ )
6303
+
6304
+ emulation.SetUserAgentOverrideParameters = {
6305
+ userAgent: text / null,
6306
+ ? contexts: [+browsingContext.BrowsingContext] ,
6307
+ ? userContexts: [+browser.UserContext] ,
6308
+ }
6309
+ </pre>
6310
+ </dd>
6311
+ <dt> Result Type</dt>
6312
+ <dd>
6313
+ <code>
6314
+ EmptyResult
6315
+ </code>
6316
+ </dd>
6317
+ </dl>
6318
+
6319
+ <div algorithm="updated `User-Agent` getter steps">
6320
+ The [=default User-Agent value=] getter steps is implementation defined. A
6321
+ WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6322
+ steps:
6323
+
6324
+ Issue: get |related navigables|.
6325
+
6326
+ 1. Let |related navigables| be the implementation-defined list of navigables related
6327
+ to the caller of these steps.
6328
+
6329
+ 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6330
+ |related navigables|.
6331
+
6332
+ 1. If |emulated user agent| is not null, return |emulated user agent|.
6333
+
6334
+ 1. Return the result of implementation-defined steps in accordance with the
6335
+ requirements of the [=default User-Agent value=] specification.
6336
+
6337
+ </div>
6338
+
6339
+ <div algorithm>
6340
+ To <dfn>get emulated user agent</dfn> given |navigables|:
6341
+
6342
+ 1. For each |navigable| or |navigables|:
6343
+
6344
+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6345
+
6346
+ 1. If [=user agent overrides map=] contains |top-level navigable|, return
6347
+ [=user agent overrides map=] [|top-level navigable|] .
6348
+
6349
+ 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6350
+
6351
+ 1. If [=user agent overrides map=] contains |user context|, return
6352
+ [=user agent overrides map=] [|user context|] .
6353
+
6354
+ 1. Return null.
6355
+
6356
+ </div>
6357
+
6358
+ <div algorithm="remote end steps for emulation.setUserAgentOverride">
6359
+
6360
+ The [=remote end steps=] with |command parameters| are:
6361
+
6362
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6363
+ and |command parameters| [=map/contains=] "<code> context</code> ",
6364
+ return [=error=] with [=error code=] [=invalid argument=] .
6365
+
6366
+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6367
+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6368
+ return [=error=] with [=error code=] [=invalid argument=] .
6369
+
6370
+ 1. Let |emulated user agent| be null.
6371
+
6372
+ 1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6373
+
6374
+ 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6375
+
6376
+ 1. Let |navigables| be a [=/set=] .
6377
+
6378
+ 1. If the <code> contexts</code> field of |command parameters| is present:
6379
+
6380
+ 1. Let |navigables| be the result of [=trying=] to
6381
+ [=get valid top-level traversables by ids=] with
6382
+ |command parameters|["<code>contexts</code>"] .
6383
+
6384
+ 1. Otherwise:
6385
+
6386
+ 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6387
+
6388
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6389
+ with |command parameters|["<code>userContexts</code>"] .
6390
+
6391
+ 1. For each |user context| of |user contexts|:
6392
+
6393
+ 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6394
+ |emulated user agent|.
6395
+
6396
+ 1. [=list/For each=] |top-level traversable| of the list of all
6397
+ [=/top-level traversables=] whose [=associated user context=] is
6398
+ |user context|:
6399
+
6400
+ 1. [=list/Append=] |top-level traversable| to |navigables|.
6401
+
6402
+ 1. For each |navigable| of |navigables|:
6403
+
6404
+ 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6405
+
6406
+ 1. Return [=success=] with data null.
6407
+
6408
+ </div>
6409
+
6282
6410
#### The emulation.setScriptingEnabled Command #### {#command-emulation-setScriptingEnabled}
6283
6411
6284
6412
The <dfn export for=commands>emulation.setScriptingEnabled</dfn> command emulates
0 commit comments