Skip to content

Commit

Permalink
Integrate Priority Hints
Browse files Browse the repository at this point in the history
- Renames the request priority concept to internal priority and "adds" priority for usage by APIs.
- Adds a new priority member to RequestInit for specifying a priority hint.

These changes combined with whatwg/html#8470 obsolete the Priority Hints specification: https://wicg.github.io/priority-hints/.

Tests: https://chromium-review.googlesource.com/c/chromium/src/+/4097472.

Fixes #1319.

Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
  • Loading branch information
pmeenan and annevk authored Dec 15, 2022
1 parent 897c560 commit 06a38bc
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,12 @@ not always relevant and might require different behavior.
<hr>

<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-request-priority>priority</dfn> (null or a
user-agent-defined object). Unless otherwise stated it is null.
<dfn export for=request>priority</dfn>, which is "<code>high</code>", "<code>low</code>", or
"<code>auto</code>". Unless stated otherwise it is "<code>auto</code>".

<p>A <a for=/>request</a> has an associated
<dfn export for=request oldids=concept-request-priority>internal priority</dfn> (null or an
<a>implementation-defined</a> object). Unless otherwise stated it is null.

<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-request-origin>origin</dfn>, which is
Expand Down Expand Up @@ -4281,13 +4285,16 @@ the request.
<a for=/>header value</a>) to <var>request</var>'s <a for=request>header list</a>.

<li>
<p>If <var>request</var>'s <a for=request>priority</a> is null, then use <var>request</var>'s
<a for=request>initiator</a>, <a for=request>destination</a>, and
<a for=request>render-blocking</a> appropriately in setting <var>request</var>'s
<a for=request>priority</a> to a user-agent-defined object.
<p>If <var>request</var>'s <a for=request>internal priority</a> is null, then use
<var>request</var>'s <a for=request>priority</a>, <a for=request>initiator</a>,
<a for=request>destination</a>, and <a for=request>render-blocking</a> in an
<a>implementation-defined</a> manner to set <var>request</var>'s
<a for=request>internal priority</a> to an <a>implementation-defined</a> object.

<p class=note>The user-agent-defined object could encompass stream weight and dependency for
HTTP/2, and equivalent information used to prioritize dispatch and processing of HTTP/1 fetches.
<p class=note>The <a>implementation-defined</a> object could encompass stream weight and
dependency for HTTP/2, priorities used in <cite>Extensible Prioritization Scheme for HTTP</cite>
for transports where it applies (including HTTP/3), and equivalent information used to prioritize
dispatch and processing of HTTP/1 fetches. [[!RFC9218]]

<li>
<p>If <var>request</var> is a <a>subresource request</a>, then:
Expand Down Expand Up @@ -7043,6 +7050,7 @@ dictionary RequestInit {
boolean keepalive;
AbortSignal? signal;
RequestDuplex duplex;
RequestPriority priority;
any window; // can only be set to null
};

Expand All @@ -7052,6 +7060,7 @@ enum RequestCredentials { "omit", "same-origin", "include" };
enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
enum RequestRedirect { "follow", "error", "manual" };
enum RequestDuplex { "half" };
enum RequestPriority { "high", "low", "auto" };
</pre>

<p class="note no-backref">"<code>serviceworker</code>" is omitted from
Expand Down Expand Up @@ -7149,6 +7158,9 @@ object), initially null.
set when {{RequestInit/body}} is a {{ReadableStream}} object. <span class=note>See
<a href="https://github.com/whatwg/fetch/issues/1254">issue #1254</a> for defining
"<code>full</code>".</span>

<dt>{{RequestInit/priority}}
<dd>A string to set <var>request</var>'s <a for=request>priority</a>.
</dl>

<dt><code><var>request</var> . <a attribute for=Request>method</a></code>
Expand Down Expand Up @@ -7333,8 +7345,8 @@ constructor steps are:
<dt><a for=request>window</a>
<dd><var>window</var>.

<dt><a for=request>priority</a>
<dd><var>request</var>'s <a for=request>priority</a>.
<dt><a for=request>internal priority</a>
<dd><var>request</var>'s <a for=request>internal priority</a>.

<dt><a for=request>origin</a>
<dd><var>request</var>'s <a for=request>origin</a>. <span class=note>The propagation of the
Expand Down Expand Up @@ -7497,6 +7509,18 @@ constructor steps are:
<li><p>If <var>init</var>["{{RequestInit/signal}}"] <a for=map>exists</a>, then set
<var>signal</var> to it.

<li>
<p>If <var>init</var>["{{RequestInit/priority}}"] <a for=map>exists</a>, then:

<ol>
<li><p>If <var>request</var>'s <a for=request>internal priority</a> is not null, then update
<var>request</var>'s <a for=request>internal priority</a> in an <a>implementation-defined</a>
manner.

<li><p>Otherwise, set <var>request</var>'s <a for=request>priority</a> to
<var>init</var>["{{RequestInit/priority}}"].
</ol>

<li><p>Set <a>this</a>'s <a for=Request>request</a> to <var>request</var>.

<li><p>Set <a>this</a>'s <a for=Request>signal</a> to a <a for=/>new</a> {{AbortSignal}} object
Expand Down Expand Up @@ -8579,6 +8603,7 @@ Odin Hørthe Omdal,
Olli Pettay,
Ondřej Žára,
O. Opsec,
Patrick Meenan,
Perry Jiang<!-- perryjiang; Github -->,
Philip Jägenstedt,
R. Auburn,
Expand Down

0 comments on commit 06a38bc

Please sign in to comment.