hixie: Delay appcache events if the document hasn't loaded yet. (whatwg r4582)

hixie: Delay appcache events if the document hasn't loaded yet. (whatwg
r4582)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3657&r2=1.3658&f=h
http://html5.org/tools/web-apps-tracker?from=4581&to=4582

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3657
retrieving revision 1.3658
diff -u -d -r1.3657 -r1.3658
--- Overview.html 12 Jan 2010 11:45:50 -0000 1.3657
+++ Overview.html 13 Jan 2010 01:36:03 -0000 1.3658
@@ -262,7 +262,7 @@
    <h1>HTML5</h1>
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
 
-   <h2 class="no-num no-toc" id="editor-s-draft-12-january-2010">Editor's Draft 12 January 2010</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-13-january-2010">Editor's Draft 13 January 2010</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -361,7 +361,7 @@
   specification's progress along the W3C Recommendation
   track.
 
-  This specification is the 12 January 2010 Editor's Draft.
+  This specification is the 13 January 2010 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is part of <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">a
   larger specification</a> being produced by the <a href="http://www.whatwg.org/">WHATWG</a>.
   <!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST -->
@@ -41917,6 +41917,8 @@
   not show prominent update progress notifications for applications
   that cancel the relevant events.</p>
 
+  <p class="note">These events are delayed until after the <code title="event-load">load</code> event has fired.</p>
+
   <p>The <a href="#application-cache-download-process">application cache download process</a> steps are as
   follows:
 
@@ -41979,8 +41981,8 @@
 
      <li><p>If these steps were invoked with a <a href="#cache-host">cache
      host</a>, and the <a href="#concept-appcache-status" title="concept-appcache-status">status</a> of <var title="">cache group</var> is <i>checking</i> or
-     <i>downloading</i>, then <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire
-     a simple event</a> named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> that is
+     <i>downloading</i>, then <a href="#queue-a-post-load-task">queue a post-load task</a> to
+     <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> that is
      cancelable at the <code><a href="#applicationcache">ApplicationCache</a></code> singleton of that
      <a href="#cache-host">cache host</a>. The default action of this event must
      be, if the user agent <a href="#shows-caching-progress">shows caching progress</a>, the
@@ -41990,8 +41992,8 @@
 
      <li><p>If these steps were invoked with a <a href="#cache-host">cache
      host</a>, and the <a href="#concept-appcache-status" title="concept-appcache-status">status</a> of <var title="">cache group</var> is <i>downloading</i>, then also
-     <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple event</a>
-     named <code title="event-appcache-downloading"><a href="#event-appcache-downloading">downloading</a></code> that is
+     <a href="#queue-a-post-load-task">queue a post-load task</a> to <a href="#fire-a-simple-event">fire a simple
+     event</a> named <code title="event-appcache-downloading"><a href="#event-appcache-downloading">downloading</a></code> that is
      cancelable at the <code><a href="#applicationcache">ApplicationCache</a></code> singleton of that
      <a href="#cache-host">cache host</a>. The default action of this event must
      be, if the user agent <a href="#shows-caching-progress">shows caching progress</a>, the
@@ -42008,8 +42010,8 @@
 
      <li><p>For each <a href="#cache-host">cache host</a> associated with an
      <a href="#application-cache">application cache</a> in <var title="">cache
-     group</var>, <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
-     event</a> that is cancelable named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> at the
+     group</var>, <a href="#queue-a-post-load-task">queue a post-load task</a> to <a href="#fire-a-simple-event">fire a
+     simple event</a> that is cancelable named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> at the
      <code><a href="#applicationcache">ApplicationCache</a></code> singleton of the <a href="#cache-host">cache
      host</a>. The default action of these events must be, if the
      user agent <a href="#shows-caching-progress">shows caching progress</a>, the display of
@@ -42027,8 +42029,8 @@
 
    <li><p>If this is a <a href="#concept-appcache-cache" title="concept-appcache-cache">cache
    attempt</a>, then this algorithm was invoked with a <a href="#cache-host">cache
-   host</a>; <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
-   event</a> named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> that is cancelable
+   host</a>; <a href="#queue-a-post-load-task">queue a post-load task</a> to <a href="#fire-a-simple-event">fire a
+   simple event</a> named <code title="event-appcache-checking"><a href="#event-appcache-checking">checking</a></code> that is cancelable
    at the <code><a href="#applicationcache">ApplicationCache</a></code> singleton of that <a href="#cache-host">cache
    host</a>. The default action of this event must be, if the user
    agent <a href="#shows-caching-progress">shows caching progress</a>, the display of some sort
