From db7fc482ad19e9e128a68c921419b32b8f469e7e Mon Sep 17 00:00:00 2001 From: Thiago Perrotta Date: Tue, 14 Nov 2023 20:14:37 +0100 Subject: [PATCH] Introduce "browsingContext.setUserAgent" command Bug: #448 --- index.bs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 89ae6e21..af8f83f9 100644 --- a/index.bs +++ b/index.bs @@ -200,8 +200,9 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: shared worker; url: workers.html#shared-workers text: system visibility state; url: document-sequences.html#system-visibility-state text: traversable navigable; url:document-sequences.html#traversable-navigable - text: visible; url: document-sequences.html#system-visibility-state text: traverse the history by a delta; url: browsing-the-web.html#traverse-the-history-by-a-delta + text: user agent; url: system-state.html#dom-navigator-useragent + text: visible; url: document-sequences.html#system-visibility-state text: window open steps; url: window-object.html#window-open-steps text: worker event loop; url: webappapis.html#worker-event-loop-2 text: worklet global scopes; url:worklets.html#concept-document-worklet-global-scopes @@ -1922,6 +1923,7 @@ BrowsingContextCommand = ( browsingContext.Navigate // browsingContext.Print // browsingContext.Reload // + browsingContext.SetUserAgent // browsingContext.SetViewport // browsingContext.TraverseHistory ) @@ -3448,6 +3450,58 @@ The [=remote end steps=] with |command parameters| are: +#### The browsingContext.setUserAgent Command #### {#command-browsingContext-setUserAgent} + +The browsingContext.setUserAgent command sets the +{{NavigatorID/userAgent}} string for a browsing context. + +
+
Command Type
+
+
+      browsingContext.SetUserAgent = (
+        method: "browsingContext.setUserAgent",
+        params: browsingContext.SetUserAgentParameters
+      )
+
+      browsingContext.SetUserAgentParameters = {
+        context: browsingContext.BrowsingContext,
+        userAgent: text / null,
+      }
+    
+
+
Result Type
+
+
+     EmptyResult
+    
+
+
+ +
+ +The [=remote end steps=] with |command parameters| are: + +1. Let |context id| be the value of the context field of |command + parameters|. + +1. Let |context| be the result of [=trying=] to [=get a browsing context=] with + |context id|. + +1. Let |user agent| be the value of the userAgent field of |command + parameters| if present, or null otherwise. + +1. If |user agent| is not null: + + 1. Set |context|'s [=user agent=] to |user agent|. + + 1. Otherwise, set |context|'s {{NavigatorID/userAgent}} to the + implementation-defined [=default `user-agent` value=]. + +1. Return [=success=] with data null. + +
+ #### The browsingContext.setViewport Command #### {#command-browsingContext-setViewport} The browsingContext.setViewport command specific viewport characteristics (e.g. viewport width and viewport height) on the given top-level browsing context.