Skip to content

Commit

Permalink
Resource Timing integration
Browse files Browse the repository at this point in the history
When response is a network error or body is fully read, finalize and report the response.

Depends on whatwg/fetch#1185.

Also see w3c/resource-timing#261 and w3c/resource-timing#252.
  • Loading branch information
noamr authored Feb 11, 2022
1 parent 7647033 commit b4da01a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions xhr.bs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,10 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
</ol>
</ol>

<p>To <dfn>report timing</dfn> for an {{XMLHttpRequest}} object <var>xhr</var>,
<a for=/>finalize and report timing</a> with <var>xhr</var>'s <a for=XMLHttpRequest>response</a>,
<var>xhr</var>'s <a>relevant global object</a>, and "<code>xmlhttprequest</code>".

<p id=handle-response-end-of-file>To <dfn>handle response end-of-body</dfn> for an
{{XMLHttpRequest}} object <var>xhr</var>, run these steps:

Expand All @@ -963,6 +967,8 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
<li><p>If <var>xhr</var>'s <a for=XMLHttpRequest>response</a> is a <a>network error</a>, then
return.

<li><p><a for=/>Report timing</a> for <var>xhr</var>.

<li><p>Let <var>transmitted</var> be <var>xhr</var>'s <a>received bytes</a>'s
<a for="byte sequence">length</a>.

Expand Down Expand Up @@ -1001,9 +1007,16 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
<a for=response>aborted flag</a> is set, run the <a>request error steps</a> for <var>xhr</var>,
<a event><code>abort</code></a>, and "{{AbortError!!exception}}" {{DOMException}}.

<li><p>Otherwise, if <var>xhr</var>'s <a for=XMLHttpRequest>response</a>'s is a
<a for=/>network error</a>, run the <a>request error steps</a> for <var>xhr</var>,
<a event><code>error</code></a>, and "{{NetworkError!!exception}}" {{DOMException}}.
<li>
<p>Otherwise, if <var>xhr</var>'s <a for=XMLHttpRequest>response</a> is a
<a for=/>network error</a>, then:

<ol>
<li><p><a for=/>Report timing</a> for <var>xhr</var>.

<li><p>Run the <a>request error steps</a> for <var>xhr</var>,
<a event><code>error</code></a>, and "{{NetworkError!!exception}}" {{DOMException}}.
</ol>
</ol>

<p>The <dfn>request error steps</dfn> for an {{XMLHttpRequest}} object <var>xhr</var>,
Expand Down

0 comments on commit b4da01a

Please sign in to comment.