<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26917</bug_id>
          
          <creation_ts>2014-09-29 07:24:46 +0000</creation_ts>
          <short_desc>For any chunk, progress event should be fired at least in 50ms since the arrival of the chunk</short_desc>
          <delta_ts>2016-08-12 09:13:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>XHR</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Takeshi Yoshino">tyoshino</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>112353</commentid>
    <comment_count>0</comment_count>
    <who name="Takeshi Yoshino">tyoshino</who>
    <bug_when>2014-09-29 07:24:46 +0000</bug_when>
    <thetext>https://github.com/whatwg/fetch/commit/d7e357d83380b50886832316c84ae125193b58b4
https://github.com/whatwg/xhr/commit/0e3f85a60cd2938059d7594ba9242209aa13415d

Now the throttle (interval 50ms) is back to XHR spec again.

The new text says that &quot;process response body&quot; call made in 50ms since the last &quot;process response body&quot; call will be no-op. Right?

Please imagine situation where two chunks come at time n and n + (1 ms), and then the connection becomes idle. Based on the new text, we fire progress event for the first chunk, but do nothing for the second since we&apos;ll enter idle state.

Blink fires a progress event after 50ms passes since the last progress event firing if any chunk has arrived after the chunk which triggered the last progress event. This ensures that for any chunk at least one progress event will be fired for the chunk at least in 50ms since the chunk arrives.

I think this behavior is reasonable. What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112358</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-09-29 08:33:51 +0000</bug_when>
    <thetext>Agreed. I was hoping to avoid more complicated text, but it seems like I should add some.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112369</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-09-29 09:22:21 +0000</bug_when>
    <thetext>I&apos;m trying to think what a good strategy is here. Perhaps we should go with your idea of storing the progress on the XMLHttpRequest object. And then queue a task every 50ms to dispatch the events from.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113106</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-14 14:09:44 +0000</bug_when>
    <thetext>Takeshi, would comment 2 work?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113164</commentid>
    <comment_count>4</comment_count>
    <who name="Takeshi Yoshino">tyoshino</who>
    <bug_when>2014-10-15 03:18:34 +0000</bug_when>
    <thetext>Is your plan to invoke the task every 50ms regardless of the time chunks arrive?

It should also work but a little different from ours. Is it for algorithm simplicity or any other benefit in your mind?

When a new chunk arrives, we check whether there&apos;s any task queued to aggregate progress events. If there is, we just update the progress data stored on the XHR object. If not, we fire a progress event and queue the task. The task is scheduled to be run after 50ms. It checks if there&apos;s any progress data stored on the XHR. If not, do nothing. If there is, fire a progress event from the stored data and queue the task again.

0ms chunkA
10ms chunkB
20ms chunkC
120ms chunkD

Then, we fire a progress event for chunkA at 0ms and one for chunkC at 50ms, and one for chunkD at 120ms.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113193</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-15 11:55:51 +0000</bug_when>
    <thetext>It seems your approach does not accomplish having an event every 50ms (but does accomplish the &quot;least frequent&quot; wording from the spec before). That also seems fine to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113267</commentid>
    <comment_count>6</comment_count>
    <who name="Takeshi Yoshino">tyoshino</who>
    <bug_when>2014-10-16 02:55:28 +0000</bug_when>
    <thetext>(In reply to Anne from comment #5)
&gt; It seems your approach does not accomplish having an event every 50ms (but
&gt; does accomplish the &quot;least frequent&quot; wording from the spec before). That
&gt; also seems fine to me.

I think it&apos;s fine, too. If one needs to do something based on the progress every 50ms, he/she could save the progress from the progress event to somewhere and invoke a repeated task using a timer where we do something by looking at the saved progress.

Otherwise, less frequency would be nice basically.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113268</commentid>
    <comment_count>7</comment_count>
    <who name="Takeshi Yoshino">tyoshino</who>
    <bug_when>2014-10-16 03:14:58 +0000</bug_when>
    <thetext>(In reply to Takeshi Yoshino from comment #6)
&gt; (In reply to Anne from comment #5)
&gt; &gt; It seems your approach does not accomplish having an event every 50ms (but
&gt; &gt; does accomplish the &quot;least frequent&quot; wording from the spec before). That
&gt; &gt; also seems fine to me.
&gt; 
&gt; I think it&apos;s fine, too. If one needs to do something based on the progress
&gt; every 50ms, he/she could save the progress from the progress event to
&gt; somewhere and invoke a repeated task using a timer where we do something by
&gt; looking at the saved progress.
&gt; 
&gt; Otherwise, less frequency would be nice basically.

By otherwise, I meant &quot;if one doesn&apos;t need every-50ms dispatching&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113273</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-16 07:13:49 +0000</bug_when>
    <thetext>I&apos;m open to revisiting the 50ms rule. We could also just dispatch an event for each chunk. I&apos;m not sure if that is typically rarer? Or we could make it more up to the user agent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127133</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-08-12 09:13:05 +0000</bug_when>
    <thetext>If you still want to change this, let&apos;s discuss it on GitHub.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>