Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use in same-origin children, add Feature Policy integration #13

Merged
merged 11 commits into from
Sep 24, 2019
66 changes: 56 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ <h2>
Terminology
</h2>
<p>
The following concepts, terms, and interfaces are defined in
[[!HTML5]], [[!ECMASCRIPT]], [[!WEBIDL]], and [[!SECURE-CONTEXTS]]:
The following concepts, terms, and interfaces are defined in [[!HTML]],
[[!HTML5]], [[!ECMASCRIPT]], [[!WEBIDL]], [[!SECURE-CONTEXTS]], and
Copy link
Member

Choose a reason for hiding this comment

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

What's HTML5 still used for? Everything used should come out of WHATWG's version of the spec.

[[!FEATURE-POLICY]]:
</p>
<ul>
<li>
Expand Down Expand Up @@ -180,8 +181,8 @@ <h2>
</li>
<li>
<dfn><a href=
"https://www.w3.org/TR/html5/webappapis.html#incumbent-settings-object">
incumbent settings object</a></dfn>
"https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object">
current settings object</a></dfn>
</li>
<li>
<a href=
Expand All @@ -204,6 +205,36 @@ <h2>
"https://www.w3.org/TR/secure-contexts/#secure-context"><dfn>secure
context</dfn></a>
</li>
<li>
<a href=
"https://html.spec.whatwg.org/multipage/browsers.html#active-document">
<dfn>active document</dfn></a>
</li>
<li>
<a href=
"https://html.spec.whatwg.org/multipage/origin.html#concept-origin"><dfn>
origin</dfn></a>
</li>
<li>
<a href=
"https://html.spec.whatwg.org/multipage/origin.html#same-origin-domain">
<dfn>same-origin domain</dfn></a>
Copy link
Member

Choose a reason for hiding this comment

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

same origin-domain

</li>
<li>
<a href=
"https://wicg.github.io/feature-policy/#policy-controlled-feature"><dfn>
policy-controlled feature</dfn></a>
</li>
<li>
<a href=
"https://wicg.github.io/feature-policy/#feature-name"><dfn>feature
name</dfn></a>
</li>
<li>
<a href=
"https://wicg.github.io/feature-policy/#default-allowlist"><dfn>default
allowlist</dfn></a>
</li>
</ul>
</section>
<section class="informative">
Expand Down Expand Up @@ -255,17 +286,18 @@ <h2>
the following steps:
</p>
<ol>
<li>If the <a>incumbent settings object</a> is not a <a>secure
<li>If the <a>current settings object</a> is not a <a>secure
Copy link
Member

Choose a reason for hiding this comment

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

Things in the web platform generally use "relevant settings object of this Navigator object." We generally don't want to use "current". See https://html.spec.whatwg.org/multipage/webappapis.html#realms-settings-objects-global-objects, the example starting with "One reason why the relevant concept is generally a better default choice than the current concept"

context</a>, then reject this <a>Navigator</a> object's <a>battery
promise</a> with a "<a>SecurityError</a>" <a>DOMException</a>, return
this <a>Navigator</a> object's <a>battery promise</a> and abort these
steps.
</li>
<li>If the <a>browsing context</a> is not a <a>top-level browsing
context</a>, then reject this <a>Navigator</a> object's <a>battery
promise</a> with a "<a>SecurityError</a>" <a>DOMException</a>, return
this <a>Navigator</a> object's <a>battery promise</a> and abort these
steps.
<li>If the <a>top-level browsing context</a>'s <a>active document</a>'s
Copy link
Member

Choose a reason for hiding this comment

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

#19 doesn't seem to be fixed here.

Probably you want, hmm, this Navigator object's relevant global object's associated Document's browsing context?

<a>origin</a> and the <a>origin</a> specified by the <a>current
settings object</a> is not <a>same-origin domain</a>, then reject this
Copy link
Member

Choose a reason for hiding this comment

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

same origin-domain

<a>Navigator</a> object's <a>battery promise</a> with a
"<a>SecurityError</a>" <a>DOMException</a>, return this <a>Navigator</a>
object's <a>battery promise</a> and abort these steps.
</li>
<li>If this <a>Navigator</a> object's <a>battery promise</a> is not
<code>null</code>, return this <a>Navigator</a> object's <a>battery
Expand Down Expand Up @@ -483,6 +515,20 @@ <h2>
</table>
</section>
</section>
<section>
<h2>
Feature Policy integration
</h2>
<p data-link-for="Navigator">
The Battery Status API is a <a>policy-controlled feature</a>, as
defined by Feature Policy [[!FEATURE-POLICY]]. The <a>feature name</a>
for the Battery Status API is "<code>battery</code>". The <a>default
allowlist</a> for the Battery Status API is <code>["self"]</code>. When
Copy link
Member

Choose a reason for hiding this comment

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

The allowlist is defined as an ordered set, which is a list. So instead of ["self"], « "self" ».

disabled in a document, the <code><a>getBattery</a>()</code> method
MUST return a <a>promise</a> which rejects with a
"<a>SecurityError</a>" <a>DOMException</a>.
</p>
</section>
<section class="informative">
<h2>
Examples
Expand Down