Skip to content

Commit 29c422f

Browse files
committed
Refactor loop
1 parent 9c3a799 commit 29c422f

File tree

1 file changed

+48
-40
lines changed

1 file changed

+48
-40
lines changed

fetch.bs

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6905,35 +6905,36 @@ This specification defined a <a>policy-controlled feature</a> identified by the
69056905
<p class="note allow-2119">640kb should be enough for everyone.
69066906

69076907
<li>
6908-
<p><a for=list>For each</a> <var>navigable</var> in <var>relativeNavigables</var>:
6908+
<p>Let <var>topRelativeNavigable</var> in <var>relativeNavigables</var>[0]:
6909+
<li>
6910+
<p>If <var>topRelativeNavigable</var> is a <a for=/>top-level traversable</a> then:
69096911
<ol>
6910-
<li>
6911-
<p>If <var>navigable</var> is a <a for=/>top-level traversable</a> then:
6912-
<ol>
6913-
<li><p>If <var>navigable</var>'s <a>active document</a> is not <a>allowed to use</a> the
6914-
<a>policy-controlled feature</a> {{PermissionPolicy/"deferred-fetch"}}, then return 0.
6912+
<li><p>If <var>topRelativeNavigable</var>'s <a>active document</a> is not <a>allowed to use</a>
6913+
the <a>policy-controlled feature</a> {{PermissionPolicy/"deferred-fetch"}}, then return 0.
69156914

6916-
<li><p>Otherwise, if <var>navigable</var>'s <a>active document</a> is <a>allowed to use</a>
6917-
the <a>policy-controlled feature</a> {{PermissionPolicy/"deferred-fetch-minimal"}}, then set
6918-
<var>remainingTotalQuota</var> to 512 kibibytes.
6915+
<li>
6916+
<p>Otherwise, if <var>topRelativeNavigable</var>'s <a>active document</a> is
6917+
<a>allowed to use</a> the <a>policy-controlled feature</a>
6918+
{{PermissionPolicy/"deferred-fetch-minimal"}}, then set <var>remainingTotalQuota</var> to 512
6919+
kibibytes.
69196920

6920-
<p class=note>When this permission policy is enabled, this document delegates 8KB to each of
6921-
the first 16 cross-origin subframes leaving 512kb for its own quota.
6922-
</ol>
6921+
<p class=note>When this permission policy is enabled, this document delegates 8KB to each of
6922+
the first 16 cross-origin subframes leaving 512kb for its own quota.
6923+
</ol>
69236924

6924-
<li>
6925-
<p>Otherwise:</p>
6926-
<ol>
6927-
<li><p>Let <var>containerPolicy</var> be <var>navigable</var>'s
6928-
<a for=navigable>container</a>'s <a>deferred fetch policy</a>.
6925+
<li>
6926+
<p>Otherwise:</p>
6927+
<ol>
6928+
<li><p>Let <var>containerPolicy</var> be <var>topRelativeNavigable</var>'s
6929+
<a for=navigable>container</a>'s <a>deferred fetch policy</a>.
69296930

6930-
<li><p>If <var>containerPolicy</var> is <code>disabled</code> or <var>navigable</var>'s
6931-
<a>active document</a> is not <a>allowed to use</a> <var>containerPolicy</var>, then return 0.
6931+
<li><p>If <var>containerPolicy</var> is <code>disabled</code> or
6932+
<var>topRelativeNavigable</var>'s <a>active document</a> is not <a>allowed to use</a>
6933+
<var>containerPolicy</var>, then return 0.
69326934

6933-
<li><p>Otherwise, set <var>remainingTotalQuota</var> to the
6934-
<a>initial subframe deferred fetch quota</a> given <var>containerPolicy</var>.
6935-
</ol>
6936-
</ol>
6935+
<li><p>Otherwise, set <var>remainingTotalQuota</var> to the
6936+
<a>initial subframe deferred fetch quota</a> given <var>containerPolicy</var>.
6937+
</ol>
69376938

