@@ -839,8 +839,7 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
839
839
<ol>
840
840
<li><p> Set <a>this</a> 's <a for=XMLHttpRequest>response</a> to <var> response</var> .
841
841
842
- <li><p> <a>Handle errors</a> for <a>this</a> and <a>this</a> 's
843
- <a for=XMLHttpRequest>response</a> .
842
+ <li><p> <a>Handle errors</a> for <a>this</a> .
844
843
845
844
<li><p> If <a>this</a> 's <a for=XMLHttpRequest>response</a> is a <a>network error</a> , then
846
845
return.
@@ -852,8 +851,7 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
852
851
<li><p> If <a>this</a> 's <a>state</a> is not <i> headers received</i> , then return.
853
852
854
853
<li><p> If <a>this</a> 's <a for=XMLHttpRequest>response</a>' s <a for=response>body</a> is null,
855
- then run <a>handle response end-of-body</a> for <a>this</a> and <a>this</a> 's
856
- <a for=XMLHttpRequest>response</a> , and then return.
854
+ then run <a>handle response end-of-body</a> for <a>this</a> and return.
857
855
858
856
<li>
859
857
<p> Let <var> processBodyChunk</var> given <var> bytes</var> be these steps:
@@ -879,10 +877,16 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
879
877
</ol>
880
878
881
879
<li><p> Let <var> processEndOfBody</var> be this step: run <a>handle response end-of-body</a> for
882
- <a>this</a> and <a>this</a> 's <a for=XMLHttpRequest>response</a> .
880
+ <a>this</a> .
883
881
884
- <li><p> Let <var> processBodyError</var> be this step: run <a>handle errors</a> for <a>this</a>
885
- and <a>this</a> 's <a for=XMLHttpRequest>response</a> .
882
+ <li>
883
+ <p> Let <var> processBodyError</var> be these steps:
884
+
885
+ <ol>
886
+ <li><p> Set <a>this</a> 's <a for=XMLHttpRequest>response</a> to a <a for=/>network error</a> .
887
+
888
+ <li><p> Run <a>handle errors</a> for <a>this</a> .
889
+ </ol>
886
890
887
891
<li><p> <a for=body>Incrementally read</a> <a>this</a> 's <a for=XMLHttpRequest>response</a>' s
888
892
<a for=response>body</a> , given <var> processBodyChunk</var> , <var> processEndOfBody</var> ,
@@ -916,18 +920,17 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
916
920
<ol>
917
921
<li><p> If <a>this</a> 's <a>relevant settings object</a> has a <a>responsible document</a> which
918
922
is not <a>allowed to use</a> the "<code> <a>sync-xhr</a> </code> " feature, then run
919
- <a>handle response end-of-body</a> for <a>this</a> and a <a>network error</a> , and then return.
920
-
921
- <li><p> Let <var> response</var> be a <a for=/>network error</a> .
923
+ <a>handle response end-of-body</a> for <a>this</a> and return.
922
924
923
925
<li><p> Let <var> processedResponse</var> be false.
924
926
925
927
<li>
926
- <p> Let <var> processResponseEndOfBody</var> , given a <var> fetchResponse </var> and
928
+ <p> Let <var> processResponseEndOfBody</var> , given a <var> response </var> and
927
929
<var> nullOrFailureOrBytes</var> , be these steps:
928
930
929
931
<ol>
930
- <li><p> Set <var> response</var> to <var> fetchResponse</var> .
932
+ <li><p> If <var> nullOrFailureOrBytes</var> is not failure, then set <a>this</a> 's
933
+ <a for=XMLHttpRequest>response</a> to <var> response</var> .
931
934
932
935
<li><p> If <var> nullOrFailureOrBytes</var> is a <a for=/>byte sequence</a> , then append
933
936
<var> nullOrFailureOrBytes</var> to <a>this</a> 's <a>received bytes</a> .
@@ -949,31 +952,24 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
949
952
<li><p> If <var> processedResponse</var> is false, then set <a>this</a> 's <a>timed out flag</a> and
950
953
<a for=fetch>terminate</a> <a for=/>fetching</a> .
951
954
952
- <li><p> Run <a>handle response end-of-body</a> for <a>this</a> and <var> response </var> .
955
+ <li><p> Run <a>handle response end-of-body</a> for <a>this</a> .
953
956
</ol>
954
957
</ol>
955
958
956
959
<p id=handle-response-end-of-file> To <dfn>handle response end-of-body</dfn> for an
957
- {{XMLHttpRequest}} object <var> xhr</var> and a <a for=/>response</a> <var> response</var> , run these
958
- steps:
960
+ {{XMLHttpRequest}} object <var> xhr</var> , run these steps:
959
961
960
962
<ol>
961
- <li><p> If <var> xhr</var> 's <a>synchronous flag</a> is set, then set <var>xhr</var>' s
962
- <a for=XMLHttpRequest>response</a> to <var> response</var> .
963
-
964
- <li><p> <a>Handle errors</a> for <var> xhr</var> and <var> response</var> .
963
+ <li><p> <a>Handle errors</a> for <var> xhr</var> .
965
964
966
965
<li><p> If <var> xhr</var> 's <a for=XMLHttpRequest>response</a> is a <a>network error</a> , then
967
966
return.
968
967
969
- <li><p> If <var> xhr</var> 's <a>synchronous flag</a> is unset, then update <var>xhr</var>' s
970
- <a for=XMLHttpRequest>response</a> 's <a for=response>body</a> using <var> response</var> .
971
-
972
968
<li><p> Let <var> transmitted</var> be <var> xhr</var> 's <a>received bytes</a>' s
973
969
<a for="byte sequence">length</a> .
974
970
975
- <li><p> Let <var> length</var> be <var> response </var> 's <a for=response>body </a>' s
976
- <a for=body>total bytes</a> .
971
+ <li><p> Let <var> length</var> be <var> xhr </var> 's <a for=XMLHttpRequest>response </a>' s
972
+ <a for=response>body</a> 's <a for= body>total bytes</a> .
977
973
978
974
<li><p> If <var> xhr</var> 's <a>synchronous flag</a> is unset, then <a>fire a progress event</a>
979
975
named <a event><code>progress</code></a> at <var> xhr</var> with <var> transmitted</var> and
@@ -992,8 +988,7 @@ steps:
992
988
<var> transmitted</var> and <var> length</var> .
993
989
</ol>
994
990
995
- <p> To <dfn>handle errors</dfn> for an {{XMLHttpRequest}} object <var> xhr</var> and a
996
- <a for=/>response</a> <var> response</var> , run these steps:
991
+ <p> To <dfn>handle errors</dfn> for an {{XMLHttpRequest}} object <var> xhr</var> , run these steps:
997
992
998
993
<ol>
999
994
<li><p> If <var> xhr</var> 's <a><code>send()</code> flag</a> is unset, then return.
@@ -1002,25 +997,13 @@ steps:
1002
997
for <var> xhr</var> , <a event><code>timeout</code></a> , and "{{TimeoutError!!exception}} "
1003
998
{{DOMException}} .
1004
999
1005
- <li><p> If <var> response</var> is a <a>network error</a> , then run the <a>request error steps</a>
1006
- for <var> xhr</var> , <a event><code>error</code></a> , and "{{NetworkError!!exception}} "
1007
- {{DOMException}} .
1008
-
1009
- <li>
1010
- <p> Otherwise, if <var> response</var> 's <a for=response>body</a>' s <a for=body>stream</a> is
1011
- <a for=ReadableStream>errored</a> , then:
1012
-
1013
- <ol>
1014
- <li><p> Set <var> xhr</var> 's <a>state</a> to <i> done</i> .
1015
-
1016
- <li><p> Unset <var> xhr</var> 's <a><code>send()</code> flag</a> .
1017
-
1018
- <li><p> Set <var> xhr</var> 's <a for=XMLHttpRequest>response</a> to a <a>network error</a> .
1019
- </ol>
1000
+ <li><p> Otherwise, if <var> xhr</var> 's <a for=XMLHttpRequest>response</a>' s
1001
+ <a for=response>aborted flag</a> is set, run the <a>request error steps</a> for <var> xhr</var> ,
1002
+ <a event><code>abort</code></a> , and "{{AbortError!!exception}} " {{DOMException}} .
1020
1003
1021
- <li><p> Otherwise, if <var> xhr</var> 's <var>response</var>' s < a for=response>aborted flag </a> is
1022
- set, then run the <a>request error steps</a> for <var> xhr</var> , <a event><code>abort</code></a > ,
1023
- and "{{AbortError !!exception}} " {{DOMException}} .
1004
+ <li><p> Otherwise, if <var> xhr</var> 's <a for=XMLHttpRequest>response </a>' s is a
1005
+ <a for=/>network error</a> , run the <a>request error steps</a> for <var> xhr</var> ,
1006
+ <a event><code>error</code></a> , and "{{NetworkError !!exception}} " {{DOMException}} .
1024
1007
</ol>
1025
1008
1026
1009
<p> The <dfn>request error steps</dfn> for an {{XMLHttpRequest}} object <var> xhr</var> ,
0 commit comments