Skip to content

Commit e7d90fb

Browse files
committed
Make algo a bit more readable
1 parent cb85aad commit e7d90fb

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

fetch.bs

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,10 @@ not <a for=Document>fully active</a>. It has the following <a for=struct>items</
27622762
</dl>
27632763

27642764
<p>Each <a>navigable container</a> has an associated number
2765-
<dfn>reserved deferred-fetch quota</dfn>. Unless stated otherwise, it is 0.
2765+
<dfn>reserved deferred-fetch quota</dfn>. Its possible values are
2766+
<dfn for="reserved deferred-fetch quota">minimal quota</dfn>, which is 8 kibibytes,
2767+
<dfn for="reserved deferred-fetch quota">normal quota</dfn>, which is 64 kibibytes, or 0. Unless
2768+
stated otherwise, it is 0.
27662769

27672770
<hr>
27682771

@@ -7029,14 +7032,13 @@ descendants share a quota of 384 kibibytes. That value is computed as such:
70297032
<li>
70307033
<p>If <var>otherContainer</var> is null, then:
70317034

7032-
<p class=note>Initialize the quota from the top-level traversable.
7035+
<p class=note>Accumulate the <a for=/>top-level traversable</a>'s initial quota.
70337036

70347037
<ol>
7035-
<li><p>Assert: <var>quota</var> is 0.
7038+
<li><p>If <var>otherDocument</var> is not <a>allowed to use</a> the
7039+
<a>policy-controlled feature</a> "{{PermissionsPolicy/deferred-fetch}}", then return 0.
70367040

7037-
<li><p>If <var>otherDocument</var> is not
7038-
<a>allowed to use</a> the <a>policy-controlled feature</a>
7039-
"{{PermissionsPolicy/deferred-fetch}}", then return 0.
7041+
<li><p>Assert: <var>quota</var> is 0.
70407042

70417043
<li>
70427044
<p>Set <var>quota</var> be 640 kibibytes.
@@ -7045,30 +7047,35 @@ descendants share a quota of 384 kibibytes. That value is computed as such:
70457047
<li><p>If <var>otherDocument</var> is <a>allowed to use</a> the
70467048
<a>policy-controlled feature</a> "{{PermissionsPolicy/deferred-fetch-minimal}}", then
70477049
decrement <var>quota</var> by <a>max containers with minimal quota</a>, multiplied by
7048-
<a for="reserved deferred-fetch quota">minimal</a>.
7050+
<a for="reserved deferred-fetch quota">minimal quota</a>.
70497051
</ol>
70507052

70517053
<li>
70527054
<p>Otherwise, if any of the following conditions is true:
7055+
70537056
<ul class=brief>
70547057
<li><p><var>otherContainer</var>'s <a>reserved deferred-fetch quota</a> is
7055-
<a for="reserved deferred-fetch quota">normal</a>, and <var>otherDocument</var> is
7058+
<a for="reserved deferred-fetch quota">normal quota</a>, and <var>otherDocument</var> is
70567059
<a>allowed to use</a> the <a>policy-controlled feature</a>
70577060
"{{PermissionsPolicy/deferred-fetch}}"
70587061

70597062
<li><p><var>otherContainer</var>'s <a>reserved deferred-fetch quota</a> is
7060-
<a for="reserved deferred-fetch quota">minimal</a>, and <var>otherDocument</var> is
7063+
<a for="reserved deferred-fetch quota">minimal quota</a>, and <var>otherDocument</var> is
70617064
<a>allowed to use</a> the <a>policy-controlled feature</a>
70627065
"{{PermissionsPolicy/deferred-fetch-minimal}}"
70637066
</ul>
70647067

70657068
<p>then increment <var>quota</var> by <var>otherContainer</var>'s
70667069
<a>reserved deferred-fetch quota</a>.
7070+
<p class=note>Accumulate quota granted by parent documents.
70677071

