@@ -203,6 +203,9 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
203
203
text: screen orientation; url: #dom-screenorientation
204
204
text: screen orientation change steps; url: #dfn-screen-orientation-change-steps
205
205
text: screen orientation values lists; url: #dfn-screen-orientation-values-lists
206
+ spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
207
+ type: dfn
208
+ text: default User-Agent value; url: #default-user-agent-value
206
209
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
207
210
type: dfn
208
211
text: 2D context creation algorithm; url: canvas.html#2d-context-creation-algorithm
@@ -3120,6 +3123,9 @@ A [=remote end=] has a <dfn>viewport overrides map</dfn> which is a weak map bet
3120
3123
A [=remote end=] has a <dfn>locale overrides map</dfn> which is a weak map between
3121
3124
[=navigables=] or [=user contexts=] and string or null.
3122
3125
3126
+ A [=remote end=] has a <dfn>user agent overrides map</dfn> which is a weak map
3127
+ between [=navigables=] or [=user contexts=] and string or null.
3128
+
3123
3129
### Types ### {#module-browsingcontext-types}
3124
3130
3125
3131
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -5773,7 +5779,8 @@ relating to emulation of browser APIs.
5773
5779
EmulationCommand = (
5774
5780
emulation.SetGeolocationOverride //
5775
5781
emulation.SetLocaleOverride //
5776
- emulation.SetScreenOrientationOverride
5782
+ emulation.SetScreenOrientationOverride //
5783
+ emulation.SetUserAgentOverride
5777
5784
)
5778
5785
</pre>
5779
5786
@@ -6146,6 +6153,126 @@ The [=remote end steps=] with |command parameters| are:
6146
6153
6147
6154
</div>
6148
6155
6156
+ #### The emulation.setUserAgentOverride Command #### {#command-emulation-setUserAgentOverride}
6157
+
6158
+ The <dfn export for=commands>emulation.setUserAgentOverride</dfn> command modifies
6159
+ User-Agent on the given top-level traversables or user contexts.
6160
+
6161
+ <dl>
6162
+ <dt> Command Type</dt>
6163
+ <dd>
6164
+ <pre class="cddl" data-cddl-module="remote-cddl">
6165
+ emulation.SetUserAgentOverride = (
6166
+ method: "emulation.setUserAgentOverride",
6167
+ params: emulation.SetUserAgentOverrideParameters
6168
+ )
6169
+
6170
+ emulation.SetUserAgentOverrideParameters = {
6171
+ userAgent: text / null,
6172
+ ? contexts: [+browsingContext.BrowsingContext] ,
6173
+ ? userContexts: [+browser.UserContext] ,
6174
+ }
6175
+ </pre>
6176
+ </dd>
6177
+ <dt> Result Type</dt>
6178
+ <dd>
6179
+ <code>
6180
+ EmptyResult
6181
+ </code>
6182
+ </dd>
6183
+ </dl>
6184
+
6185
+ <div algorithm="updated `User-Agent` getter steps">
6186
+ The [=default User-Agent value=] getter steps is implementation defined. A
6187
+ WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6188
+ steps:
6189
+
6190
+ Issue: get |related navigables|.
6191
+
6192
+ 1. Let |related navigables| be the implementation-defined list of navigables related
6193
+ to the caller of these steps.
6194
+
6195
+ 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6196
+ |related navigables|.
6197
+
6198
+ 1. If |emulated user agent| is not null, return |emulated user agent|.
6199
+
6200
+ 1. Return the result of implementation-defined steps in accordance with the
6201
+ requirements of the [=default User-Agent value=] specification.
6202
+
6203
+ </div>
6204
+
6205
+ <div algorithm>
6206
+ To <dfn>get emulated user agent</dfn> given |navigables|:
6207
+
6208
+ 1. For each |navigable| or |navigables|:
6209
+
6210
+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6211
+
6212
+ 1. If [=user agent overrides map=] contains |top-level navigable|, return
6213
+ [=user agent overrides map=] [|top-level navigable|] .
6214
+
6215
+ 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6216
+
6217
+ 1. If [=user agent overrides map=] contains |user context|, return
6218
+ [=user agent overrides map=] [|user context|] .
6219
+
6220
+ 1. Return null.
6221
+
6222
+ </div>
6223
+
6224
+ <div algorithm="remote end steps for emulation.setUserAgentOverride">
6225
+
6226
+ The [=remote end steps=] with |command parameters| are:
6227
+
6228
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6229
+ and |command parameters| [=map/contains=] "<code> context</code> ",
6230
+ return [=error=] with [=error code=] [=invalid argument=] .
6231
+
6232
+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6233
+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6234
+ return [=error=] with [=error code=] [=invalid argument=] .
6235
+
6236
+ 1. Let |emulated user agent| be null.
6237
+
6238
+ 1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6239
+
6240
+ 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6241
+
6242
+ 1. Let |navigables| be a [=/set=] .
6243
+
6244
+ 1. If the <code> contexts</code> field of |command parameters| is present:
6245
+
6246
+ 1. Let |navigables| be the result of [=trying=] to
6247
+ [=get valid top-level traversables by ids=] with
6248
+ |command parameters|["<code>contexts</code>"] .
6249
+
6250
+ 1. Otherwise:
6251
+
6252
+ 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6253
+
6254
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6255
+ with |command parameters|["<code>userContexts</code>"] .
6256
+
6257
+ 1. For each |user context| of |user contexts|:
6258
+
6259
+ 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6260
+ |emulated user agent|.
6261
+
6262
+ 1. [=list/For each=] |top-level traversable| of the list of all
6263
+ [=/top-level traversables=] whose [=associated user context=] is
6264
+ |user context|:
6265
+
6266
+ 1. [=list/Append=] |top-level traversable| to |navigables|.
6267
+
6268
+ 1. For each |navigable| of |navigables|:
6269
+
6270
+ 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6271
+
6272
+ 1. Return [=success=] with data null.
6273
+
6274
+ </div>
6275
+
6149
6276
## The network Module ## {#module-network}
6150
6277
6151
6278
The <dfn export for=modules>network</dfn> module contains commands and events
0 commit comments