Skip to content

Commit 0d8f9c0

Browse files
dtapuskaclelland
authored andcommitted
Expose new algorithms to create a Feature Policy before document is c… (#324)
* Expose new algorithms to create a Feature Policy before document is created. Adjust algorithms so that the HTML spec will be able to create a feature policy before the document is created. Instead of creating the document first and then applying it afterwards. The document based algorithms will remain until the HTML spec is changed.
1 parent 6c04dbc commit 0d8f9c0

File tree

1 file changed

+52
-36
lines changed

1 file changed

+52
-36
lines changed

index.bs

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -887,19 +887,18 @@ partial interface HTMLIFrameElement {
887887
</ol>
888888
</section>
889889
<section>
890-
<h3 id="algo-initialize-for-document"><dfn export
891-
id="initialize-for-document">Initialize <var>document</var>'s Feature
892-
Policy</var></dfn></h3>
893-
<p>Given a {{Document}} object (<var>document</var>), this algorithm
894-
initialises <var>document</var>'s <a>Feature Policy</a></p>
890+
<h3 id="algo-create-for-browsingcontext"><dfn export id="create-for-browsingcontext">Create a
891+
Feature Policy for a browsing <var>context</var></dfn></h3>
892+
<p>Given a <a>browsing context</a> (<var>browsingContext</var>), and an <a>origin</a>
893+
(<var>origin</var>) this algorithm returns a new <a>Feature Policy</a>.</p>
895894
<ol>
896895
<li>Let <var>inherited policy</var> be a new ordered map.</li>
897896
<li>Let <var>declared policy</var> be a new ordered map.</li>
898897
<li>For each <var>feature</var> supported,
899898
<ol>
900-
<li>Let <var>isInherited</var> be the result of running <a>Define an
901-
inherited policy for feature in document</a> on <var>feature</var> and
902-
<var>document</var>.
899+
<li>Let <var>isInherited</var> be the result of running <a
900+
href="#define-inherited-policy">Define an inherited policy for feature in browsing
901+
context</a> on <var>feature</var>, <var>origin</var> and <var>browsingContext</var>.
903902
</li>
904903
<li>Set <var>inherited policy</var>[<var>feature</var>] to
905904
<var>isInherited</var>.</li>
@@ -909,58 +908,75 @@ partial interface HTMLIFrameElement {
909908
policy <var>inherited policy</var> and declared policy <var>declared
910909
policy</var>.
911910
</li>
911+
<li>Return <var>policy</var>.</li>
912+
</ol>
913+
</section>
914+
<section>
915+
<h3 id="algo-initialize-for-document"><dfn export
916+
id="initialize-for-document">Initialize <var>document</var>'s Feature
917+
Policy</dfn></h3>
918+
<p>Given a {{Document}} object (<var>document</var>), this algorithm
919+
initialises <var>document</var>'s <a>Feature Policy</a></p>
920+
<ol>
921+
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
922+
context</a> given <var>document</var>'s <a>browsing context</a>, and <var>document</var>'s
923+
<a>origin</a>.</li>
912924
<li>
913925
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>.
914926
</li>
915927
</ol>
916928
</section>
917929
<section>
918-
<h3 id="algo-initialize-from-response"><dfn export
919-
id="initialize-from-response">Initialize <var>document</var>'s Feature
920-
Policy from <var>response</var></dfn></h3>
921-
<p>Given a [=response=] (<var>response</var>) and a <a>Document</a>
922-
(<var>document</var>), this algorithm populates <var>document</var>'s
930+
<h3 id="algo-create-from-response"><dfn export
931+
id="create-from-response">Create a Feature
932+
Policy for a browsing <var>context</var> from <var>response</var></dfn></h3>
933+
<p>Given a <a>browsing context</a> (<var>browsingContext</var>), <a>origin</a>
934+
(<var>origin</var>), and a [=response=] (<var>response</var>), this algorithm returns a new
923935
<a>Feature Policy</a></p>
924936
<ol>
925-
<li><a>Initialize <var>document</var>'s
926-
Feature Policy</a></li>
927-
<li>Let <var>inherited policy</var> be <var>document</var>'s Feature
928-
Policy's <a>inherited policy</a>.</li>
929-
<li>Let <var>declared policy</var> be a new ordered map.</li>
937+
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
938+
context</a> given <var>browsingContext</var>, and <var>origin</var>.</li>
930939
<li>Let <var>d</var> be the result of running <a
931940
href="#process-response-policy">Process response policy</a> on
932-
<var>response</var> and <var>document</var>'s origin.</li>
941+
<var>response</var> and <var>origin</var>.</li>
933942
<li>For each <var>feature</var><var>allowlist</var> of <var>d</var>:
934943
<ol>
935-
<li>If <var>inherited policy</var>[<var>feature</var>] is true, then
936-
set <var>declared policy</var>[<var>feature</var>] to
944+
<li>If <var>policy</var>'s <a>inherited policy</a>[<var>feature</var>] is true, then
945+
set <var>policy</var>'s <a>declared policy</a>[<var>feature</var>] to
937946
<var>allowlist</var>.</li>
938947
</ol>
939948
</li>
940-
<li>Let <var>policy</var> be a new <a>feature policy</a>, with inherited
941-
policy <var>inherited policy</var> and declared policy <var>declared
942-
policy</var>.
943-
</li>
949+
<li>Return <var>policy</var>.</li>
950+
</ol>
951+
</section>
952+
<section>
953+
<h3 id="algo-initialize-from-response"><dfn export
954+
id="initialize-from-response">Initialize <var>document</var>'s Feature
955+
Policy from <var>response</var></dfn></h3>
956+
<p>Given a [=response=] (<var>response</var>) and a <a>Document</a>
957+
(<var>document</var>), this algorithm populates <var>document</var>'s
958+
<a>Feature Policy</a></p>
959+
<ol>
960+
<li>Let <var>policy</var> be the result of running <a>Create a Feature Policy for a browsing
961+
context from response</a> given <var>document</var>'s <a>browsing context</a>, <var>document</var>'s
962+
<a>origin</a>, and <var>response</var>.</li>
944963
<li>
945964
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>.
946965
</li>
947966
</ol>
948967
</section>
949968
<section>
950-
<h3 id="algo-define-inherited-policy"><dfn>Define an inherited policy for
951-
<var>feature</var> in <var>document</var></dfn></h3>
952-
<p>Given a feature (<var>feature</var>) and a <a>Document</a>
953-
(<var>document</var>), this algorithm returns the <a>inherited policy</a>
954-
for that feature.</p>
969+
<h3 id="algo-define-inherited-policy"><dfn id="define-inherited-policy">Define an inherited policy for
970+
<var>feature</var> in <a>browsing context</a></dfn></h3>
971+
<p>Given a feature (<var>feature</var>), an <a>origin</a> (<var>origin</var>), and
972+
a <a>browsing context</a> (<var>browsingContext</var>), this algorithm returns the
973+
<a>inherited policy</a> for that feature.</p>
955974
<ol>
956-
<li>Let <var>context</var> be <var>document</var>'s <a>browsing
957-
context</a>.</li>
958-
<li>If <var>context</var> is the [=nested browsing context=] of a
975+
<li>If <var>browsingContext</var> is the [=nested browsing context=] of a
959976
[=browsing context container=] <var>element</var>, return the result of
960977
executing <a>Define an inherited policy for feature in container at
961-
origin</a> for <var>feature</var> in <var>context</var>'s <a>browsing
962-
context container</a> at <var>document</var>'s
963-
<a>origin</a>.</li>
978+
origin</a> for <var>feature</var> in <var>browsingContext</var>'s <a>browsing
979+
context container</a> at <var>origin</var>.</li>
964980
<li>Otherwise, return "<code>Enabled</code>".</li>
965981
</ol>
966982
</section>

0 commit comments

Comments
 (0)