Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 47 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -630,19 +630,19 @@ <h2>
</dt>
<dd>
<p>
Takes an [=environment settings object=], and returns a new [=permission key=]. If
unspecified, this defaults to the [=default permission key generation algorithm=]. A
feature that specifies a custom [=powerful feature/permission key generation
algorithm=] MUST also specify a [=powerful feature/permission key comparison
algorithm=].
Takes an [=origin=] |origin| and an [=origin=] |top level origin|, and returns a new
[=permission key=]. If unspecified, this defaults to the [=default permission key
generation algorithm=]. A feature that specifies a custom [=powerful feature/permission
key generation algorithm=] MUST also specify a [=powerful feature/permission key
comparison algorithm=].
</p>
<div class="algorithm">
<p>
The <dfn class="export">default permission key generation algorithm</dfn>, given an
[=environment settings object=] |settings|, runs the following steps:
[=origin=] |origin| and an [=origin=] |top level origin|, runs the following steps:
</p>
<ol>
<li>Return |settings|'s [=environment/top-level origin=].
<li>Return |top level origin|.
</li>
</ol>
</div>
Expand Down Expand Up @@ -805,7 +805,9 @@ <h3 id="reading-current-states">
</ol>
</li>
<li>Let |key| be the result of [=powerful feature/permission key generation
algorithm|generating a permission key=] for |descriptor| with |settings|.
algorithm|generating a permission key=] for |descriptor| with |settings|'s
[=environment settings object/origin=] and |settings|'s
[=environment/top-level origin=].
</li>
<li>Let |entry| be the result of [=get a permission store entry|getting a permission
store entry=] with |descriptor| and |key|.
Expand Down Expand Up @@ -855,8 +857,12 @@ <h3 id="requesting-more-permission">
this framework.
</p>
</li>
<li>Let |settings| be the [=current settings object=].
</li>
<li>Let |key| be the result of [=powerful feature/permission key generation
algorithm|generating a permission key=] with the [=current settings object=].
algorithm|generating a permission key=] for |descriptor| with |settings|'s
[=environment settings object/origin=] and |settings|'s [=environment/top-level
origin=].
</li>
<li>[=Queue a task=] on the [=current settings object=]'s [=environment settings
object/responsible event loop=] to [=set a permission store entry=] with |descriptor|,
Expand Down Expand Up @@ -1235,19 +1241,35 @@ <h2 id="automation">
<p>
To <dfn data-for="WebDriver">set a permission</dfn> given a {{PermissionDescriptor}}
|descriptor:PermissionDescriptor|, a {{PermissionState}} |state:PermissionState|, an
optional |origin|, and an optional |user agent|:
optional [=permission key=] |key|, 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>Let |target key| be the result of [=powerful feature/permission key generation
algorithm|generating a permission key=] for |descriptor| with [=current settings
object=]'s [=environment settings object/origin=] and [=current settings object=]'s
[=environment/top-level origin=] if |key| is null, or |key| otherwise.
</li>
<li>Let |settings list| be a <a>list</a> containing all [=environment settings objects=]
which belong to the |user agent| if provided, or all user agents otherwise.
</li>
<li>Let |targets| be an empty <a>list</a>.
</li>
<li>[=list/For each=] [=environment settings object=] |settings| in |settings list|:
<ol>
<li>Let |settings key| be be the result of [=powerful feature/permission key
generation algorithm|generating a permission key=] for |descriptor| with |settings|'s
[=environment settings object/origin=] and |settings|'s [=environment/top-level origin=].
</li>
<li>Let |matches| be the result of running the [=powerful feature/permission key
comparison algorithm=] for |descriptor|, given |settings key| and |key|.
</li>
<li>If |matches|, then [=list/append=] |settings| to |targets|.
</ol>
</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|, 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>
<li>For each [=environment settings object=] |target| in |targets|:
<li>[=list/For each=] [=environment settings object=] |target| in |targets|:
<ol>
<li>[=Queue a task=] |task| on the [=permissions task source=] of |target|'s
[=relevant settings object=]'s [=environment settings object/global object=]'s
Expand Down Expand Up @@ -1437,6 +1459,7 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
descriptor: permissions.PermissionDescriptor,
state: permissions.PermissionState,
origin: text,
? topLevelOrigin: text,
? userContext: text,
}
</pre>
Expand Down Expand Up @@ -1476,10 +1499,17 @@ <h6 id="webdriver-bidi-command-permissions-setPermission">
</li>
<li>Let |origin| be the value of the `origin` field of |command parameters|.
</li>
<li>Let |top level origin| be the value of the `topLevelOrigin` field of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurs to me that there's a type mismatch here - top level origin is defined to be a text value here, but later on we use it as if it were an [=origin=] (without parsing it or anything). This is an existing problem with how the spec handles the origin variable, too. Technically, the spec probably ought to run a URL parser on the text to produce a URL and then access the URL's origin. Maybe there's a shorthand for doing all of that?

|command parameters|, if present, and |origin| otherwise.
</li>
<li>Let |key| be the result of [=powerful feature/permission key generation
algorithm|generating a permission key=] for |descriptor| with |origin| and
|top level origin|.
</li>
<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
<li>[=Set a permission=] with |typedDescriptor|, |state|, |key|, and |user
agent|.
</li>
<li>Return [=success=] with data `null`.
Expand Down