Re: [whatwg/fetch] Add a speculative flag to `Request` as well as related processing (#881)

yoavweiss commented on this pull request.

Thanks for reviewing! :)

> @@ -4072,6 +4076,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

Sure. I'll lowercase

> @@ -5628,6 +5638,7 @@ interface Request {
   readonly attribute RequestRedirect redirect;
   readonly attribute DOMString integrity;
   readonly attribute boolean keepalive;
+  readonly attribute boolean speculative;

Yeah, that's the current intention. Even though `prefetch` is destined for the next navigation, the current renderer can still get the response (e.g. `onload` fires for it).

> @@ -5787,6 +5798,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

I guess it would be better if the promise got rejected in those cases. That would probably require adding a step to https://fetch.spec.whatwg.org/#concept-fetch which actually does that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/881#pullrequestreview-217142770

Received on Thursday, 21 March 2019 09:55:12 UTC