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

Expose new algorithms to create a Feature Policy before document is c… #324

Merged
merged 3 commits into from
Jul 16, 2019
Merged
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
88 changes: 52 additions & 36 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -887,19 +887,18 @@ partial interface HTMLIFrameElement {
</ol>
</section>
<section>
<h3 id="algo-initialize-for-document"><dfn export
id="initialize-for-document">Initialize <var>document</var>'s Feature
Policy</var></dfn></h3>
<p>Given a {{Document}} object (<var>document</var>), this algorithm
initialises <var>document</var>'s <a>Feature Policy</a></p>
<h3 id="algo-create-for-browsingcontext"><dfn export id="create-for-browsingcontext">Create a
Feature Policy for a browsing <var>context</var></dfn></h3>
<p>Given a <a>browsing context</a> (<var>browsingContext</var>), and an <a>origin</a>
(<var>origin</var>) this algorithm returns a new <a>Feature Policy</a>.</p>
<ol>
<li>Let <var>inherited policy</var> be a new ordered map.</li>
<li>Let <var>declared policy</var> be a new ordered map.</li>
<li>For each <var>feature</var> supported,
<ol>
<li>Let <var>isInherited</var> be the result of running <a>Define an
inherited policy for feature in document</a> on <var>feature</var> and
<var>document</var>.
<li>Let <var>isInherited</var> be the result of running <a
href="#define-inherited-policy">Define an inherited policy for feature in browsing
context</a> on <var>feature</var>, <var>origin</var> and <var>browsingContext</var>.
</li>
<li>Set <var>inherited policy</var>[<var>feature</var>] to
<var>isInherited</var>.</li>
Expand All @@ -909,58 +908,75 @@ partial interface HTMLIFrameElement {
policy <var>inherited policy</var> and declared policy <var>declared
policy</var>.
</li>
<li>Return <var>policy</var>.</li>
</ol>
</section>
<section>
<h3 id="algo-initialize-for-document"><dfn export
clelland marked this conversation as resolved.
Show resolved Hide resolved
id="initialize-for-document">Initialize <var>document</var>'s Feature
Policy</dfn></h3>
<p>Given a {{Document}} object (<var>document</var>), this algorithm
initialises <var>document</var>'s <a>Feature Policy</a></p>
<ol>
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
context</a> given <var>document</var>'s <a>browsing context</a>, and <var>document</var>'s
<a>origin</a>.</li>
<li>
Set <var>document</var>’s <a href="https://html.spec.whatwg.org/multipage/dom.html#concept-document-feature-policy">feature policy</a> to <var>policy</var>.
</li>
</ol>
</section>
<section>
<h3 id="algo-initialize-from-response"><dfn export
id="initialize-from-response">Initialize <var>document</var>'s Feature
Policy from <var>response</var></dfn></h3>
<p>Given a [=response=] (<var>response</var>) and a <a>Document</a>
(<var>document</var>), this algorithm populates <var>document</var>'s
<h3 id="algo-create-from-response"><dfn export
id="create-from-response">Create a Feature
Policy for a browsing <var>context</var> from <var>response</var></dfn></h3>
<p>Given a <a>browsing context</a> (<var>browsingContext</var>), <a>origin</a>
(<var>origin</var>), and a [=response=] (<var>response</var>), this algorithm returns a new
<a>Feature Policy</a></p>
<ol>
<li><a>Initialize <var>document</var>'s
Feature Policy</a></li>
<li>Let <var>inherited policy</var> be <var>document</var>'s Feature
Policy's <a>inherited policy</a>.</li>
<li>Let <var>declared policy</var> be a new ordered map.</li>
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
context</a> given <var>browsingContext</var>, and <var>origin</var>.</li>
<li>Let <var>d</var> be the result of running <a
href="#process-response-policy">Process response policy</a> on
<var>response</var> and <var>document</var>'s origin.</li>
<var>response</var> and <var>origin</var>.</li>
<li>For each <var>feature</var> → <var>allowlist</var> of <var>d</var>:
<ol>
<li>If <var>inherited policy</var>[<var>feature</var>] is true, then
set <var>declared policy</var>[<var>feature</var>] to
<li>If <var>policy</var>'s <a>inherited policy</a>[<var>feature</var>] is true, then
set <var>policy</var>'s <a>declared policy</a>[<var>feature</var>] to
<var>allowlist</var>.</li>
</ol>
</li>
<li>Let <var>policy</var> be a new <a>feature policy</a>, with inherited
policy <var>inherited policy</var> and declared policy <var>declared
policy</var>.
</li>
<li>Return <var>policy</var>.</li>
</ol>
</section>
<section>
<h3 id="algo-initialize-from-response"><dfn export
clelland marked this conversation as resolved.
Show resolved Hide resolved
id="initialize-from-response">Initialize <var>document</var>'s Feature
Policy from <var>response</var></dfn></h3>
<p>Given a [=response=] (<var>response</var>) and a <a>Document</a>
(<var>document</var>), this algorithm populates <var>document</var>'s
<a>Feature Policy</a></p>
<ol>
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
context from response</a> given <var>document</var>'s <a>browsing context</a>, <var>document</var>'s
<a>origin</a>, and <var>response</var>.</li>
<li>
Set <var>document</var>’s <a href="https://html.spec.whatwg.org/multipage/dom.html#concept-document-feature-policy">feature policy</a> to <var>policy</var>.
</li>
</ol>
</section>
<section>
<h3 id="algo-define-inherited-policy"><dfn>Define an inherited policy for
<var>feature</var> in <var>document</var></dfn></h3>
<p>Given a feature (<var>feature</var>) and a <a>Document</a>
(<var>document</var>), this algorithm returns the <a>inherited policy</a>
for that feature.</p>
<h3 id="algo-define-inherited-policy"><dfn id="define-inherited-policy">Define an inherited policy for
<var>feature</var> in <a>browsing context</a></dfn></h3>
<p>Given a feature (<var>feature</var>), an <a>origin</a> (<var>origin</var>), and
a <a>browsing context</a> (<var>browsingContext</var>), this algorithm returns the
<a>inherited policy</a> for that feature.</p>
<ol>
<li>Let <var>context</var> be <var>document</var>'s <a>browsing
context</a>.</li>
<li>If <var>context</var> is the [=nested browsing context=] of a
<li>If <var>browsingContext</var> is the [=nested browsing context=] of a
[=browsing context container=] <var>element</var>, return the result of
executing <a>Define an inherited policy for feature in container at
origin</a> for <var>feature</var> in <var>context</var>'s <a>browsing
context container</a> at <var>document</var>'s
<a>origin</a>.</li>
origin</a> for <var>feature</var> in <var>browsingContext</var>'s <a>browsing
context container</a> at <var>origin</var>.</li>
<li>Otherwise, return "<code>Enabled</code>".</li>
</ol>
</section>
Expand Down