[whatwg] Web Storage: apparent contradiction in spec

Jens Alfke snej at google.com
Wed Aug 26 16:51:42 PDT 2009


On Aug 26, 2009, at 4:01 PM, Linus Upson wrote:

> The analogy was made comparing a user agent that purges local  
> storage to an OS throwing out files without explicit user action.  
> This is misleading since most files arrive on your computer's disk  
> via explicit user action. You copy files to your disk by downloading  
> them from the internet, copying from a network drive, from a floppy,  
> your camera, etc.

A web app would also be pretty likely to put stuff in local storage as  
a result of explicit user action. The use cases seem pretty similar.

Also, you're not counting files that you create locally. After all,  
files have to come from somewhere :) Those are the most precious since  
they're yours and they may not live anywhere else if you haven't  
backed them up or copied them elsewhere. There's no reason web-apps  
can't create the same kind of content, and it would look very similar  
to a user: I go to the word processor [website], click New Document,  
type some stuff, and click Save.

Even if the save process involves migrating the local data up to the  
cloud, that transition is not instantaneous: it can take arbitrarily  
large amounts of time if there are network/server problems or the user  
is offline. During that time, the local storage represents the only  
copy of the data. There is therefore a serious race condition where,  
if the browser decides to purge local data before the app has uploaded  
it, the data is gone forever.

> A better analogy would be, "What if watching TV caused 0-5MB size  
> files to silently be created from time to time in a hidden folder on  
> your computer, and when your disk filled up both your TV and  
> computer stopped working?"

This is a cache — that isn't the kind of usage I'm concerned about.  
Maybe the local storage API needs a way to distinguish between cached  
data that can be silently thrown away, and important data that can't.  
(For example, the Mac OS has separate 'Caches' and 'Application  
Support' subfolders of ~/Library/.)

First, this is what quotas are for. The TV web-app would have a  
limited quota of space to cache stuff.
Second, the browser should definitely help you delete stuff like this  
if disk space does get low; I'm just saying it shouldn't delete it  
silently or as part of some misleading command like "Empty Cache" or  
"Delete Cookies".

> At a minimum the HTML 5 spec should be silent on how user agents  
> implement local storage policies. I would prefer the spec to make it  
> clear that local storage is a cache, domains can use up to 5MB of  
> space without interrupting the user, and that UAs were free to  
> implement varying cache eviction algorithms.

That will have the effect of making an interesting category of new  
applications fail, with user data loss, on some browsers. That sounds  
like a really bad idea to me.

To repeat what I said up above: Maybe the local storage API needs a  
way to distinguish between cached data that can be silently thrown  
away, and important data that can't.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090826/d93ae00e/attachment-0002.htm>


More information about the whatwg mailing list