Skip to content

Commit

Permalink
Add userContext field to WebDriver BiDi's setPermission (#438)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OrKoN committed Mar 8, 2024
1 parent 75ef57e commit 645867d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1234,15 +1234,16 @@ <h2 id="automation">
<div class="algorithm">
<p>
To <dfn data-for="WebDriver">set a permission</dfn> 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|:
</p>
<ol>
<li>Let |target origin| be [=current settings object=]'s [=environment settings
object/origin=] if |origin| is null, or |origin| otherwise.
</li>
<li>Let |targets| be a <a>list</a> 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.
</li>
<li>Let |tasks| be an empty <a>list</a>.
</li>
Expand Down Expand Up @@ -1436,6 +1437,7 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
descriptor: permissions.PermissionDescriptor,
state: permissions.PermissionState,
origin: text,
userContext?: text,
}
</pre>
</dd>
Expand All @@ -1462,6 +1464,9 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
</li>
<li>Let |state| be the value of the `state` field of |command parameters|.
</li>
<li>Let |user context id| be the value of the `userContext` field of |command
parameters|, if present, and `default` otherwise.
</li>
<li>If |state| is an inappropriate [=permission state=] for any
implementation-defined reason, return [=error=] with [=error code=] [=invalid
argument=].
Expand All @@ -1473,7 +1478,11 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
</li>
<li>Let |origin| be the value of the `origin` field of |command parameters|.
</li>
<li>[=Set a permission=] with |typedDescriptor|, |state|, and |origin|.
<li>Let |user agent| be the [=user agent=] that represents the [=user context=]
with the id |user context id|.
</li>
<li>[=Set a permission=] with |typedDescriptor|, |state|, |origin|, and |user
agent|.
</li>
<li>Return [=success=] with data `null`.
</li>
Expand Down

0 comments on commit 645867d

Please sign in to comment.