@@ -206,6 +206,9 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
206
206
text: screen orientation; url: #dom-screenorientation
207
207
text: screen orientation change steps; url: #dfn-screen-orientation-change-steps
208
208
text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
209
+ spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
210
+ type: dfn
211
+ text: default User-Agent value; url: #default-user-agent-value
209
212
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
210
213
type: dfn
211
214
text: 2D context creation algorithm; url: canvas.html#2d-context-creation-algorithm
@@ -3143,6 +3146,9 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
3143
3146
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3144
3147
weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
3145
3148
3149
+ A [=remote end=] has a <dfn>user agent overrides map</dfn> which is a weak map
3150
+ between [=navigables=] or [=user contexts=] and string or null.
3151
+
3146
3152
### Types ### {#module-browsingcontext-types}
3147
3153
3148
3154
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -5817,6 +5823,8 @@ EmulationCommand = (
5817
5823
emulation.SetLocaleOverride //
5818
5824
emulation.SetScreenOrientationOverride //
5819
5825
emulation.SetTimezoneOverride
5826
+ emulation.SetScreenOrientationOverride //
5827
+ emulation.SetUserAgentOverride
5820
5828
)
5821
5829
</pre>
5822
5830
@@ -6188,6 +6196,126 @@ The [=remote end steps=] with |command parameters| are:
6188
6196
6189
6197
</div>
6190
6198
6199
+ #### The emulation.setUserAgentOverride Command #### {#command-emulation-setUserAgentOverride}
6200
+
6201
+ The <dfn export for=commands>emulation.setUserAgentOverride</dfn> command modifies
6202
+ User-Agent on the given top-level traversables or user contexts.
6203
+
6204
+ <dl>
6205
+ <dt> Command Type</dt>
6206
+ <dd>
6207
+ <pre class="cddl" data-cddl-module="remote-cddl">
6208
+ emulation.SetUserAgentOverride = (
6209
+ method: "emulation.setUserAgentOverride",
6210
+ params: emulation.SetUserAgentOverrideParameters
6211
+ )
6212
+
6213
+ emulation.SetUserAgentOverrideParameters = {
6214
+ userAgent: text / null,
6215
+ ? contexts: [+browsingContext.BrowsingContext] ,
6216
+ ? userContexts: [+browser.UserContext] ,
6217
+ }
6218
+ </pre>
6219
+ </dd>
6220
+ <dt> Result Type</dt>
6221
+ <dd>
6222
+ <code>
6223
+ EmptyResult
6224
+ </code>
6225
+ </dd>
6226
+ </dl>
6227
+
6228
+ <div algorithm="updated `User-Agent` getter steps">
6229
+ The [=default User-Agent value=] getter steps is implementation defined. A
6230
+ WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6231
+ steps:
6232
+
6233
+ Issue: get |related navigables|.
6234
+
6235
+ 1. Let |related navigables| be the implementation-defined list of navigables related
6236
+ to the caller of these steps.
6237
+
6238
+ 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6239
+ |related navigables|.
6240
+
6241
+ 1. If |emulated user agent| is not null, return |emulated user agent|.
6242
+
6243
+ 1. Return the result of implementation-defined steps in accordance with the
6244
+ requirements of the [=default User-Agent value=] specification.
6245
+
6246
+ </div>
6247
+
6248
+ <div algorithm>
6249
+ To <dfn>get emulated user agent</dfn> given |navigables|:
6250
+
6251
+ 1. For each |navigable| or |navigables|:
6252
+
6253
+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6254
+
6255
+ 1. If [=user agent overrides map=] contains |top-level navigable|, return
6256
+ [=user agent overrides map=] [|top-level navigable|] .
6257
+
6258
+ 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6259
+
6260
+ 1. If [=user agent overrides map=] contains |user context|, return
6261
+ [=user agent overrides map=] [|user context|] .
6262
+
6263
+ 1. Return null.
6264
+
6265
+ </div>
6266
+
6267
+ <div algorithm="remote end steps for emulation.setUserAgentOverride">
6268
+
6269
+ The [=remote end steps=] with |command parameters| are:
6270
+
6271
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6272
+ and |command parameters| [=map/contains=] "<code> context</code> ",
6273
+ return [=error=] with [=error code=] [=invalid argument=] .
6274
+
6275
+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6276
+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6277
+ return [=error=] with [=error code=] [=invalid argument=] .
6278
+
6279
+ 1. Let |emulated user agent| be null.
6280
+
6281
+ 1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6282
+
6283
+ 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6284
+
6285
+ 1. Let |navigables| be a [=/set=] .
6286
+
6287
+ 1. If the <code> contexts</code> field of |command parameters| is present:
6288
+
6289
+ 1. Let |navigables| be the result of [=trying=] to
6290
+ [=get valid top-level traversables by ids=] with
6291
+ |command parameters|["<code>contexts</code>"] .
6292
+
6293
+ 1. Otherwise:
6294
+
6295
+ 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6296
+
6297
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6298
+ with |command parameters|["<code>userContexts</code>"] .
6299
+
6300
+ 1. For each |user context| of |user contexts|:
6301
+
6302
+ 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6303
+ |emulated user agent|.
6304
+
6305
+ 1. [=list/For each=] |top-level traversable| of the list of all
6306
+ [=/top-level traversables=] whose [=associated user context=] is
6307
+ |user context|:
6308
+
6309
+ 1. [=list/Append=] |top-level traversable| to |navigables|.
6310
+
6311
+ 1. For each |navigable| of |navigables|:
6312
+
6313
+ 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6314
+
6315
+ 1. Return [=success=] with data null.
6316
+
6317
+ </div>
6318
+
6191
6319
#### The emulation.setTimezoneOverride Command #### {#command-emulation-setTimezoneOverride}
6192
6320
6193
6321
The <dfn export for=commands>emulation.setTimezoneOverride</dfn> command modifies
0 commit comments