Skip to content

Commit cd935ac

Browse files
committed
Add details to FetchMonitor interface
Still using a ProgressEvent for now, but this will be switched to Event
1 parent c03933d commit cd935ac

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

fetch.bs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ urlPrefix:https://tc39.es/ecma262/#;type:dfn;spec:ecma-262
115115
<pre class=link-defaults>
116116
spec:dom; type:dfn; text:element
117117
spec:dom; type:dfn; text:event;
118+
spec:xhr; type:event; text:progress;
118119
spec:infra; type:dfn; text:implementation-defined
119120
</pre>
120121

@@ -8524,6 +8525,11 @@ callback FetchMonitorCallback = undefined (FetchMonitor monitor);
85248525

85258526
[Exposed=(Window,Worker)]
85268527
interface FetchMonitor : EventTarget {
8528+
readonly attribute double requestLoaded;
8529+
readonly attribute double responseLoaded;
8530+
readonly attribute double requestTotal;
8531+
readonly attribute double responseTotal;
8532+
85278533
attribute EventHandler onrequestprogress;
85288534
attribute EventHandler onresponseprogress;
85298535
};
@@ -8607,32 +8613,30 @@ method steps are:
86078613

86088614
<li><p>Set <var>monitor</var> to a {{FetchMonitor}}.
86098615

8616+
<li><p>Set <var>monitor</var>'s requestTotal to <var>request</var>'s
8617+
<a for=request>body</a>'s <a for=body>length</a>, if <var>request</var>'s <a for=request>body</a>
8618+
is non-null; otherwise 0.
8619+
86108620
<li><p>Let <var>args</var> be « <var>monitor</var> ».
86118621

86128622
<li><p>[=invoke|Invoke=] <var>monitorCallback</var> with <var>args</var>
86138623
and <code>"rethrow"</code>. If this throws an exception, <a for=/>reject</a> <var>p</var> with it
86148624
and return <var>p</var>.
86158625
</ol>
86168626

8617-
<li><p>Let <var>requestBodyTransmitted</var> be 0.
8618-
8619-
<li><p>Let <var>requestBodyLength</var> be <var>request</var>'s <a for=request>body</a>'s
8620-
<a for=body>length</a>, if <var>request</var>'s <a for=request>body</a> is non-null;
8621-
otherwise 0.
8622-
8623-
<li><p>Assert: <var>requestBodyLength</var> is an integer.
8624-
86258627
<li>
86268628
<p>Let <var>processRequestBodyChunkLength</var>, given a <var>bytesLength</var>, be these steps:
86278629

86288630
<ol>
8629-
<li><p>Increase <var>requestBodyTransmitted</var> by <var>bytesLength</var>.
8631+
<li><p>If <var>monitor</var> is null, then return.
8632+
8633+
<li><p>Increase <var>monitor</var>'s requestLoaded by <var>bytesLength</var>.
86308634

86318635
<li><p>If not roughly 50ms has passed since these steps were last invoked, then return.
86328636

8633-
<li><p>If <var>monitor</var> is not null, then <a>fire a progress event</a> named
8634-
<a event><code>requestprogress</code></a> at <var>monitor</var> with <var>requestBodyTransmitted</var>
8635-
and <var>requestBodyLength</var>.
8637+
<li><p><a>Fire a progress event</a> named
8638+
<a event><code>requestprogress</code></a> at <var>monitor</var> with
8639+
<var>monitor</var>'s requestLoaded and <var>monitor</var>'s requestTotal.
86368640
</ol>
86378641

86388642
<li>
@@ -8641,8 +8645,9 @@ method steps are:
86418645
<ol>
86428646
<li><p>If <var>monitor</var> is null, then return.
86438647

8644-
<li><p><a>Fire a progress event</a> named <a event><code>requestprogress</code></a> at <var>monitor</var>
8645-
with <var>requestBodyTransmitted</var> and <var>requestBodyLength</var>.
8648+
<li><p><a>Fire a progress event</a> named <a event><code>requestprogress</code></a> at
8649+
<var>monitor</var> with <var>monitor</var>'s requestLoaded and
8650+
<var>monitor</var>'s requestTotal.
86468651
</ol>
86478652

86488653
<li>
@@ -9260,6 +9265,12 @@ WHATWG community to ensure input from people familiar with the subject.
92609265
<td>Progress has begun.
92619266
<td>Once.
92629267
<td>First.
9268+
<tr>
9269+
<th><a event><code>progress</code></a>
9270+
<td>In progress.
9271+
<td>Once or more.
9272+
<td>After <code>loadstart</code> has been
9273+
<a>dispatched</a>.
92639274
<tr>
92649275
<th><a event><code>requestprogress</code></a>
92659276
<td>In progress request.

0 commit comments

Comments
 (0)