From 438c6b708d8da1609c3b315c67e9c375214eab62 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 | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index c966df8fc..b3b1a646c 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 @@ -1880,6 +1881,7 @@ BrowsingContextCommand = ( browsingContext.Navigate // browsingContext.Print // browsingContext.Reload // + browsingContext.SetUserAgent // browsingContext.SetViewport // browsingContext.TraverseHistory ) @@ -3406,6 +3408,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. @@ -6530,7 +6584,7 @@ strong [=/map=] from handle ids to their corresponding objects. script.InternalId = text; -The script.InternalId type represents the id of +The script.InternalId type represents the id of a previously serialized script.RemoteValue during [=serialize as a remote value|serialization=]. @@ -7526,7 +7580,7 @@ To set internal ids if needed given |serialization internal map|, 1. If |previously serialized remote value| does not have a field internalId, run the following steps: - 1. Let |internal id| be the string representation of a [[!RFC4122|UUID]] + 1. Let |internal id| be the string representation of a [[!RFC4122|UUID]] based on truly random, or pseudo-random numbers. 1. Set the internalId field of