[whatwg] size limits on web databases

>From http://dev.w3.org/html5/webdatabase/:

"The openDatabase() method on the Window and WorkerUtils interfaces
must return a newly constructed Database object that represents the
database requested."

The spec does not make it clear what the UA on an extremely
resource-constrained device (e.g. a mobile phone) should do if the
requested size database size cannot be satisfied. Some implementations
return a null Database object if something has gone wrong in the
openDatabase() call but (at least to me) the spec does not seem to
permit this and simply returning null does not particularly help an
application adapt gracefully to the availability of only a small
database.

Consequently, I would hope that this could be improved in some
fashion. Three possible modifications to the spec occur to me. From
the viewpoint of webdatabase developer, I prefer (1), could work with
(2) and would greatly dislike (3). Is this reasonable?

1. Retain the existing def'n of openDatabase but add a property on
interface Database:
  unsigned long minimumCapacity;
which returns the amount of storage that the UA guarantees to be
present in the database at the time of opening. The UA should try to
set minimumCapacity so that QUOTA_ERR will be extremely unlikely if
the database client code never writes more than minimumCapacity bytes
to the database.

2. A language change:

"The user agent may raise a SECURITY_ERR exception instead of
returning a Database object if the request violates a policy decision
(e.g. if the user agent is configured to not allow the page to open
databases)."

to something like this:

"The user agent must raise a SECURITY_ERR exception instead of
returning a Database object if the request violates a policy decision
(e.g. if the user agent is configured to not allow the page to open
databases) or the estimatedSize of the database cannot currently be
satisfied (e.g. the UA is running from a read-only volume or the
estimatedSize exceeds the free space on the volume.)"

3. An alternative language change:

"The openDatabase() method on the Window and WorkerUtils interfaces
must return a newly constructed Database object that represents the
database requested."

to

"The openDatabase() method on the Window and WorkerUtils interfaces
must return a newly constructed Database object that represents the
database requested or null if openDatabase call has failed."


Rob.

-- 
Rob Kroeger
rjkroege at liqui.org
http://www.liqui.org

Received on Thursday, 13 August 2009 08:52:00 UTC