Skip to content

Commit

Permalink
Introduce fetch registries so when a document/worker dies, fetches ge…
Browse files Browse the repository at this point in the history
…t terminated. (Except those fetches that need to outlive the document/worker.)

This fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=23878
  • Loading branch information
annevk committed Jun 11, 2015
1 parent 1d8173a commit 744d8b3
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 21 deletions.
85 changes: 74 additions & 11 deletions Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ <h2 class="no-num no-toc" id="table-of-contents">Table of Contents</h2>
<li><a href="#bodies"><span class="secno">2.1.3 </span>Bodies</a></li>
<li><a href="#requests"><span class="secno">2.1.4 </span>Requests</a></li>
<li><a href="#responses"><span class="secno">2.1.5 </span>Responses</a></ul></li>
<li><a href="#authentication-entries"><span class="secno">2.2 </span>Authentication entries</a></ul></li>
<li><a href="#authentication-entries"><span class="secno">2.2 </span>Authentication entries</a></li>
<li><a href="#fetch-registries"><span class="secno">2.3 </span>Fetch registries</a></ul></li>
<li><a href="#http-extensions"><span class="secno">3 </span>HTTP extensions</a>
<ul class="toc">
<li><a href="#origin-header"><span class="secno">3.1 </span>`<code title="">Origin</code>` header</a></li>
Expand Down Expand Up @@ -184,6 +185,16 @@ <h2 id="infrastructure"><span class="secno">2 </span>Infrastructure</h2>
<a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a>.
</ol>

<p>To <dfn id="queue-a-fetch-done-task">queue a fetch done task</dfn> given a <var title="">request</var> and
<var title="">response</var>, run these steps:

<ol>
<li><p>Set <var title="">request</var>'s <a href="#done-flag">done flag</a>.

<li><p><a href="#queue-a-fetch-task">Queue a fetch task</a> on <var title="">request</var> to
<dfn id="process-response-end-of-file">process response end-of-file</dfn> for <var title="">response</var>.
</ol>


<h3 id="http"><span class="secno">2.1 </span>HTTP</h3>

Expand Down Expand Up @@ -468,6 +479,13 @@ <h4 id="requests"><span class="secno">2.1.4 </span>Requests</h4>
null when <a class="external" href="https://html.spec.whatwg.org/multipage/browsers.html#navigate" title="navigate">navigating</a>, service worker
script updates, etc.</span>

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated
<dfn id="keep-alive-flag">keep-alive flag</dfn>. Unless stated otherwise it is unset.

<p class="note no-backref">This is used by <code>navigator.sendBeacon</code> and the HTML
<code>img</code> element to outlive the
<a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object">environment settings object</a>.

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated
<dfn id="skip-service-worker-flag">skip service worker flag</dfn>. Unless stated otherwise it is unset.

Expand Down Expand Up @@ -827,12 +845,16 @@ <h4 id="requests"><span class="secno">2.1.4 </span>Requests</h4>
"<code title="">basic</code>", "<code title="">cors</code>", and "<code title="">opaque</code>".
Unless stated otherwise, it is "<code title="">basic</code>".

<p>A <a href="#concept-request" title="concept-request">request</a> has an associated <dfn id="done-flag">done flag</dfn>.
Unless stated otherwise, it is unset.

<p class="note no-backref">A <a href="#concept-request" title="concept-request">request</a>'s
<a href="#concept-request-url-list" title="concept-request-url-list">url list</a>,
<a href="#concept-request-current-url" title="concept-request-current-url">current url</a>,
<a href="#concept-request-redirect-count" title="concept-request-redirect-count">redirect count</a>, and
<a href="#concept-request-response-tainting" title="concept-request-response-tainting">response tainting</a> are used as
bookkeeping details by the <a href="#concept-fetch" title="concept-fetch">fetch</a> algorithm.
<a href="#concept-request-redirect-count" title="concept-request-redirect-count">redirect count</a>,
<a href="#concept-request-response-tainting" title="concept-request-response-tainting">response tainting</a>, and
<a href="#done-flag">done flag</a> are used as bookkeeping details by the
<a href="#concept-fetch" title="concept-fetch">fetch</a> algorithm.

<hr>

Expand Down Expand Up @@ -1038,6 +1060,34 @@ <h3 id="authentication-entries"><span class="secno">2.2 </span>Authentication en
<a href="#refsHTTPAUTH">[HTTPAUTH]</a>


<h3 id="fetch-registries"><span class="secno">2.3 </span>Fetch registries</h3>

<p>Each <a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object">environment settings object</a> has an associated
<dfn id="concept-fetch-registry" title="concept-fetch-registry">fetch registry</dfn>.

<p>A <a href="#concept-fetch-registry" title="concept-fetch-registry">fetch registry</a> holds an ordered list of
<dfn id="concept-fetch-record" title="concept-fetch-record">fetch records</dfn>.

<p>A <a href="#concept-fetch-record" title="concept-fetch-record">fetch record</a> has an associated
<dfn id="concept-fetch-record-request" title="concept-fetch-record-request">request</dfn> (a
<a href="#concept-request" title="concept-request">request</a>).

