<?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>17688</bug_id>
          
          <creation_ts>2012-07-04 08:39:43 +0000</creation_ts>
          <short_desc>appcache: Events fire at a weird time</short_desc>
          <delta_ts>2014-09-05 21:55:39 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#downloading-or-updating-an-application-cache</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>adrianba</cc>
    
    <cc>ap</cc>
    
    <cc>eoconnor</cc>
    
    <cc>eric</cc>
    
    <cc>franko</cc>
    
    <cc>ian</cc>
    
    <cc>michaeln</cc>
    
    <cc>mike</cc>
    
    <cc>mjs</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>myfacebook</cc>
    
    <cc>roc</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>69632</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-04 08:39:43 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html
Multipage: http://www.whatwg.org/C#downloading-or-updating-an-application-cache
Complete: http://www.whatwg.org/c#downloading-or-updating-an-application-cache

Comment:
Specification should be clearer about when the downloading of the application
cache starts. &quot;These events are delayed until after the load event has fired.&quot;
is a bit misleading. The chrome developer team interprets it as: Start
downloading all resources from the manifest file as soon as the page loads,
but just delay the events until onload event has been fired. The Firefox team
is actually delaying the download of all resources from the manifest file
until the onload event has been fired. Outcome in Chrome: Delay between
ondownloading and oncache event is minimal(in my testcase 34ms) and in firefox
the actual time it took to download all resources. Chromes approach makes
these events basically useless, because they are almost at the same time and
appcaching is not cancelable. With a better specification, this issue could be
solved.

Posted from: 90.146.74.58 by simon.schatka@compuware.com
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71025</commentid>
    <comment_count>1</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 17:56:29 +0000</bug_when>
    <thetext>This bug was cloned to create bug 18279 as part of operation convergence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71968</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-08-09 15:48:35 +0000</bug_when>
    <thetext>Both approaches are valid. The text you quote is a non-normative description, the exact rules are given lower down in the spec.

The constraints are:

 - we don&apos;t want to fire the events until after the &apos;load&apos; event is fired, because that way we can ensure that the events are always fired in a predictable way.

 - we don&apos;t want to limit when UAs can do the cache, either early or late, since there are reasons to do both.

Thus we end up where we are.

In practice the events are still useful. They are intended to show download progress UI, and they enable you to do so as soon as your page is loaded, starting wherever you are in the download.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71988</commentid>
    <comment_count>3</comment_count>
    <who name="">myfacebook</who>
    <bug_when>2012-08-09 18:57:34 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Both approaches are valid. The text you quote is a non-normative description,
&gt; the exact rules are given lower down in the spec.
&gt; 
&gt; The constraints are:
&gt; 
&gt;  - we don&apos;t want to fire the events until after the &apos;load&apos; event is fired,
&gt; because that way we can ensure that the events are always fired in a
&gt; predictable way.
&gt; 
&gt;  - we don&apos;t want to limit when UAs can do the cache, either early or late,
&gt; since there are reasons to do both.
&gt; 
&gt; Thus we end up where we are.
&gt; 
&gt; In practice the events are still useful. They are intended to show download
&gt; progress UI, and they enable you to do so as soon as your page is loaded,
&gt; starting wherever you are in the download.

whats the point of firing progress events for events that have already finished?
chrome has already done all the caching and then it is firing, that it is starting the download, the progress events and it is finished? if that is REALLY what the specification wants to allow, then why do you even bother to create those events? they are absolutely useless, just check in the onload event if the caching was successful and  show a progressbar that shows 100%....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109296</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-25 20:10:39 +0000</bug_when>
    <thetext>It&apos;s true that if the entire update has started and ended, there&apos;s not much point sending any of the events... Maybe we should clear the queue when the update ends, if it hasn&apos;t yet been flushed? Would that work?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109305</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2014-07-26 01:56:30 +0000</bug_when>
    <thetext>An application will still want to know whether an update is available, to decide whether it wants to switch to the new version of the cache. It would be a bit strange to get an updateready event without preceding events.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109427</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-28 22:20:15 +0000</bug_when>
    <thetext>Yeah, good point.

How about just dropping redundant &apos;progress&apos; events? So the order of events would be:

  If not previously cached:
     checking, error
     checking, downloading, progress, error
     checking, downloading, progress, cached

  If previously cached:
     checking, error, noupdate
     checking, noupdate
     checking, obsolete
     checking, downloading, progress, error
     checking, downloading, progress, updateready

This is the same as now, but there&apos;d only ever be one deferred &apos;progress&apos; event.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111105</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-05 21:55:23 +0000</bug_when>
    <thetext>I dunno if anyone&apos;s gonna implement this, really, given that appcache is considered obsolete, but I did the suggestion from comment 6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111106</commentid>
    <comment_count>8</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-09-05 21:55:39 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8751.
Check-in comment: appcache: coalesce queued progress events.
http://html5.org/tools/web-apps-tracker?from=8750&amp;to=8751</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>