Skip to content

Commit

Permalink
Add userContext field to WebDriver BiDi's setPermission
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 Jan 30, 2024
1 parent 8972985 commit dc5b1e8
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 @@ -1232,15 +1232,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|.
</li>
<li>Let |tasks| be an empty <a>list</a>.
</li>
Expand Down Expand Up @@ -1433,6 +1434,7 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
descriptor: permissions.PermissionDescriptor,
state: permissions.PermissionState,
origin: text,
userContext?: text,
}
</pre>
</dd>
Expand All @@ -1459,6 +1461,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 defined, 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 @@ -1470,7 +1475,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 dc5b1e8

Please sign in to comment.