<p>A <a href="#concept-fetch-record" title="concept-fetch-record">fetch record</a> has an associated
<dfn id="concept-fetch-record-fetch" title="concept-fetch-record-fetch">fetch</dfn> (a
<a href="#concept-fetch" title="concept-fetch">fetch</a> algorithm or null).

<hr>

<p>When a <a href="#concept-fetch-registry" title="concept-fetch-registry">fetch registry</a> is
<dfn id="concept-fetch-registry-terminate" title="concept-fetch-registry-terminate">terminated</dfn>, for each associated
<a href="#concept-fetch-record" title="concept-fetch-record">fetch record</a> whose
<span title="concept-request-record-request">request</span>'s <a href="#done-flag">done flag</a> or
<a href="#keep-alive-flag">keep-alive flag</a> is unset,
<a href="#concept-fetch-terminate" title="concept-fetch-terminate">terminate</a> the
<a href="#concept-fetch-record" title="concept-fetch-record">fetch record</a>'s
<a href="#concept-fetch-record-fetch" title="concept-fetch-record-fetch">fetch</a> with reason <i title="">fatal</i>.



<h2 id="http-extensions"><span class="secno">3 </span>HTTP extensions</h2>

Expand Down Expand Up @@ -1357,6 +1407,22 @@ <h2 id="fetching"><span class="secno">4 </span>Fetching</h2>
for HTTP/2, and equivalent information used to prioritize dispatch and processing of
HTTP/1 fetches.

<li>
<p>If <var title="">request</var>'s <a href="#concept-request-client" title="concept-request-client">client</a> is
non-null, run these substeps:

<ol>
<li><p>Let <var title="">record</var> be a new
<a href="#concept-fetch-record" title="concept-fetch-record">fetch record</a> consisting of
<var title="">request</var> and this instance of the
<a href="#concept-fetch" title="concept-fetch">fetch</a> algorithm.

<li><p>Append <var title="">record</var> to <var title="">request</var>'s
<a href="#concept-request-client" title="concept-request-client">client</a>'s
<a href="#concept-fetch-registry" title="concept-fetch-registry">fetch registry</a> list of
<a href="#concept-fetch-record" title="concept-fetch-record">fetch records</a>.
</ol>

<li><p>Return the result of performing a <a href="#concept-main-fetch" title="concept-main-fetch">main fetch</a>
using <var title="">request</var>.
</ol>
Expand Down Expand Up @@ -1565,8 +1631,8 @@ <h3 id="main-fetch"><span class="secno">4.1 </span>Main fetch</h3>
<li><a href="#queue-a-fetch-task">Queue a fetch task</a> on <var title="">request</var> to
<dfn id="process-response-body">process response body</dfn> for <var title="">response</var>.

<li><p><a href="#queue-a-fetch-task">Queue a fetch task</a> on <var title="">request</var> to
<dfn id="process-response-end-of-file">process response end-of-file</dfn> for <var title="">response</var>.
<li><p><a href="#queue-a-fetch-done-task">Queue a fetch done task</a> using <var title="">request</var> and
<var title="">response</var>.
</ol>

<li>
Expand All @@ -1586,15 +1652,12 @@ <h3 id="main-fetch"><span class="secno">4.1 </span>Main fetch</h3>
<p>Once end-of-file has been pushed to <var title="">response</var>'s
<a href="#concept-response-body" title="concept-response-body">body</a> or <var title="">response</var> has a
<a href="#concept-response-termination-reason" title="concept-response-termination-reason">termination reason</a>,
<a href="#queue-a-fetch-task">queue a fetch task</a> on <var title="">request</var> to
<a href="#process-response-end-of-file">process response end-of-file</a> for <var title="">response</var>.
<a href="#queue-a-fetch-done-task">queue a fetch done task</a> using <var title="">request</var> and
<var title="">response</var>.

<p class="note">Ideally FTP/HTTP define this in more detail and this becomes a set of
simple hooks.
</ol>

<p>Use the <a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> for these
<a class="external" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task" title="concept-task">tasks</a>.
</ol>


Expand Down
82 changes: 72 additions & 10 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ <h2>Infrastructure</h2>
<span data-anolis-spec=html>networking task source</span>.
</ol>

<p>To <dfn>queue a fetch done task</dfn> given a <var title>request</var> and
<var title>response</var>, run these steps:

<ol>
<li><p>Set <var title>request</var>'s <span>done flag</span>.

<li><p><span>Queue a fetch task</span> on <var title>request</var> to
<dfn>process response end-of-file</dfn> for <var title>response</var>.
</ol>


<h3>HTTP</h3>

Expand Down Expand Up @@ -417,6 +427,13 @@ <h4>Requests</h4>
null when <span data-anolis-spec=html title=navigate>navigating</span>, service worker
script updates, etc.</span>

<p>A <span title=concept-request>request</span> has an associated
<dfn>keep-alive flag</dfn>. Unless stated otherwise it is unset.

