[whatwg] size limits on web databases

Ian Hickson ian at hixie.ch
Fri Aug 28 21:27:35 PDT 2009


On Thu, 13 Aug 2009, Rob Kroeger wrote:
> >
> >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."

Technically, a UA is allowed to do more or less whatever it wants when 
faced with hardware limitations.

However, a literal reading of the spec says it should return a Database, 
and then if writing to it fails due to lack of disk space, should throw or 
flag the QUOTA_ERR. Why is this not adequate?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list