@@ -42100,8 +42102,8 @@
 
      <li><p>Let the <a href="#concept-appcache-status" title="concept-appcache-status">status</a> of <var title="">cache group</var> be <i>idle</i>.</li>
 
-     <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-task" title="queue a task">queue</a>
-     that task.</li>
+     <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-post-load-task" title="queue a post-load
+     task">queue that task as a post-load task</a>.</li>
 
      <li><p>Abort the <a href="#application-cache-download-process">application cache download
      process</a>.</li>
@@ -42186,8 +42188,8 @@
 
      <li><p>Let the <a href="#concept-appcache-status" title="concept-appcache-status">status</a> of <var title="">cache group</var> be <i>idle</i>.</li>
 
-     <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-task" title="queue a task">queue</a>
-     that task.</li>
+     <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-post-load-task" title="queue a post-load
+     task">queue that task as a post-load task</a>.</li>
 
      <li><p>Abort the <a href="#application-cache-download-process">application cache download
      process</a>.</li>
@@ -42208,8 +42210,8 @@
 
    <li><p>For each <a href="#cache-host">cache host</a> associated with an
    <a href="#application-cache">application cache</a> in <var title="">cache group</var>,
-   <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple event</a> that
-   is cancelable named <code title="event-appcache-downloading"><a href="#event-appcache-downloading">downloading</a></code> at the
+   <a href="#queue-a-post-load-task">queue a post-load task</a> to <a href="#fire-a-simple-event">fire a simple
+   event</a> that is cancelable named <code title="event-appcache-downloading"><a href="#event-appcache-downloading">downloading</a></code> at the
    <code><a href="#applicationcache">ApplicationCache</a></code> singleton of the <a href="#cache-host">cache
    host</a>. The default action of these events must be, if the
    user agent <a href="#shows-caching-progress">shows caching progress</a>, the display of some
@@ -42258,9 +42260,9 @@
 
      <li><p>For each <a href="#cache-host">cache host</a> associated with an
      <a href="#application-cache">application cache</a> in <var title="">cache
-     group</var>, <a href="#queue-a-task">queue a task</a> to fire an event with the
-     name <code title="event-appcache-progress"><a href="#event-appcache-progress">progress</a></code>, which
-     does not bubble, which is cancelable, and which uses the
+     group</var>, <a href="#queue-a-post-load-task">queue a post-load task</a> to fire an event
+     with the name <code title="event-appcache-progress"><a href="#event-appcache-progress">progress</a></code>, which does not
+     bubble, which is cancelable, and which uses the
      <code>ProgressEvent</code> interface, at the
      <code><a href="#applicationcache">ApplicationCache</a></code> singleton of the <a href="#cache-host">cache
      host</a>. The <code title="dom-ProgressEvents-lengthComputable">lengthComputable</code>
@@ -42386,8 +42388,9 @@
 
    <li><p>For each <a href="#cache-host">cache host</a> associated with an
    <a href="#application-cache">application cache</a> in <var title="">cache group</var>,
-   <a href="#queue-a-task">queue a task</a> to fire an event with the name <code title="event-appcache-progress"><a href="#event-appcache-progress">progress</a></code>, which does not
-   bubble, which is cancelable, and which uses the
+   <a href="#queue-a-post-load-task">queue a post-load task</a> to fire an event with the name
+   <code title="event-appcache-progress"><a href="#event-appcache-progress">progress</a></code>, which does
+   not bubble, which is cancelable, and which uses the
    <code>ProgressEvent</code> interface, at the
    <code><a href="#applicationcache">ApplicationCache</a></code> singleton of the <a href="#cache-host">cache
    host</a>. The <code title="dom-ProgressEvents-lengthComputable">lengthComputable</code>
@@ -42420,7 +42423,7 @@
     <ol><li><p>Unassociate the <code>Document</code> for this entry from
      <var title="">new cache</var>.</li>
 