<p class="note no-backref">This is used by <code>navigator.sendBeacon</code> and the HTML
<code>img</code> element to outlive the
<span data-anolis-spec=html>environment settings object</span>.

<p>A <span title=concept-request>request</span> has an associated
<dfn>skip service worker flag</dfn>. Unless stated otherwise it is unset.

Expand Down Expand Up @@ -776,12 +793,16 @@ <h4>Requests</h4>
"<code title>basic</code>", "<code title>cors</code>", and "<code title>opaque</code>".
Unless stated otherwise, it is "<code title>basic</code>".

<p>A <span title=concept-request>request</span> has an associated <dfn>done flag</dfn>.
Unless stated otherwise, it is unset.

<p class="note no-backref">A <span title=concept-request>request</span>'s
<span title=concept-request-url-list>url list</span>,
<span title=concept-request-current-url>current url</span>,
<span title=concept-request-redirect-count>redirect count</span>, and
<span title=concept-request-response-tainting>response tainting</span> are used as
bookkeeping details by the <span title=concept-fetch>fetch</span> algorithm.
<span title=concept-request-redirect-count>redirect count</span>,
<span title=concept-request-response-tainting>response tainting</span>, and
<span>done flag</span> are used as bookkeeping details by the
<span title=concept-fetch>fetch</span> algorithm.

<hr>

Expand Down Expand Up @@ -987,6 +1008,34 @@ <h3>Authentication entries</h3>
<span data-anolis-ref>HTTPAUTH</span>


<h3>Fetch registries</h3>

<p>Each <span data-anolis-spec=html>environment settings object</span> has an associated
<dfn title=concept-fetch-registry>fetch registry</dfn>.

<p>A <span title=concept-fetch-registry>fetch registry</span> holds an ordered list of
<dfn title=concept-fetch-record>fetch records</dfn>.

<p>A <span title=concept-fetch-record>fetch record</span> has an associated
<dfn title=concept-fetch-record-request>request</dfn> (a
<span title=concept-request>request</span>).

<p>A <span title=concept-fetch-record>fetch record</span> has an associated
<dfn title=concept-fetch-record-fetch>fetch</dfn> (a
<span title=concept-fetch>fetch</span> algorithm or null).

<hr>

<p>When a <span title=concept-fetch-registry>fetch registry</span> is
<dfn title=concept-fetch-registry-terminate>terminated</dfn>, for each associated
<span title=concept-fetch-record>fetch record</span> whose
<span title=concept-request-record-request>request</span>'s <span>done flag</span> or
<span>keep-alive flag</span> is unset,
<span title=concept-fetch-terminate>terminate</span> the
<span title=concept-fetch-record>fetch record</span>'s
<span title=concept-fetch-record-fetch>fetch</span> with reason <i title>fatal</i>.



<h2>HTTP extensions</h2>

Expand Down Expand Up @@ -1306,6 +1355,22 @@ <h2>Fetching</h2>
for HTTP/2, and equivalent information used to prioritize dispatch and processing of
HTTP/1 fetches.

<li>
<p>If <var title>request</var>'s <span title=concept-request-client>client</span> is
non-null, run these substeps:

<ol>
<li><p>Let <var title>record</var> be a new
<span title=concept-fetch-record>fetch record</span> consisting of
<var title>request</var> and this instance of the
<span title=concept-fetch>fetch</span> algorithm.

<li><p>Append <var title>record</var> to <var title>request</var>'s
<span title=concept-request-client>client</span>'s
<span title=concept-fetch-registry>fetch registry</span> list of
<span title=concept-fetch-record>fetch records</span>.
</ol>

<li><p>Return the result of performing a <span title=concept-main-fetch>main fetch</span>
using <var title>request</var>.
</ol>
Expand Down Expand Up @@ -1514,8 +1579,8 @@ <h3>Main fetch</h3>
<li><span>Queue a fetch task</span> on <var title>request</var> to
<dfn>process response body</dfn> for <var title>response</var>.

<li><p><span>Queue a fetch task</span> on <var title>request</var> to
<dfn>process response end-of-file</dfn> for <var title>response</var>.
<li><p><span>Queue a fetch done task</span> using <var title>request</var> and
<var title>response</var>.
</ol>

<li>
Expand All @@ -1535,15 +1600,12 @@ <h3>Main fetch</h3>
<p>Once end-of-file has been pushed to <var title>response</var>'s
<span title=concept-response-body>body</span> or <var title>response</var> has a
<span title=concept-response-termination-reason>termination reason</span>,
<span>queue a fetch task</span> on <var title>request</var> to
<span>process response end-of-file</span> for <var title>response</var>.
<span>queue a fetch done task</span> using <var title>request</var> and
<var title>response</var>.

<p class=note>Ideally FTP/HTTP define this in more detail and this becomes a set of
simple hooks.
</ol>

<p>Use the <span data-anolis-spec=html>networking task source</span> for these
<span data-anolis-spec=html title=concept-task>tasks</span>.
</ol>


Expand Down

0 comments on commit 744d8b3

Please sign in to comment.