@@ -783,28 +783,32 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
783
783
<li><p> <a>Fire a progress event</a> named <a event><code>loadstart</code></a> at <a>this</a>
784
784
with 0 and 0.
785
785
786
+ <li><p> Let <var> requestBodyTransmitted</var> be 0.
787
+
788
+ <li><p> Let <var> requestBodyLength</var> be <var> req</var> 's <a for=request>body</a>' s
789
+ <a for=body>length</a> , if <var> req</var> 's <a for=request>body</a> is non-null; otherwise 0.
790
+
791
+ <li><p> Assert: <var> requestBodyLength</var> is an integer.
792
+
786
793
<li><p> If <a>this</a> 's <a>upload complete flag</a> is unset and <a>this</a>' s
787
794
<a>upload listener flag</a> is set, then <a>fire a progress event</a> named
788
- <a event><code>loadstart</code></a> at <a>this</a> 's <a>upload object</a> with 0 and
789
- <var> req </var> 's <a for=request>body</a>' s <a>total bytes</a > .
795
+ <a event><code>loadstart</code></a> at <a>this</a> 's <a>upload object</a> with
796
+ <var> requestBodyTransmitted </var> and <var> requestBodyLength </var > .
790
797
791
798
<li><p> If <a>this</a> 's <a>state</a> is not <i>opened</i> or <a>this</a>' s
792
799
<a><code>send()</code> flag</a> is unset, then return.
793
800
794
- <li><p> Let <var> uploadedBytesLength</var> be 0.
795
-
796
801
<li>
797
802
<p> Let <var> processRequestBody</var> , given a <var> bytesLength</var> , be these steps:
798
803
799
804
<ol>
800
- <li><p> Increase <var> uploadedBytesLength </var> by <var> bytesLength</var> .
805
+ <li><p> Increase <var> requestBodyTransmitted </var> by <var> bytesLength</var> .
801
806
802
807
<li><p> If not roughly 50ms have passed since these steps were last invoked, then return.
803
808
804
809
<li><p> If <a>this</a> 's <a>upload listener flag</a> is set, then <a>fire a progress event</a>
805
810
named <a event><code>progress</code></a> at <a>this</a> 's <a>upload object</a> with
806
- <var> uploadedBytesLength</var> and <var> req</var> 's <a for=request>body</a>' s
807
- <a>total bytes</a> .
811
+ <var> requestBodyTransmitted</var> and <var> requestBodyLength</var> .
808
812
<!-- upload complete flag can never be set here I hope -->
809
813
</ol>
810
814
@@ -818,18 +822,14 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
818
822
819
823
<li><p> If <a>this</a> 's <a>upload listener flag</a> is unset, then return.
820
824
821
- <li><p> Let <var> length</var> be <var> req</var> 's
822
- <a for=request>body</a> 's
823
- <a>total bytes</a> .
824
-
825
825
<li><p> <a>Fire a progress event</a> named <a event><code>progress</code></a> at <a>this</a> 's
826
- <a>upload object</a> with <var> uploadedBytesLength </var> and <var> length </var> .
826
+ <a>upload object</a> with <var> requestBodyTransmitted </var> and <var> requestBodyLength </var> .
827
827
828
828
<li><p> <a>Fire a progress event</a> named <a event><code>load</code></a> at <a>this</a> 's
829
- <a>upload object</a> with <var> uploadedBytesLength </var> and <var> length </var> .
829
+ <a>upload object</a> with <var> requestBodyTransmitted </var> and <var> requestBodyLength </var> .
830
830
831
831
<li><p> <a>Fire a progress event</a> named <a event><code>loadend</code></a> at <a>this</a> 's
832
- <a>upload object</a> with <var> uploadedBytesLength </var> and <var> length </var> .
832
+ <a>upload object</a> with <var> requestBodyTransmitted </var> and <var> requestBodyLength </var> .
833
833
</ol>
834
834
<!-- upload complete flag can never be set here I hope -->
835
835
@@ -853,6 +853,11 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
853
853
<li><p> If <a>this</a> 's <a for=XMLHttpRequest>response</a>' s <a for=response>body</a> is null,
854
854
then run <a>handle response end-of-body</a> for <a>this</a> and return.
855
855
856
+ <li><p> Let <var> length</var> be the result of <a for="header list">extracting a length</a> from
857
+ <a>this</a> 's <a for=XMLHttpRequest>response</a>' s <a for=response>header list</a> .
858
+
859
+ <li><p> If <var> length</var> is not an integer, then set it to 0.
860
+
856
861
<li>
857
862
<p> Let <var> processBodyChunk</var> given <var> bytes</var> be these steps:
858
863
@@ -872,8 +877,7 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
872
877
873
878
<li><p> <a>Fire a progress event</a> named <a event><code>progress</code></a> at <a>this</a>
874
879
with <a>this</a> 's <a>received bytes</a>' s <a for="byte sequence">length</a> and
875
- <a>this</a> 's <a for=XMLHttpRequest>response</a>' s <a for=response>body</a> 's
876
- <a>total bytes</a> .
880
+ <var> length</var> .
877
881
</ol>
878
882
879
883
<li><p> Let <var> processEndOfBody</var> be this step: run <a>handle response end-of-body</a> for
@@ -968,8 +972,10 @@ return <a>this</a>'s <a>cross-origin credentials</a>.
968
972
<li><p> Let <var> transmitted</var> be <var> xhr</var> 's <a>received bytes</a>' s
969
973
<a for="byte sequence">length</a> .
970
974
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> .
975
+ <li><p> Let <var> length</var> be the result of <a for="header list">extracting a length</a> from
976
+ <a>this</a> 's <a for=XMLHttpRequest>response</a>' s <a for=response>header list</a> .
977
+
978
+ <li><p> If <var> length</var> is not an integer, then set it to 0.
973
979
974
980
<li><p> If <var> xhr</var> 's <a>synchronous flag</a> is unset, then <a>fire a progress event</a>
975
981
named <a event><code>progress</code></a> at <var> xhr</var> with <var> transmitted</var> and
0 commit comments