From 06a38bca2d514df42d751921ee70aabe570e1a6c Mon Sep 17 00:00:00 2001 From: Patrick Meenan Date: Thu, 15 Dec 2022 04:55:59 -0500 Subject: [PATCH] Integrate Priority Hints - 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 https://github.com/whatwg/html/pull/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 --- fetch.bs | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/fetch.bs b/fetch.bs index 953fd975b..bdc1fcd76 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1848,8 +1848,12 @@ not always relevant and might require different behavior.

A request has an associated -priority (null or a -user-agent-defined object). Unless otherwise stated it is null. +priority, which is "high", "low", or +"auto". Unless stated otherwise it is "auto". + +

A request has an associated +internal priority (null or an +implementation-defined object). Unless otherwise stated it is null.

A request has an associated origin, which is @@ -4281,13 +4285,16 @@ the request. header value) to request's header list.

  • -

    If request's priority is null, then use request's - initiator, destination, and - render-blocking appropriately in setting request's - priority to a user-agent-defined object. +

    If request's internal priority is null, then use + request's priority, initiator, + destination, and render-blocking in an + implementation-defined manner to set request's + internal priority to an implementation-defined object. -

    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. +

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

  • If request is a subresource request, then: @@ -7043,6 +7050,7 @@ dictionary RequestInit { boolean keepalive; AbortSignal? signal; RequestDuplex duplex; + RequestPriority priority; any window; // can only be set to null }; @@ -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" };

    "serviceworker" is omitted from @@ -7149,6 +7158,9 @@ object), initially null. set when {{RequestInit/body}} is a {{ReadableStream}} object. See issue #1254 for defining "full". + +

    {{RequestInit/priority}} +
    A string to set request's priority.
    request . method @@ -7333,8 +7345,8 @@ constructor steps are:
    window
    window. -
    priority -
    request's priority. +
    internal priority +
    request's internal priority.
    origin
    request's origin. The propagation of the @@ -7497,6 +7509,18 @@ constructor steps are:
  • If init["{{RequestInit/signal}}"] exists, then set signal to it. +

  • +

    If init["{{RequestInit/priority}}"] exists, then: + +

      +
    1. If request's internal priority is not null, then update + request's internal priority in an implementation-defined + manner. + +

    2. Otherwise, set request's priority to + init["{{RequestInit/priority}}"]. +

    +
  • Set this's request to request.

  • Set this's signal to a new {{AbortSignal}} object @@ -8579,6 +8603,7 @@ Odin Hørthe Omdal, Olli Pettay, Ondřej Žára, O. Opsec, +Patrick Meenan, Perry Jiang, Philip Jägenstedt, R. Auburn,