spec/Overview.html 1.1525 2352 Appcache: Change the approach used for t

Appcache: Change the approach used for the dynamic entries API so that
it makes more sense in a threaded environment. (whatwg r2352)

5.7.6 Application cache API
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#application-cache-api
add(url)
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-add
items
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-items
remove(url)
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-remove
update()
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-update
OBSOLETE
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-obsolete
hasItem(url)
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1525.html#dom-appcache-hasitem

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.1524&r2=1.1525&f=h
http://html5.org/tools/web-apps-tracker?from=2351&to=2352

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1524
retrieving revision 1.1525
diff -u -d -r1.1524 -r1.1525
--- Overview.html 18 Oct 2008 00:03:48 -0000 1.1524
+++ Overview.html 18 Oct 2008 01:28:22 -0000 1.1525
@@ -28418,8 +28418,8 @@
   void <a href=#dom-appcache-swapcache title=dom-appcache-swapCache>swapCache</a>();
 
   // dynamic entries
-  readonly attribute unsigned long <a href=#dom-appcache-length title=dom-appcache-length>length</a>;
-  DOMString <a href=#dom-appcache-item title=dom-appcache-item>item</a>(in unsigned long index);
+  readonly attribute <span>DOMStringList</span> <a href=#dom-appcache-items title=dom-appcache-items>items</a>;
+  boolean <a href=#dom-appcache-hasitem title=dom-appcache-hasItem>hasItem</a>(in DOMString url);
   void <a href=#dom-appcache-add title=dom-appcache-add>add</a>(in DOMString url);
   void <a href=#dom-appcache-remove title=dom-appcache-remove>remove</a>(in DOMString url);
 
@@ -28501,22 +28501,33 @@
    <i>obsolete</i> <a href=#concept-appcache-lifecycle title=concept-appcache-lifecycle>lifecycle
    status</a>.</dd>
 
-  </dl><p>The <dfn id=dom-appcache-length title=dom-appcache-length><code>length</code></dfn>
-  attribute must return the number of <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entries</a> in the
-  <a href=#application-cache>application cache</a> with which the
-  <code><a href=#applicationcache>ApplicationCache</a></code> object is associated, if any, and zero
-  if the object is not associated with any application cache.<p>The <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entries</a>
+  </dl><hr><p>The <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entries</a>
   in the <a href=#application-cache>application cache</a> are ordered in the same order
   as they were added to the cache by the <code title=dom-appcache-add><a href=#dom-appcache-add>add()</a></code> method, with the oldest entry
-  being the zeroth entry, and the most recently added entry having the
-  index <span><code title=dom-appcache-length><a href=#dom-appcache-length>length</a></code>-1</span>.<p>The <dfn id=dom-appcache-item title=dom-appcache-item><code>item(<var title="">index</var>)</code></dfn> method must return the
-  <a href=#absolute-url>absolute URL</a> of the <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entry</a> with index
-  <var title="">index</var> from the <a href=#application-cache>application cache</a>,
-  if one is associated with the <code><a href=#applicationcache>ApplicationCache</a></code>
-  object. If the object is not associated with any application cache,
-  or if the <var title="">index</var> argument is lower than zero or
-  greater than <span><code title=dom-appcache-length><a href=#dom-appcache-length>length</a></code>-1</span>, the method must
-  instead raise an <code>INDEX_SIZE_ERR</code> exception.<p>The <dfn id=dom-appcache-add title=dom-appcache-add><code>add(<var title="">url</var>)</code></dfn> method must run the following
+  being the zeroth entry.<p>The <dfn id=dom-appcache-items title=dom-appcache-items><code>items</code></dfn> DOM
+  attribute must return a new <code>DOMStringList</code> object. If
+  the <code><a href=#applicationcache>ApplicationCache</a></code> object has an associated
+  <a href=#application-cache>application cache</a> with one or more <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entries</a>, then the
+  <code>DOMStringList</code> object's items must be the <a href=#absolute-url title="absolute URL">absolute URLs</a> of the <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entries</a> in that
+  <a href=#application-cache>application cache</a>, in order; otherwise, the object must
+  have no entries.<p>The <dfn id=dom-appcache-hasitem title=dom-appcache-hasItem><code>hasItem(<var title="">url</var>)</code></dfn> method must run the following
+  steps:<ol><li><p>If the <code><a href=#applicationcache>ApplicationCache</a></code> object is not
+   associated with any application cache, then raise an
+   <code>INVALID_STATE_ERR</code> exception and abort these
+   steps.</li>
+
+   <li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> the <var title="">url</var> argument. If this fails, raise a
+   <code>SYNTAX_ERR</code> exception and abort these steps.</li>
+
+   <li><p>If there is already a resource in in the <a href=#application-cache>application
+   cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object is
+   associated that has the address <var title="">url</var>, and that
+   entry is categorized as a <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entry</a>, then return
+   true.</li>
+
+   <li><p>Otherwise, return false.</li>
+
+  </ol><p>The <dfn id=dom-appcache-add title=dom-appcache-add><code>add(<var title="">url</var>)</code></dfn> method must run the following
   steps:<ol><li><p>If the <code><a href=#applicationcache>ApplicationCache</a></code> object is not
    associated with any application cache, then raise an
    <code>INVALID_STATE_ERR</code> exception and abort these
