From dc5b1e888b95b45bf60ca6d60c26b69267b1adcb Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 30 Jan 2024 21:43:44 +0100 Subject: [PATCH] Add userContext field to WebDriver BiDi's setPermission User contexts in WebDriver BiDi represents the same concepts as the user agents in the infra spec: https://w3c.github.io/webdriver-bidi/#user-contexts According to the infra definition a user agent can be a user profile or a private browsing window. This PR adds an ability for the automation client to configure which "user agent" should the permissions apply too. --- index.html | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index c521149..e33a7f2 100644 --- a/index.html +++ b/index.html @@ -1232,15 +1232,16 @@

To set a permission given a {{PermissionDescriptor}} - |descriptor:PermissionDescriptor|, a {{PermissionState}} |state:PermissionState|, and an - optional |origin|: + |descriptor:PermissionDescriptor|, a {{PermissionState}} |state:PermissionState|, an + optional |origin|, and an optional |user agent|:

  1. Let |target origin| be [=current settings object=]'s [=environment settings object/origin=] if |origin| is null, or |origin| otherwise.
  2. Let |targets| be a list containing all [=environment settings objects=] whose - [=environment settings object/origin=] is [=same origin=] with |target origin|. + [=environment settings object/origin=] is [=same origin=] with |target origin|, and which + belong to the |user agent|.
  3. Let |tasks| be an empty list.
  4. @@ -1433,6 +1434,7 @@
    descriptor: permissions.PermissionDescriptor, state: permissions.PermissionState, origin: text, + userContext?: text, } @@ -1459,6 +1461,9 @@
  5. Let |state| be the value of the `state` field of |command parameters|.
  6. +
  7. Let |user context id| be the value of the `userContext` field of |command + parameters|, if defined, and `default` otherwise. +
  8. If |state| is an inappropriate [=permission state=] for any implementation-defined reason, return [=error=] with [=error code=] [=invalid argument=]. @@ -1470,7 +1475,11 @@
  9. Let |origin| be the value of the `origin` field of |command parameters|.
  10. -
  11. [=Set a permission=] with |typedDescriptor|, |state|, and |origin|. +
  12. Let |user agent| be the [=user agent=] that represents the [=user context=] + with the id |user context id|. +
  13. +
  14. [=Set a permission=] with |typedDescriptor|, |state|, |origin|, and |user + agent|.
  15. Return [=success=] with data `null`.