70687072
<li>
70697073
<p><a for=list>For each</a> <a>deferred fetch record</a> <var>deferredRecord</var> of
70707074
<var>otherDocument</var>'s <a for=fetch>fetch group</a>'s
70717075
<a for="fetch group">deferred fetch records</a>:</p>
7076+
7077+
<p class=note>Account for quota on deferred fetches performed by <a>same origin</a> clients.
7078+
70727079
<ol>
70737080
<li><p>Let <var>requestLength</var> be the <a>total request length</a> of
70747081
<var>deferredRecord</var>'s <a for="deferred fetch record">request</a>.
@@ -7081,17 +7088,17 @@ descendants share a quota of 384 kibibytes. That value is computed as such:
70817088
</ol>
70827089
</ol>
70837090

7084-
<li><p>Otherwise, if <var>otherDocument</var>'s <a>container document</a> is a {{Document}} whose
7085-
<a for=Document>origin</a> is <a>same origin</a> with <var>requestClientDocument</var>'s
7086-
<a for=Document>origin</a>, then decrement <var>quota</var> by <var>otherNavigable</var>'s
7087-
<a>navigable container</a>'s <a>reserved deferred-fetch quota</a>.
7088-
</ol>
7089-
7090-
<li><p>If <var>quota</var> is less than 0, than return 0.
7091+
<li>
7092+
<p>If <var>otherDocument</var>'s <a>container document</a> is a {{Document}} whose
7093+
<a for=Document>origin</a> is <a>same origin</a> with <var>requestClientDocument</var>'s
7094+
<a for=Document>origin</a>, then decrement <var>quota</var> by <var>otherNavigable</var>'s
7095+
<a>navigable container</a>'s <a>reserved deferred-fetch quota</a>.
70917096

7092-
<li><p>If <var>quota</var> is less than <var>quotaForOrigin</var>, then
7093-
return <var>quota</var>.
7097+
<p class=note>Account for quota granted to child documents.
7098+
</ol>
70947099

7100+
<li><p>If <var>quota</var> is less than 0, then return 0.
7101+
<li><p>If <var>quota</var> is less than <var>quotaForOrigin</var>, then return <var>quota</var>.
70957102
<li><p>Return <var>quotaForOrigin</var>.
70967103
</ol>
70977104
</div>
@@ -7116,8 +7123,8 @@ shared.
71167123
for "{{PermissionsPolicy/deferred-fetch}}", <var>container</var> and <var>originToNavigateTo</var>
71177124
is <code>Enabled</code>, and the <a>available deferred-fetch quota</a> for
71187125
<var>container</var>'s <a>container document</a> is equal or greater than
7119-
<a for="reserved deferred-fetch quota">normal</a>, then set <var>container</var>'s
7120-
<a>reserved deferred-fetch quota</a> to <a for="reserved deferred-fetch quota">normal</a> and
7126+
<a for="reserved deferred-fetch quota">normal quota</a>, then set <var>container</var>'s
7127+
<a>reserved deferred-fetch quota</a> to <a for="reserved deferred-fetch quota">normal quota</a> and
71217128
return.
71227129

71237130
<li><p>If the <a data-lt="define an inherited policy for feature in container">inherited policy</a>
@@ -7133,11 +7140,11 @@ shared.
71337140
<a>node navigable</a>'s <a for=navigable>top-level traversable</a>'s
71347141
<a>descendant navigables</a>, <a for=list data-lt=remove>removing</a> any <a for=/>navigable</a>
71357142
whose <a>reserved deferred-fetch quota</a> is not
7136-
<a for="reserved deferred-fetch quota">minimal</a> .
7143+
<a for="reserved deferred-fetch quota">minimal quota</a> .
71377144

71387145
<li><p>If <var>containersWithReservedMinimalQuota</var>'s <a for=list>size</a> is less
71397146
than <a>max containers with minimal quota</a>, then set <var>container</var>'s
7140-
<a>reserved deferred-fetch quota</a> to <a for="reserved deferred-fetch quota">minimal</a>.
7147+
<a>reserved deferred-fetch quota</a> to <a for="reserved deferred-fetch quota">minimal quota</a>.
71417148
</ol>
71427149
</div>
71437150

0 commit comments

Comments
 (0)