69386939
<li><p>Let <var>remainingQuotaForOrigin</var> be <var>remainingTotalQuota</var>.
69396940

@@ -6958,19 +6959,19 @@ This specification defined a <a>policy-controlled feature</a> identified by the
69586959
<a for="deferred fetch record">request</a>'s <a for=request>URL</a>'s <a for=url>origin</a> is
69596960
<a>same origin</a> with <var>origin</var>, then decrement <var>remainingQuotaForOrigin</var> by
69606961
<var>length</var>.
6961-
6962-
<li><p>Let <var>relevantContainers</var> be all the <a>shadow-including descendant</a> of
6963-
<var>navigable</var>'s <a for=navigable>active document</a> which are a
6964-
<a>navigable container</a>.
6965-
6966-
<li><p><a for=list>For each</a> <var>descendantContainer</var> of
6967-
<var>relevantContainers</var>, if <var>relativeNavigables</var> does not
6968-
<a for=list>contain</a> <var>descendantContainer</var>, then decrement
6969-
<var>remainingTotalQuota</var> by the <a>initial subframe deferred fetch quota</a> given
6970-
<var>descendantContainer</var>'s <a>deferred fetch policy</a>.
69716962
</ol>
69726963
</li>
69736964

6965+
<li><p>Let <var>relevantContainers</var> be all the <a>shadow-including descendant</a> of
6966+
<var>navigable</var>'s <a for=navigable>active document</a> which are a
6967+
<a>navigable container</a>.
6968+
6969+
<li><p><a for=list>For each</a> <var>descendantContainer</var> of
6970+
<var>relevantContainers</var>, if <var>relativeNavigables</var> does not
6971+
<a for=list>contain</a> <var>descendantContainer</var>, then decrement
6972+
<var>remainingTotalQuota</var> by the <a>initial subframe deferred fetch quota</a> given
6973+
<var>descendantContainer</var>'s <a>deferred fetch policy</a>.
6974+
69746975
</ol>
69756976
</li>
69766977

@@ -7058,13 +7059,20 @@ The <dfn>initial subframe deferred fetch quota</dfn> is determined by the follow
70587059
</div>
70597060

70607061
<div algorithm>
7061-
The <dfn>deferred fetch quota-sharing navigables</dfn> of a <code>Document</code>
7062-
<var>document</var> are all the <a for=/>navigables</a> whose <a>active document</a>'s
7063-
<a>relevant agent</a> is <var>document</var>'s <a>relevant agent</a>'s,
7064-
<a for=navigable>top-level traversable</a> is <var>document</var>'s <a>node navigable</a>'s
7065-
<a for=navigable>top-level traversable</a>, and whose <a>active document</a>'s
7066-
<a for=Document>origin</a> is <a>same origin</a> with <var>document</var>'s
7067-
<a for=Document>URL</a>'s <a for=url>origin</a>.
7062+
<p>To get the <dfn>deferred fetch quota-sharing navigables</dfn> of a <code>Document</code>
7063+
<var>document</var>:</p>
7064+
<ol>
7065+
<li><p>Let <var>relatives</var> be <var>document</var>'s <a>node navigable</a>'s
7066+
<a for=navigable>top-level traversable</a>'s <a for=navigable>active document</a>'s
7067+
<a>inclusive descendant navigables</a>.
7068+
7069+
<li><p><a for=list>Remove</a> from <var>relatives</var> all navigables whose
7070+
<a>active document</a>'s <a for=Document>origin</a> is not <a>same origin</a> with
7071+
<var>document</var>'s <a for=Document>URL</a>'s <a for=url>origin</a>, and whose
7072+
<a>active document</a>'s <a>relevant agent</a> is not <var>document</var>'s <a>relevant agent</a>.
7073+
7074+
<li><p>Return <var>relatives</var>.
7075+
</ol>
70687076
</div>
70697077

70707078

0 commit comments

Comments
 (0)