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

“Should request be allowed to use feature” algorithm #220

Merged
merged 6 commits into from
Jan 24, 2019
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