[whatwg] Application Cache Quota Proposal

Joseph Pecoraro pecoraro at apple.com
Mon Jul 19 16:06:24 PDT 2010


Proposal to Add Per-Origin Quotas to Application Cache:
-------------------------------------------------------

    Application Caches right now do not have any storage limitations. This has
    clear issues when used on devices with limited storage capacity. Other
    programmatic client side storages do have quotas mentioned in their specs
    or in practice:

      - Web Storage StorageAreas (localStorage and sessionStorage)
        QUOTA_EXCEEDED_ERR exception when reaching their quota.
        http://dev.w3.org/html5/webstorage/

      - Web SQL Databases
        QUOTA_EXCEEDED_ERR exception when reaching its quota.
        http://dev.w3.org/html5/webdatabase/

      - Indexed DB
        RECOVERABLE_ERR exception when "... or the storage quota was reached ... "
        http://www.w3.org/TR/IndexedDB/

      - Cookies
        "Minimum size" a client should support was stated in the HTTP Spec as
        4kb, so that is often quoted and respected as the size to not exceed.

    These quotas are often global, some kind of user setting, or are
    per-origin. Application Caches are missing such a quota.

    The entire "Disk Space" section of Web SQL Databases could equally apply
    to Application Caches:
    http://dev.w3.org/html5/webdatabase/#disk-space


Current Behavior:
-----------------

  The manifest file specifies the resources to cache, and the user agent
  caches each resource. There may be multiple application caches for a
  single domain. Be it through multiple Application Hosts, or multiple
  Application Groups (unique by their manifest URL, but not domain).

  A user agent can do as it pleases, but the only real limit is the remaining
  space of the file system. If a resource cannot be cached because there is no
  more space left, there is no way around that.
  
  The likely behavior would be the user agent emits an "error" event. However,
  storage limits are not specified in the spec as an error condition:
  http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#event-appcache-error


Suggested Additions to the Spec:
--------------------------------

  Under the "error" event description [1], suggest that it could be fired as a
  result of reaching a quota limit. The spec often uses the phrase "store this
  resource". That part could just be described somewhere in the specification
  as possibly raising an "error" event.
  
  The phrasing in the other Specs are:
  
    [[ (Setting could fail if, e.g., the user has disabled storage for the
       site, or if the quota has been exceeded.) ]]
    
    [[ The statement failed because there was not enough remaining storage
       space, or the storage quota was reached and the user declined to give
       more space to the database. ]]
    
    [[ For example, there was not enough remaining storage space, or the
       storage quota was reached and the user declined to give more space to
       the database. ]]

  I would most like to see something like the "Disk Space" section of Web SQL
  Databases. This section describes actions the user agent "should" take to
  give the user some control over the quota. Such as viewing, setting, and
  being notified when the quota is reached:
  http://dev.w3.org/html5/webdatabase/#disk-space


Use Cases:
----------

  These would be the same as the use cases for quotas or storage limits on
  all the other client side storage implementations which have quotas. But
  this would also be useful to define the expected behavior when reaching
  such limits for interoperability between Application Cache implementations.

Cheers,
- Joe


[1]: http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#event-appcache-error

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100719/8178236e/attachment-0002.htm>


More information about the whatwg mailing list