Skip to content

Update "Is feature enabled in document for origin?" behavior #499

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ partial interface HTMLIFrameElement {

<div class="algorithm" data-algorithm="is-feature-enabled">
Given a feature (|feature|), a {{Document}} object
(|document|), and an [=origin=] (|origin|), this algorithm
(|document|), an [=origin=] (|origin|), and an [=ordered set=] of [=policy-controlled feature=] (|optInFeatures|), this algorithm
returns "<code>Disabled</code>" if |feature| should be considered
disabled, and "<code>Enabled</code>" otherwise.</p>
1. Let |policy| be |document|'s <a>Permissions Policy</a>
Expand All @@ -957,6 +957,7 @@ partial interface HTMLIFrameElement {
policy</a> <a>matches</a> |origin|, then return
"<code>Enabled</code>".
1. Otherwise return "<code>Disabled</code>".
1. If |optInFeatures| contains |feature|, then return "<code>Enabled</code>".
1. If |feature|'s <a>default allowlist</a> is <code>*</code>, return
"<code>Enabled</code>".
1. If |feature|'s <a>default allowlist</a> is <code>'self'</code>, and
Expand Down Expand Up @@ -1023,8 +1024,14 @@ partial interface HTMLIFrameElement {
sending Client Hints to third parties) in these contexts.</div>
1. Set |document| to |window|’s <a>associated `Document`</a>.
1. Let |origin| be |request|’s <a for="request">origin</a>.
1. Let |optInFeatures| be an empty [=ordered set=].
1. For each supported [=policy-controlled feature=] |feature|:
1. If |request| contains an equivalent opt-in flag for |feature|, append |feature| to |optInFeatures|.

Note: "equivalent opt-in flag" needs more specification. Currently, the <a href="https://github.com/patcg-individual-drafts/topics">Topics API</a> relies on this heuristic, e.g. for <code>fetch(&lt;url&gt;, {browsingTopics: true})</code>, the equivalent opt-in flag for [=policy-controlled feature=] "browsing-topics" is |browsingTopics|.

1. Let |result| be the result of executing <a abstract-op>Is feature
enabled in document for origin?</a> on |feature|, |document|, and |origin|.
enabled in document for origin?</a> on |feature|, |document|, |origin|, and |optInFeatures|.
1. If |result| is "<code>Enabled</code>", return <code>true</code>.
1. Otherwise, return <code>false</code>.

Expand Down