Skip to content

Commit e2eaac4

Browse files
committed
Handle service worker errors and update the fallback algorithm
1 parent ffb1105 commit e2eaac4

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

fetch.bs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,26 +3300,22 @@ steps:
33003300

33013301
<h4 id=https-upgrades-fallback>Fallback algorithm</h4>
33023302

3303-
<p>Runs after the Upgrade algorithm. This algorithm determines whether the upgraded
3304-
request completed without a network error. If not, it retries the request over <code>"http"</code>.
3305-
3306-
To <dfn>handle an HTTPS upgrade fallback</dfn> given a <a for=/>request</a> <var>request</var>, run
3307-
these steps:
3303+
To <dfn>HTTPS upgrade fallback</dfn> given a <a for=/>request</a>
3304+
<var>request</var> and <a for=/>response</a> <var>response</var>, run these steps:
33083305

33093306
<ol>
3310-
<li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, return without
3311-
modifying request.
3312-
3313-
<li><p>Otherwise, this is an upgraded request. Let <var>upgradedResponse</var> be the result of
3314-
fetching the upgraded request.
3307+
<li><p>If <var>request</var>'s <code>https-upgrade</code> flag is not set, the <var>request</var>
3308+
was not upgraded. Return <var>response</var>.
33153309

33163310
<li>
3317-
<p>If <var>upgradedResponse</var> is a network error, initiate a fallback load by creating a
3318-
synthetic redirect response <var>fallbackResponse</var> that redirects to <var>request</var>'s
3319-
<code>https-upgrade-fallback-url</code> flag with status 307. Return
3320-
<var>fallbackResponse</var>.
3311+
<p>Otherwise, the request was upgraded.
3312+
3313+
<p>If <var>response</var> is a network error, the upgrade failed. Initiate a fallback
3314+
load by creating a synthetic redirect response <var>fallbackResponse</var> that redirects to
3315+
<var>request</var>'s <code>https-upgrade-fallback-url</code> flag with status 307.
3316+
Return <var>fallbackResponse</var>.
33213317

3322-
<li><p>Otherwise, the upgrade was successful. Return <var>upgradedResponse</var>.
3318+
<li><p>Otherwise, the upgrade was successful. Return <var>response</var>.
33233319
</ol>
33243320

33253321
<p class=note>
@@ -5266,7 +5262,8 @@ these steps:
52665262
<var>response</var>'s <a for=response>URL list</a> has more than one item.
52675263
</ul>
52685264

5269-
<p>then return a <a>network error</a>.
5265+
<p>then return the result of running <a>HTTPS upgrade fallback</a> given <var>request</var>
5266+
and a <a>network error</a>.
52705267
</ol>
52715268
</ol>
52725269

@@ -5333,14 +5330,16 @@ these steps:
53335330
<a>cross-origin resource policy check</a> with <var>request</var>'s <a for=request>origin</a>,
53345331
<var>request</var>'s <a for=request>client</a>, <var>request</var>'s
53355332
<a for=request>destination</a>, and <var>internalResponse</var> returns <b>blocked</b>, then
5336-
return a <a>network error</a>.
5333+
return the result of running <a>HTTPS upgrade fallback</a> given <var>request</var>
5334+
and a <a>network error</a>.
53375335

53385336
<p class=note>The <a>cross-origin resource policy check</a> runs for responses coming from the
53395337
network and responses coming from the service worker. This is different from the
53405338
<a>CORS check</a>, as <var>request</var>'s <a for=request>client</a> and the service worker can
53415339
have different embedder policies.
53425340

5343-
<li><p>Run <a>handle an HTTPS upgrade fallback</a> algorithm on <var>request</var>, if appropriate.</a>
5341+
<li>Set <var>response</var> and <var>internalResponse</var> to the result of running
5342+
<a>HTTPS upgrade fallback</a> given <var>request</var> and <var>response</var>.
53445343

53455344
<li>
53465345
<p>If <var>internalResponse</var>'s <a for=response>status</a> is a <a>redirect status</a>:

0 commit comments

Comments
 (0)