Skip to content

Commit 8023bd0

Browse files
noamrdomenic
andauthored
Use controller for navigation redirect
Remove the existing "navigate-redirect fetch" algorithm. Instead, the caller uses the controller to perform the next manual redirect. This simplifies the flow in the HTML Standard flow, as now there is a single "fetch params" struct for the course of the entire navigation. Up until now some data from fetch params would be lost, like timing info and task desination, because navigation fetches create a brand new "fetch params" struct. Now that data is retained, and the only thing that HTML needs to do is call "process the next redirect" on the fetch controller. Co-authored-by: Domenic Denicola <[email protected]>
1 parent a18fb3e commit 8023bd0

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

fetch.bs

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
238238

239239
<dt><dfn for="fetch controller">serialized abort reason</dfn> (default null)
240240
<dd>Null or a <a>Record</a> (result of [$StructuredSerialize$]).
241+
242+
<dt><dfn for="fetch controller">next manual redirect steps</dfn> (default null)
243+
<dd>Null or an algorithm accepting nothing.
241244
</dl>
242245

243246
<p>To <dfn export for="fetch controller" id="finalize-and-report-timing">report timing</dfn> for a
@@ -250,6 +253,16 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
250253
<li><p>Call <a>this</a>'s <a for="fetch controller">report timing steps</a> with <var>global</var>.
251254
</ol>
252255

256+
<p>To <dfn export for="fetch controller">process the next manual redirect</dfn> for a
257+
<a>fetch controller</a> <var>controller</var>:
258+
259+
<ol>
260+
<li><p><a for=/>Assert</a>: <var>controller</var>'s
261+
<a for="fetch controller">next manual redirect steps</a> are not null.
262+
263+
<li><p>Call <var>controller</var>'s <a for="fetch controller">next manual redirect steps</a>.
264+
</ol>
265+
253266
<p>To <dfn export for="fetch controller" id="extract-full-timing-info">extract full timing info</a>
254267
given a <a>fetch controller</a> <var>controller</var>:
255268
@@ -4834,7 +4847,11 @@ these steps:
48344847

48354848
<dt>"<code>manual</code>"
48364849
<dd><p>Set <var>response</var> to an <a>opaque-redirect filtered response</a> whose
4837-
<a for="filtered response">internal response</a> is <var>actualResponse</var>.
4850+
<a for="filtered response">internal response</a> is <var>actualResponse</var>. If
4851+
<var>request</var>'s <a for=request>mode</a> is "<code>navigate</code>", then set
4852+
<var>fetchParams</var>'s <a for="fetch params">controller</a>'s <a
4853+
for="fetch controller">next manual redirect steps</a> to run <a>HTTP-redirect fetch</a> given
4854+
<var>fetchParams</var> and <var>response</var>.
48384855

48394856
<dt>"<code>follow</code>"
48404857
<dd><p>Set <var>response</var> to the result of running <a>HTTP-redirect fetch</a> given
@@ -4948,26 +4965,6 @@ run these steps:
49484965
</ol>
49494966

49504967

4951-
<h3 id=navigate-redirect-fetch>Navigate-redirect fetch</h3>
4952-
4953-
<p class=note>This algorithm is used by <cite>HTML</cite>'s navigate algorithm. It is expected to be
4954-
invoked while <a>in parallel</a>. [[!HTML]]
4955-
4956-
<p>To <dfn export id=concept-navigate-redirect-fetch>navigate-redirect fetch</dfn>, given a
4957-
<a for=/>request</a> <var>request</var> and <a for=/>response</a> <var>response</var>, run these
4958-
steps. They return a <a for=/>response</a>.
4959-
4960-
<ol>
4961-
<li><p>Assert: <var>request</var>'s <a for=request>redirect mode</a> is "<code>manual</code>".
4962-
4963-
<li><p>Let <var>fetchParams</var> be a new <a for=/>fetch params</a> whose
4964-
<a for="fetch params">request</a> is <var>request</var>.
4965-
4966-
<li><p>Return the result of running <a>HTTP-redirect fetch</a> given <var>fetchParams</var> and
4967-
<var>response</var>.
4968-
</ol>
4969-
4970-
49714968
<h3 id=http-network-or-cache-fetch>HTTP-network-or-cache fetch</h3>
49724969

49734970
<p>To <dfn id=concept-http-network-or-cache-fetch>HTTP-network-or-cache fetch</dfn>, given a
@@ -8321,10 +8318,19 @@ in a <a for=/>parallel queue</a> if <a for=fetch><i>useParallelQueue</i></a> is
83218318
<cite>HTML</cite>. [[HTML]]
83228319

83238320
<dt><a for=fetch><i>processResponse</i></a>
8324-
<dd><p>Takes an algorithm that will be passed a <a for=/>response</a>. Indicates
8325-
<a for=/>response</a>'s <a for=response>header list</a> has been received and initialized. This
8326-
is primarily useful for standards that want to operate on <a for=/>response</a>'s
8327-
<a for=response>body</a>'s <a for=body>stream</a> directly.
8321+
<dd>
8322+
<p>Takes an algorithm that will be passed a <a for=/>response</a>. Indicates
8323+
<a for=/>response</a>'s <a for=response>header list</a> has been received and initialized. This
8324+
is primarily useful for standards that want to operate on <a for=/>response</a>'s
8325+
<a for=response>body</a>'s <a for=body>stream</a> directly.
8326+
8327+
<p>If the <a for=/>request</a>'s <a for=request>mode</a> is "<code>navigate</code>" and its
8328+
<a for=request>redirect mode</a> is "<code>manual</code>", then callers need to follow a very
8329+
specific flow with this algorithm to get the intended behavior. They should compute the
8330+
appropriate <a for=response>location URL</a>, and if it is not null or a failure, then they
8331+
should call <a for="fetch controller">process the next manual redirect</a>. This will result in
8332+
<a for=fetch><i>processResponse</i></a> being called again, with the next <a for=/>response</a>
8333+
in the redirect chain.
83288334

83298335
<dt><a for=fetch><i>processResponseEndOfBody</i></a>
83308336
<dd><p>Takes an algorithm that will be passed a <a for=/>response</a>. Indicates the network is

0 commit comments

Comments
 (0)