-
Notifications
You must be signed in to change notification settings - Fork 15
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
Changes from 1 commit
a369bc9
041b059
e9f5442
d2458d8
fb43978
e486c5a
a9e3c94
3e08915
7ad0dd5
e500e98
6d2ce77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,10 @@ <h2> | |
<a href="https://html.spec.whatwg.org/#same-origin-domain"><dfn>same | ||
origin-domain</dfn></a> | ||
</li> | ||
<li> | ||
<a href="https://html.spec.whatwg.org/#allowed-to-use"><dfn>allowed | ||
to use</dfn></a> | ||
</li> | ||
<li> | ||
<a href= | ||
"https://wicg.github.io/feature-policy/#policy-controlled-feature"><dfn> | ||
|
@@ -297,13 +301,18 @@ <h2> | |
<a>Navigator</a> object's <a>battery promise</a> and abort these steps. | ||
</li> | ||
<li>If this <a>Navigator</a> object's <a>relevant global object</a>'s | ||
<a>associated <code>Document</code></a>'s <a>browsing context</a>'s <a> | ||
active document</a>'s <a>origin</a> is not <a>same origin-domain</a> | ||
with the <a>origin</a> of the <a>current settings object</a> of this | ||
<a>Navigator</a> object, 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. | ||
<a>associated <code>Document</code></a> is not <a>allowed to use</a> | ||
the <code>battery</code> feature, 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. | ||
<div class="note"> | ||
In other words, this step rejects if the <a>associated | ||
<code>Document</code></a>'s <a>browsing context</a>'s <a>active | ||
document</a>'s <a>origin</a> is not <a>same origin-domain</a> with | ||
the <a>origin</a> of the <a>current settings object</a> of this | ||
<a>Navigator</a> object. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could add something like "unless specifically allowed by the document's feature policy." to this, if you wanted to be clear that it's possible to grant access to cross-origin subframes, but you have to be deliberate about it. The default situation is exactly as you describe here. |
||
</div> | ||
</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 | ||
|
@@ -526,13 +535,11 @@ <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 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>. | ||
The Battery Status API is a <a>policy-controlled feature</a> identified | ||
by the string "<code>battery</code>". It's default allowlist is | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Note to self: s/It’s/Its/) |
||
<code>'self'</code>. When 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"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With feature policy integration, I think you can replace this entire paragraph with something like
Because the default allowlist is
'self'
, that will automatically take care of the same-origin embed case, while allowing cross-origin usage only if explicitly enabled by the embedding document (which this paragraph still prohibits, I think)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed an update in an attempt to make use of "allowed to use". Please take a look. (I'm happy to see "allowed to use" abstracted out and reusable.)