-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a speculative flag to Request
as well as related processing
#881
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1077,6 +1077,9 @@ explicitly set <a for=/>request</a>'s | |
<p id=keep-alive-flag>A <a for=/>request</a> has an associated | ||
<dfn for=request export>keepalive flag</dfn>. Unless stated otherwise it is unset. | ||
|
||
<p id=speculative-flag>A <a for=/>request</a> has an associated | ||
<dfn for=request export>speculative flag</dfn>. Unless stated otherwise it is unset. | ||
|
||
<p class="note no-backref">This can be used to allow the request to outlive the | ||
<a>environment settings object</a>, e.g., | ||
<code>navigator.sendBeacon</code> and the HTML <code>img</code> element set this flag. Requests with | ||
|
@@ -1947,8 +1950,8 @@ functionality. | |
<p>When a <a for=fetch>fetch group</a> is | ||
<dfn export for="fetch group" id=concept-fetch-group-terminate>terminated</dfn>, | ||
for each associated <a for="fetch group">fetch record</a> whose | ||
<a for="fetch record">request</a>'s <a>done flag</a> or | ||
<a>keepalive flag</a> is unset, | ||
<a for="fetch record">request</a>'s <a>done flag</a>, | ||
<a>keepalive flag</a>, and <a>speculative flag</a> are all unset, | ||
<a lt=terminated for=fetch>terminate</a> the | ||
<a for="fetch group">fetch record</a>'s | ||
<a for="fetch record">fetch</a>. | ||
|
@@ -3101,6 +3104,11 @@ the request. | |
<a for=request>origin</a> to <var>request</var>'s | ||
<a for=request>client</a>'s <a for="environment settings object">origin</a>. | ||
|
||
<li><p>If a <var>request</var>'s <a for=request>speculative flag</a> is set, then the user agent | ||
may <a for=fetch lt=terminated>terminate</a> the <a for=/>fetch</a> and return an <a>aborted | ||
network error</a>, in cases where it's reasonable to believe it will result in better user | ||
experience. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @annevk I wasn't sure what to write here, so started by writing something. It feels a bit fuzzy to be part of the processing model, so advice on making it better would be appreciated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How concrete is it in the implementation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently I'm not aware of implementations that do that at the moment. When discussing whatwg/html#4115 @youennf wanted to give UAs the concrete possibility to do so, while staying conformant. |
||
<li> | ||
<p>If <var>request</var>'s <a for=request>header list</a> | ||
<a for="header list">does not contain</a> `<code>Accept</code>`, then: | ||
|
@@ -3138,8 +3146,9 @@ the request. | |
|
||
<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> and <a for=request>destination</a> appropriately in setting | ||
<var>request</var>'s <a for=request>priority</a> to a user-agent-defined object. | ||
<a for=request>initiator</a>, <a for=request>destination</a>, and <a for=request>speculative | ||
flag</a> appropriately in setting <var>request</var>'s <a for=request>priority</a> to a | ||
user-agent-defined 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 | ||
|
@@ -4072,6 +4081,12 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b | |
|
||
<p>is true, and unset otherwise. | ||
|
||
<li><p>If <var>httpRequest</var>'s <a for=request>speculative flag</a> is set, | ||
<a for="header list">append</a> | ||
`<code>Sec-Purpose</code>`/`<code>prefetch</code>` to | ||
<var>httpRequest</var>'s | ||
<a for=request>header list</a>. | ||
|
||
<li><p>Let <var>contentLengthValue</var> be null. | ||
|
||
<li><p>If <var>httpRequest</var>'s <a for=request>body</a> is null and | ||
|
@@ -5628,6 +5643,7 @@ interface Request { | |
readonly attribute RequestRedirect redirect; | ||
readonly attribute DOMString integrity; | ||
readonly attribute boolean keepalive; | ||
readonly attribute boolean speculative; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would only result in setting the header? You'd still get the response and such? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's the current intention. Even though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, but this adds it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it'd be needed to make those headers survive SWs (although that may vary based on where #880 ends up) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this would also allow creation. Surviving SW should happen based on copying private state I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^That sounds right to me. This is similar to the idea that |
||
readonly attribute boolean isReloadNavigation; | ||
readonly attribute boolean isHistoryNavigation; | ||
readonly attribute AbortSignal signal; | ||
|
@@ -5787,6 +5803,11 @@ initially a new {{AbortSignal}} object. | |
<dd>Returns a boolean indicating whether or not <var>request</var> can outlive the global in which | ||
it was created. | ||
|
||
<dt><code><var>request</var> . <a attribute for=Request>speculative</a></code> | ||
<dd>Returns a boolean indicating whether or not <var>request</var> is a speculative fetch, which | ||
means it could be ignored by the user agent, have low priority, and can outlive the global in which | ||
yoavweiss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
it was created. | ||
|
||
<dt><code><var>request</var> . <a attribute for=Request>isReloadNavigation</a></code> | ||
<dd>Returns a boolean indicating whether or not <var>request</var> is for a reload navigation. | ||
|
||
|
@@ -5918,6 +5939,9 @@ constructor must run these steps: | |
<dt><a>keepalive flag</a> | ||
<dd><var>request</var>'s <a>keepalive flag</a>. | ||
|
||
<dt><a>speculative flag</a> | ||
<dd><var>request</var>'s <a>speculative flag</a>. | ||
|
||
<dt><a for=request>reload-navigation flag</a> | ||
<dd><var>request</var>'s <a for=request>reload-navigation flag</a>. | ||
|
||
|
@@ -6210,6 +6234,10 @@ must return the <a>context object</a>'s <a for=Request>request</a>'s | |
must return true if the <a>context object</a>'s <a for=Request>request</a>'s <a>keepalive flag</a> | ||
is set, and false otherwise. | ||
|
||
<p>The <dfn attribute for=Request><code>speculative</code></dfn> attribute's getter, when invoked, | ||
must return true if the <a>context object</a>'s <a for=Request>request</a>'s <a>speculative flag</a> | ||
is set, and false otherwise. | ||
|
||
<p>The <dfn attribute for=Request><code>isReloadNavigation</code></dfn> attribute's getter, when | ||
invoked, must return true if the <a>context object</a>'s <a for=Request>request</a>'s | ||
<a for=request>reload-navigation flag</a> is set, and false otherwise. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this should be a boolean, as I think we're leaning more towards explicit booleans as opposed to "flags"s these days?