@@ -28543,26 +28554,10 @@
    or equivalent, or if there were network errors, or if the user
    canceled the download, then abort these steps.</li>
 
-   <li>
-
-    <p>Wait for there to be no running scripts, or at least no running
-    scripts that can reach an <code><a href=#applicationcache>ApplicationCache</a></code> object
-    associated with the <a href=#application-cache>application cache</a> with which this
-    <code><a href=#applicationcache>ApplicationCache</a></code> object is associated.</p>
-
-    <p>Add the fetched resource to the <a href=#application-cache>application cache</a>
-    and categorize it as a <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entry</a> before
-    letting any such scripts resume.</p>
-  
-   </li>
+   <li><p>Add the fetched resource to the <a href=#application-cache>application
+   cache</a> and categorize it as a <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entry</a>.</li>
 
-  </ol><p class=XXX>We can make the add() API more usable
-  (i.e. make it possible to detect progress and distinguish success
-  from errors without polling and timeouts) if we have the method
-  return an object that is a target of Progress Events, much like the
-  <a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/XMLHttpRequest-2/Overview.html?content-type=text/html;%20charset=utf-8#xmlhttprequesteventtarget-interface">XMLHttpRequestEventTarget</a>
-  interface. This would also make this far more complex to spec and
-  implement.<p>The <dfn id=dom-appcache-remove title=dom-appcache-remove><code>remove(<var title="">url</var>)</code></dfn> method must <a href=#resolve-a-url title="resolve a
+  </ol><p>The <dfn id=dom-appcache-remove title=dom-appcache-remove><code>remove(<var title="">url</var>)</code></dfn> method must <a href=#resolve-a-url title="resolve a
   url">resolve</a> the <var title="">url</var> argument and, if
   that is successful, remove the <a href=#concept-appcache-dynamic title=concept-appcache-dynamic>dynamic entry</a> categorization
   of any entry whose address is the resulting <a href=#absolute-url>absolute
@@ -28572,7 +28567,8 @@
   must be removed entirely (such that if it is re-added, it will be
   loaded from the network again). If the <code><a href=#applicationcache>ApplicationCache</a></code>
   object is not associated with any application cache, then the method
-  must raise an <code>INVALID_STATE_ERR</code> exception instead.<p>If the <dfn id=dom-appcache-update title=dom-appcache-update><code>update()</code></dfn> method is
+  must raise an <code>INVALID_STATE_ERR</code> exception instead.<p class=warning>Authors should bear in mind that multiple scripts
+  could be simultaneously modifying the same application cache.</p><hr><p>If the <dfn id=dom-appcache-update title=dom-appcache-update><code>update()</code></dfn> method is
   invoked, the user agent must invoke the <a href=#application-cache-update-process>application cache
   update process</a>, in the background, for the <a href=#application-cache>application
   cache</a> with which the <code><a href=#applicationcache>ApplicationCache</a></code> object is

Received on Saturday, 18 October 2008 01:32:16 UTC