@@ -206,6 +206,9 @@ spec: SCREEN-ORIENTATION; urlPrefix: https://www.w3.org/TR/screen-orientation
206206 text: screen orientation; url: #dom-screenorientation
207207 text: screen orientation change steps; url: #dfn-screen-orientation-change-steps
208208 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
209212spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
210213 type: dfn
211214 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
31433146A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
31443147weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
31453148
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+
31463152A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
31473153map between [=navigables=] or [=user contexts=] and boolean or null.
31483154
@@ -5828,6 +5834,8 @@ EmulationCommand = (
58285834 emulation.SetScreenOrientationOverride //
58295835 emulation.SetScriptingEnabled //
58305836 emulation.SetTimezoneOverride
5837+ emulation.SetScreenOrientationOverride //
5838+ emulation.SetUserAgentOverride
58315839)
58325840</pre>
58335841
@@ -6277,6 +6285,126 @@ The [=remote end steps=] with |command parameters| are:
62776285
62786286</div>
62796287
6288+ #### The emulation.setUserAgentOverride Command #### {#command-emulation-setUserAgentOverride}
6289+
6290+ The <dfn export for=commands>emulation.setUserAgentOverride</dfn> command modifies
6291+ User-Agent on the given top-level traversables or user contexts.
6292+
6293+ <dl>
6294+ <dt> Command Type</dt>
6295+ <dd>
6296+ <pre class="cddl" data-cddl-module="remote-cddl">
6297+ emulation.SetUserAgentOverride = (
6298+ method: "emulation.setUserAgentOverride",
6299+ params: emulation.SetUserAgentOverrideParameters
6300+ )
6301+
6302+ emulation.SetUserAgentOverrideParameters = {
6303+ userAgent: text / null,
6304+ ? contexts: [+browsingContext.BrowsingContext] ,
6305+ ? userContexts: [+browser.UserContext] ,
6306+ }
6307+ </pre>
6308+ </dd>
6309+ <dt> Result Type</dt>
6310+ <dd>
6311+ <code>
6312+ EmptyResult
6313+ </code>
6314+ </dd>
6315+ </dl>
6316+
6317+ <div algorithm="updated `User-Agent` getter steps">
6318+ The [=default User-Agent value=] getter steps is implementation defined. A
6319+ WebDriver-BiDi [=remote end=] must have an implementation that runs the following
6320+ steps:
6321+
6322+ Issue: get |related navigables|.
6323+
6324+ 1. Let |related navigables| be the implementation-defined list of navigables related
6325+ to the caller of these steps.
6326+
6327+ 1. Let |emulated user agent| be the result of [=get emulated user agent=] given
6328+ |related navigables|.
6329+
6330+ 1. If |emulated user agent| is not null, return |emulated user agent|.
6331+
6332+ 1. Return the result of implementation-defined steps in accordance with the
6333+ requirements of the [=default User-Agent value=] specification.
6334+
6335+ </div>
6336+
6337+ <div algorithm>
6338+ To <dfn>get emulated user agent</dfn> given |navigables|:
6339+
6340+ 1. For each |navigable| or |navigables|:
6341+
6342+ 1. Let |top-level navigable| be |navigable|'s [=navigable/top-level traversable=] .
6343+
6344+ 1. If [=user agent overrides map=] contains |top-level navigable|, return
6345+ [=user agent overrides map=] [|top-level navigable|] .
6346+
6347+ 1. Let |user context| be |top-level navigable|'s [=associated user context=] .
6348+
6349+ 1. If [=user agent overrides map=] contains |user context|, return
6350+ [=user agent overrides map=] [|user context|] .
6351+
6352+ 1. Return null.
6353+
6354+ </div>
6355+
6356+ <div algorithm="remote end steps for emulation.setUserAgentOverride">
6357+
6358+ The [=remote end steps=] with |command parameters| are:
6359+
6360+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6361+ and |command parameters| [=map/contains=] "<code> context</code> ",
6362+ return [=error=] with [=error code=] [=invalid argument=] .
6363+
6364+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6365+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6366+ return [=error=] with [=error code=] [=invalid argument=] .
6367+
6368+ 1. Let |emulated user agent| be null.
6369+
6370+ 1. If |command parameters| [=map/contains=] "<code> userAgent</code> ":
6371+
6372+ 1. Set |emulated user agent| to |command parameters|["<code>userAgent</code>"] .
6373+
6374+ 1. Let |navigables| be a [=/set=] .
6375+
6376+ 1. If the <code> contexts</code> field of |command parameters| is present:
6377+
6378+ 1. Let |navigables| be the result of [=trying=] to
6379+ [=get valid top-level traversables by ids=] with
6380+ |command parameters|["<code>contexts</code>"] .
6381+
6382+ 1. Otherwise:
6383+
6384+ 1. Assert the <code> userContexts</code> field of |command parameters| is present.
6385+
6386+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6387+ with |command parameters|["<code>userContexts</code>"] .
6388+
6389+ 1. For each |user context| of |user contexts|:
6390+
6391+ 1. [=map/Set=] [=user agent overrides map=] [|user context|] to
6392+ |emulated user agent|.
6393+
6394+ 1. [=list/For each=] |top-level traversable| of the list of all
6395+ [=/top-level traversables=] whose [=associated user context=] is
6396+ |user context|:
6397+
6398+ 1. [=list/Append=] |top-level traversable| to |navigables|.
6399+
6400+ 1. For each |navigable| of |navigables|:
6401+
6402+ 1. [=map/Set=] [=user agent overrides map=] [|navigable|] to |emulated user agent|.
6403+
6404+ 1. Return [=success=] with data null.
6405+
6406+ </div>
6407+
62806408#### The emulation.setScriptingEnabled Command #### {#command-emulation-setScriptingEnabled}
62816409
62826410The <dfn export for=commands>emulation.setScriptingEnabled</dfn> command emulates
0 commit comments