@@ -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,125 @@ 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
+ To <dfn>get emulated user agent</dfn> given |navigables|:
6206
+
6207
+ 1. For each |navigable| or |navigables|:
6208
+
6209
+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6210
+
6211
+ 1. If [=user agent overrides map=] contains |top-level navigable|, return
6212
+ [=user agent overrides map=] [|top-level navigable|] .
6213
+
6214
+ 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6215
+
6216
+ 1. If [=user agent overrides map=] contains |user context|, return
6217
+ [=user agent overrides map=] [|user context|] .
6218
+
6219
+ 1. Return null.
6220
+
6221
+ </div>
6222
+
6223
+ <div algorithm="remote end steps for emulation.setUserAgentOverride">
6224
+
6225
+ The [=remote end steps=] with |command parameters| are:
6226
+
6227
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6228
+ and |command parameters| [=map/contains=] "<code> context</code> ",
6229
+ return [=error=] with [=error code=] [=invalid argument=] .
6230
+
6231
+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6232
+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6233
+ return [=error=] with [=error code=] [=invalid argument=] .
6234
+
6235
+ 1. Let |emulated user agent| be null.
6236
+
6237
+ 1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6238
+
6239
+ 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6240
+
6241
+ 1. Let |navigables| be a [=/set=] .
6242
+
6243
+ 1. If the <code> contexts</code> field of |command parameters| is present:
6244
+
6245
+ 1. Let |navigables| be the result of [=trying=] to
6246
+ [=get valid top-level traversables by ids=] with
6247
+ |command parameters|["<code>contexts</code>"] .
6248
+
6249
+ 1. Otherwise:
6250
+
6251
+ 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6252
+
6253
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6254
+ with |command parameters|["<code>userContexts</code>"] .
6255
+
6256
+ 1. For each |user context| of |user contexts|:
6257
+
6258
+ 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6259
+ |emulated user agent|.
6260
+
6261
+ 1. [=list/For each=] |top-level traversable| of the list of all
6262
+ [=/top-level traversables=] whose [=associated user context=] is
6263
+ |user context|:
6264
+
6265
+ 1. [=list/Append=] |top-level traversable| to |navigables|.
6266
+
6267
+ 1. For each |navigable| of |navigables|:
6268
+
6269
+ 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6270
+
6271
+ 1. Return [=success=] with data null.
6272
+
6273
+ </div>
6274
+
6149
6275
## The network Module ## {#module-network}
6150
6276
6151
6277
The <dfn export for=modules>network</dfn> module contains commands and events
0 commit comments