diff --git a/index.bs b/index.bs index 91f93bab..5ec70dd7 100644 --- a/index.bs +++ b/index.bs @@ -5829,10 +5829,20 @@ EmulationCommand = ( emulation.SetLocaleOverride // emulation.SetScreenOrientationOverride // emulation.SetScriptingEnabled // - emulation.SetTimezoneOverride + emulation.SetTimezoneOverride // + emulation.SetUserAgentOverride ) +A [=BiDi session=] has an emulated user agent which is a +[=struct=] with an [=struct/item=] named +default user agent, which is a string or null, +an [=struct/item=] named +user context user agent, which is a weak map +between [=user contexts=] and string, and an [=struct/item=] named +navigable user agent, which is a weak map +between [=navigables=] and string. + A [=remote end=] has a forced colors mode theme overrides map which is a weak map between [=user contexts=] and string or null. @@ -6279,6 +6289,120 @@ The [=remote end steps=] with |command parameters| are: +#### The emulation.setUserAgentOverride Command #### {#command-emulation-setUserAgentOverride} + +The emulation.setUserAgentOverride command modifies +User-Agent on the given top-level traversables or user contexts. + +
+ emulation.SetUserAgentOverride = ( + method: "emulation.setUserAgentOverride", + params: emulation.SetUserAgentOverrideParameters + ) + + emulation.SetUserAgentOverrideParameters = { + userAgent: text / null, + ? contexts: [+browsingContext.BrowsingContext], + ? userContexts: [+browser.UserContext], + } ++
+ EmptyResult
+
+ userContexts
"
+ and |command parameters| [=map/contains=] "contexts
",
+ return [=error=] with [=error code=] [=invalid argument=].
+
+1. Let |emulated user agent| be |command parameters|["userAgent
"].
+
+1. If |command parameters| [=map/contains=] "contexts
":
+
+ 1. Let |navigables| be the result of [=trying=] to
+ [=get valid top-level traversables by ids=] with
+ |command parameters|["contexts
"].
+
+ 1. For each |navigable| of |navigables|:
+
+ 1. If |emulated user agent| is null, [=map/remove=] |navigable| from
+ |session|'s [=emulated user agent=]'s [=navigable user agent=].
+
+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]'s
+ [=navigable user agent=][|navigable|] to |emulated user agent|.
+
+ 1. Return [=success=] with data null.
+
+1. If |command parameters| [=map/contains=] "userContexts
":
+
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
+ with |command parameters|["userContexts
"].
+
+ 1. For each |user context| of |user contexts|:
+
+ 1. If |emulated user agent| is null, [=map/remove=] |user context| from
+ |session|'s [=emulated user agent=]'s [=user context user agent=].
+
+ 1. Otherwise, [=map/set=] |session|'s [=emulated user agent=]'s
+ [=user context user agent=][|user context|] to |emulated user agent|.
+
+ 1. Return [=success=] with data null.
+
+1. [=map/Set=] |session|'s [=emulated user agent=]'s [=default user agent=] to
+ |emulated user agent|.
+
+1. Return [=success=] with data null.
+
+user contexts
's [=set/size=] is not zero: