Skip to content

Commit

Permalink
Add "Should request be allowed to use feature" algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeps authored and clelland committed Jan 24, 2019
1 parent 9274cf9 commit b8ef061
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,22 @@ partial interface HTMLIFrameElement {
Note: This algorithm should be called when a feature policy has
been <a>violated</a>.
</section>
<section>
<h3 id="should-request-be-allowed-to-use-feature">Should <var>request</var> be allowed to use <var>feature</var>?</h3>
<p>Given a feature (<var>feature</var>) and a <a for="/">request</a> (<var>request</var>), this algorithm returns <code>true</code> if the request should be allowed to use <var>feature</var>, and <code>false</code> otherwise.</p>
<ol>
<li>Set |window| to |request|’s <a for="request">window</a>.</li>
<li>If |window| is not a {{Window}}, return <code>false</code>.
<div class="issue">Feature Policy within `no-window` contexts ({{WorkerGlobalScope}} or {{WorkletGlobalScope}}) is being figured out in <a href="https://github.com/WICG/feature-policy/issues/207">issue #207</a>. After that’s resolved, update this algorithm to allow fetches initiated within these contexts to use policy-controlled features. *Until* that’s resolved, disallow all policy-controlled features (e.g., sending Client Hints to third parties) in these contexts.</div>
</li>
<li>Set |document| to |window|’s <a>associated `Document`</a>.</li>
<li>Let |origin| be |request|’s <a for="request">origin</a>.</li>
<li>Let |result| be the result of executing <a href="is-feature-enabled">Is feature enabled in document for origin?</a> on |feature|, |document|, and |origin|.
</li>
<li>If |result| is "<code>Enabled</code>", return <code>true</code>.</li>
<li>Otherwise, return <code>false</code>.</li>
</ol>
</section>
</section>

<section>
Expand Down

0 comments on commit b8ef061

Please sign in to comment.