Skip to content

Commit

Permalink
Make navigate's resource handling more explicit
Browse files Browse the repository at this point in the history
This in general integrates navigation with Fetch better, reusing Fetch's
infrastructure for network errors and for 401 handling. This also
removes the speculative 401 features that seem unlikely to ever
materialize.

This definitely requires more work to actually talk about responses
instead of resources, and to more clearly tie it to the "resource"
variable from earlier in the navigate algorithm, but since all those
interactions are still somewhat unclear this will have to do. See #1352
for plans in that direction.

Fixes #511.
  • Loading branch information
annevk authored and domenic committed Jun 1, 2016
1 parent a2bde18 commit 806bc62
Showing 1 changed file with 16 additions and 36 deletions.
52 changes: 16 additions & 36 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -81766,45 +81766,24 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
</li>

<li>
<p><i>Resource handling</i>: If the resource is a network error, then <span
data-x="navigate-ua-inline">display the inline content with an appropriate error shown to the
user</span> and with the newly created <code>Document</code> object's <span>origin</span> set to
a new <span data-x="concept-origin-opaque">opaque origin</span>.</p>

<p><i>Resource handling</i>: If the resource's out-of-band metadata (e.g. HTTP headers), not
counting any <span data-x="Content-Type">type information</span> (such as the Content-Type HTTP
header), requires some sort of processing that will not affect <var>browsingContext</var>, then
perform that processing and abort these steps.</p>

<div class="note">
<p>Such processing might be triggered by, amongst other things, the following:</p>
<ul class="brief">
<li>HTTP status codes (e.g. 204 No Content or 205 Reset Content)</li>
<li>Network errors (e.g. the network interface being unavailable)</li>
<li>Cryptographic protocol failures (e.g. an incorrect TLS certificate)</li>
<!-- Other schemes are handled earlier -->
<!-- Content-Disposition is handled below -->
<!-- Content-Type is handled in subsequent steps -->
<!-- ...and I can't think of any others. -->
</ul>
</div>

<p>Responses with HTTP `<code data-x="http-content-disposition">Content-Disposition</code>`
headers specifying the <code data-x="">attachment</code> disposition type must be handled
<span>as a download</span>.</p>

<!-- theoretically, HTTP 205 processing would occur here, resetting all forms with no other
effect. However, it seems nobody actually wants to use this ability, so requiring it here seems
like unnecessary work. -->

<p>HTTP 401 responses that do not include a challenge recognised by the user agent must be
processed as if they had no challenge, e.g. rendering the entity body as if the response had
been 200 OK.</p>
<p class="note">This is where the network errors defined and propagated by the WHATWG Fetch
standard, such as DNS or TLS errors, end up being displayed to users. <ref spec=FETCH></p>
</li>

<p>User agents may show the entity body of an HTTP 401 response even when the response does
include a recognised challenge, with the option to login being included in a non-modal fashion,
to enable the information provided by the server to be used by the user before authenticating.
Similarly, user agents should allow the user to authenticate (in a non-modal fashion) against
authentication challenges included in other responses such as HTTP 200 OK responses, effectively
allowing resources to present HTTP login forms without requiring their use.</p>
<li><p>If the resource's <span data-x="concept-response-status">status</span> is
<code data-x="">204</code> or <code data-x="">205</code>, then abort these steps.</p></li>
<!-- Theoretically, HTTP 205 processing would occur here, resetting all forms with no other
effect. However, it seems nobody actually wants to use this ability, so requiring it here
seems like unnecessary work. -->

</li>
<li><p>If the resource has an `<code
data-x="http-content-disposition">Content-Disposition</code>` header specifying the <code
data-x="">attachment</code> disposition type, then handle it <span>as a download</span>.</p></li>

<li><p>Let <var>type</var> be the <span data-x="Content-Type sniffing">computed type of
the resource</span>.</p></li>
Expand Down Expand Up @@ -118771,6 +118750,7 @@ INSERT INTERFACES HERE
Maik Merten,
Majid Valipour,
Malcolm Rowe,
Manish Goregaokar,
Manish Tripathi,
Marc Hoyois,
Marco Zehe,
Expand Down

0 comments on commit 806bc62

Please sign in to comment.