Skip to content

Commit

Permalink
[e] (0) Get rid of a potential race condition in the cache update pro…
Browse files Browse the repository at this point in the history
…cess.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=7784

git-svn-id: http://svn.whatwg.org/webapps@4172 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 18, 2009
1 parent dddf1cc commit 174981d
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 165 deletions.
138 changes: 83 additions & 55 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -53500,26 +53500,31 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
than the processing of <code>Document</code> objects already
associated with an <a href=#application-cache>application cache</a> in the <var title="">cache group</var>.</li>

<li><p>Let <var title="">task list</var> be an empty list of
<a href=#concept-task title=concept-task>tasks</a>.</p>

<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> named <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code> that is
group</var>, create a <a href=#concept-task title=concept-task>task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code> that is
cancelable 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 sort of user interface indicating to the user
that the application is no longer available for offline
use.</li>
<a href=#cache-host>cache host</a>, and add it to <var title="">task
list</var>. 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 sort of user interface indicating to the user that the
application is no longer available for offline use.</li>

<li><p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
entries</a>, <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-error><a href=#event-appcache-error>error</a></code> (not <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>!) at the
entries</a>, create a <a href=#concept-task title=concept-task>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> (not <code title=event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>!) at the
<code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
host</a> the <code>Document</code> for this entry, if there
still is one. 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 of user interface indicating to the user that the user
agent failed to save the application for offline use.</li>
still is one, and add it to <var title="">task list</var>. 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 of
user interface indicating to the user that the user agent failed
to save the application for offline use.</li>

<li><p>If <var title="">cache group</var> has an
<a href=#application-cache>application cache</a> whose <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> is
Expand All @@ -53531,6 +53536,9 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp

<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>Abort the <a href=#application-cache-download-process>application cache download
process</a>.</li>

Expand Down Expand Up @@ -53561,21 +53569,25 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
<ol><li><p>Let <var title="">cache</var> be the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
cache</a> in <var title="">cache group</var>.</li>

<li><p>Let <var title="">task list</var> be an empty list of
<a href=#concept-task title=concept-task>tasks</a>.</p>

<li>

<p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
entries</a>, wait for the resource for this entry to have
either completely downloaded or failed.</p>

<p>If the download failed (e.g. the connection times out, or the
user cancels the download), then <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-error><a href=#event-appcache-error>error</a></code> at the
user cancels the download), then create a <a href=#concept-task title=concept-task>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 <a href=#cache-host>cache
host</a> the <code>Document</code> for this entry, if there
still is one. 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 of user interface indicating to the user that the user
agent failed to save the application for offline use.</p>
still is one, and add it to <var title="">task list</var>. 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 of
user interface indicating to the user that the user agent failed
to save the application for offline use.</p>

<p>Otherwise, associate the <code>Document</code> for this entry
with <var title="">cache</var>; store the resource for this
Expand All @@ -53593,13 +53605,14 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp

<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-noupdate><a href=#event-appcache-noupdate>noupdate</a></code> at the
group</var>, create a <a href=#concept-task title=concept-task>task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</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 sort of user interface indicating to the user that the
application is up to date.</li>
host</a>, and add it to <var title="">task list</var>. 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 sort of
user interface indicating to the user that the application is up
to date.</li>

<li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
entries</a>.</li>
Expand All @@ -53609,6 +53622,9 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp

<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>Abort the <a href=#application-cache-download-process>application cache download
process</a>.</li>

Expand Down Expand Up @@ -53906,31 +53922,32 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
<li><p>Set the <a href=#concept-appcache-completeness title=concept-appcache-completeness>completeness flag</a> of
<var title="">new cache</var> to <i>complete</i>.</li>

<li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

<li>

<p>If this is a <a href=#concept-appcache-cache title=concept-appcache-cache>cache
attempt</a>, then 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-cached><a href=#event-appcache-cached>cached</a></code> at the
group</var>, create a <a href=#concept-task title=concept-task>task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> that is cancelable named <code title=event-appcache-cached><a href=#event-appcache-cached>cached</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 sort of user interface indicating to the user that the
application has been cached and that they can now use it
offline.</p>
host</a>, and add it to <var title="">task list</var>. 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 sort of
user interface indicating to the user that the application has
been cached and that they can now use it offline.</p>

<p>Otherwise, it is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>. 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-updateready><a href=#event-appcache-updateready>updateready</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 sort of user interface indicating to the user that a new
version is available and that they can activate it by reloading
the page.</p>
cache</a> in <var title="">cache group</var>, create a <a href=#concept-task title=concept-task>task</a> to <a href=#fire-a-simple-event>fire a simple
event</a> that is cancelable named <code title=event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> at the
<code><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host>cache
host</a>, and add it to <var title="">task list</var>. 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 sort of
user interface indicating to the user that a new version is
available and that they can activate it by reloading the page.</p>

</li>

Expand All @@ -53941,9 +53958,14 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
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>

</ol><p>The <dfn id=cache-failure-steps>cache failure steps</dfn> are as follows:</p>

<ol><li>
<ol><li><p>Let <var title="">task list</var> be an empty list of <a href=#concept-task title=concept-task>tasks</a>.</p>

<li>

<p>For each entry in <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
entries</a>, run the following further substeps. These steps
Expand All @@ -53955,26 +53977,28 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
<li><p>Unassociate the <code>Document</code> for this entry from
its <a href=#application-cache>application cache</a>, if it has one.</li>

<li><p><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-error><a href=#event-appcache-error>error</a></code> at the
<li><p>Create a <a href=#concept-task title=concept-task>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
default action of these events must be, if the user agent
<a href=#shows-caching-progress>shows caching progress</a>, the display of some sort of
user interface indicating to the user that the user agent failed
to save the application for offline use.</p>
<code>Document</code> for this entry, if there still is one, and
add it to <var title="">task list</var>. 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 sort of user interface
indicating to the user that the user agent failed to save the
application for offline use.</p>

</ol></li>

<li><p>For each <a href=#cache-host>cache host</a> still 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-error><a href=#event-appcache-error>error</a></code> at the
create a <a href=#concept-task title=concept-task>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 <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
sort of user interface indicating to the user that the user agent
failed to save the application for offline use.</li>
host</a>, and add it to <var title="">task list</var>. 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 sort of
user interface indicating to the user that the user agent failed to
save the application for offline use.</li>

<li><p>Empty <var title="">cache group</var>'s <a href=#concept-appcache-pending-masters title=concept-appcache-pending-masters>list of pending master
entries</a>.</li>
Expand All @@ -53994,6 +54018,9 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp
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>Abort the <a href=#application-cache-download-process>application cache download
process</a>.</li>

Expand All @@ -54010,6 +54037,7 @@ <h4 id=downloading-or-updating-an-application-cache><span class=secno>6.9.4 </sp

<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>




Expand Down
Loading

0 comments on commit 174981d

Please sign in to comment.