From 645867d4eae0d4caac29be22e3d4c7e4eef62e61 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Fri, 8 Mar 2024 16:07:50 +0100 Subject: [PATCH] Add userContext field to WebDriver BiDi's setPermission (#438) 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 0f39d41..83eb2d6 100644 --- a/index.html +++ b/index.html @@ -1234,15 +1234,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| if provided, or all user agents otherwise.
  3. Let |tasks| be an empty list.
  4. @@ -1436,6 +1437,7 @@
    descriptor: permissions.PermissionDescriptor, state: permissions.PermissionState, origin: text, + userContext?: text, } @@ -1462,6 +1464,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 present, and `default` otherwise. +
  8. If |state| is an inappropriate [=permission state=] for any implementation-defined reason, return [=error=] with [=error code=] [=invalid argument=]. @@ -1473,7 +1478,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`.