-     <li><p><a href="#queue-a-task">Queue a task</a> to <a href="#fire-a-simple-event">fire a simple
+     <li><p><a href="#queue-a-post-load-task">Queue a post-load task</a> to <a href="#fire-a-simple-event">fire a simple
      event</a> that is cancelable named <code title="event-appcache-error"><a href="#event-appcache-error">error</a></code> at the
      <code><a href="#applicationcache">ApplicationCache</a></code> singleton of the
      <code>Document</code> for this entry, if there still is one. The
@@ -42522,8 +42525,8 @@
    status</a> of <var title="">cache group</var> to
    <i>idle</i>.</li>
 
-   <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-task" title="queue a task">queue</a>
-   that task.</li>
+   <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-post-load-task" title="queue a post-load
+   task">queue that task as a post-oad task</a>.</li>
 
   </ol><p>The <dfn id="cache-failure-steps">cache failure steps</dfn> are as follows:</p>
 
@@ -42582,8 +42585,8 @@
    attempt</a>, discard <var title="">cache group</var>
    altogether.</p>
 
-   <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-task" title="queue a task">queue</a>
-   that task.</li>
+   <li><p>For each <a href="#concept-task" title="concept-task">task</a> in <var title="">task list</var>, <a href="#queue-a-post-load-task" title="queue a post-load
+   task">queue that task as a post-load task</a>.</li>
 
    <li><p>Abort the <a href="#application-cache-download-process">application cache download
    process</a>.</li>
@@ -42599,7 +42602,28 @@
   allows user agents to keep caches primed and to update caches even
   before the user visits a site.</p>
 
-  <p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#networking-task-source">networking task
+  <hr><p>Each <code>Document</code> has a list of <dfn id="pending-application-cache-download-process-tasks">pending application
+  cache download process tasks</dfn> that is used to delay events
+  fired by the algorithm above until the document's <code title="event-load">load</code> event has fired. When the
+  <code>Document</code> is created, the list must be empty.</p>
+
+  <p>When the steps above say to <dfn id="queue-a-post-load-task">queue a post-load task</dfn>
+  <var title="">task</var>, where <var title="">task</var> is a <a href="#concept-task" title="concept-task">task</a> that dispatches an event on a
+  target <code><a href="#applicationcache">ApplicationCache</a></code> object <var title="">target</var>, the user agent must run the appropriate steps
+  from the following list:</p>
+
+  <dl><dt>If <var title="">target</var>'s <code>Document</code> has
+   <a href="#completely-loaded">completely loaded</a></dt>
+
+   <dd><p><a href="#queue-a-task" title="queue a task">Queue</a> the task <var title="">task</var>.</dd>
+
+   <dt>Otherwise</dt>
+
+   <dd><p>Add <var title="">task</var> to <var title="">target</var>'s
+   <code>Document</code>'s list of <a href="#pending-application-cache-download-process-tasks">pending application cache
+   download process tasks</a>.</dd>
+
+  </dl><p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#networking-task-source">networking task
   source</a>.</p>
   
 
@@ -56853,8 +56877,20 @@
    must bubble but not be cancelable and has no default
    action.</li>
 
-  </ol><p>The <a href="#task-source">task source</a> for the <a href="#concept-task" title="concept-task">tasks</a> mentioned in this section is the
-  <a href="#dom-manipulation-task-source">DOM manipulation task source</a>.</p>
+   <li><p>If the <code>Document</code> has any <a href="#pending-application-cache-download-process-tasks">pending
+   application cache download process tasks</a>, then <a href="#queue-a-task" title="queue a task">queue</a> each such <a href="#concept-task" title="concept-task">task</a> in the order they were added to
+   the list of <a href="#pending-application-cache-download-process-tasks">pending application cache download process
+   tasks</a>, and then empty the list of <a href="#pending-application-cache-download-process-tasks">pending application
+   cache download process tasks</a>. The <a href="#task-source">task source</a>
+   for these <a href="#concept-task" title="concept-task">tasks</a> is the
+   <a href="#networking-task-source">networking task source</a>.</li>
+
+   <li><p>The <code>Document</code> is now <dfn id="completely-loaded">completely
+   loaded</dfn>.</li>
+
+  </ol><p>Except where otherwise specified, the <a href="#task-source">task source</a>
+  for the <a href="#concept-task" title="concept-task">tasks</a> mentioned in this
+  section is the <a href="#dom-manipulation-task-source">DOM manipulation task source</a>.</p>
 
   </div><div class="impl">

Received on Wednesday, 13 January 2010 01:36:59 UTC