[whatwg] Web Storage: apparent contradiction in spec

Brady Eidson beidson at apple.com
Tue Aug 25 14:09:59 PDT 2009

On Aug 25, 2009, at 1:38 PM, Linus Upson wrote:

> It is important that all local state be treated as a cache. User  
> agents need to be free to garbage collect any local state. If they  
> can't then attackers (or the merely lazy) will be able to fill up  
> the user's disk. We can't expect web sites or users to do the chore  
> of taking out the garbage. Better user agents will have better  
> garbage collection algorithms.
> It would be better to remove section 4.3.

I disagree.

One key advantage of LocalStorage and Databases over cookies is that  
they *do* have a predictable, persistent lifetime, and the browser is  
*not* allowed to prune them at will.

User agents are perfectly allowed to not allow new items to go into  
LocalStorage or Database Storage once some quota is met, or if the  
user has disabled it for that domain, or disabled it altogether, or if  
the disk is filling up, or any other number of circumstances.

But once the data is stored, it should be considered user data - as  
"sacred" as a user's file on the file system.

> Linus
> On Tue, Aug 25, 2009 at 1:18 PM, Jens Alfke <snej at google.com> wrote:
> I've just noticed an apparent self-contradiction in the Web Storage  
> spec (24 August draft).
> Section 4.3 states:
>> Data stored in local storage areas should be considered potentially  
>> user-critical. It is expected that Web applications will use the  
>> local storage areas for storing user-written documents.
> Section 6.1 states:
>> User agents should present the persistent storage feature to the  
>> user in a way that does not distinguish them from HTTP session  
>> cookies.
> These statements are contradictory, because cookies don't store user- 
> critical data such as documents. The user model of cookies is that  
> they're conveniences (at best) for keeping you logged into a site or  
> remembering preferences like font-size, so deleting them is no more  
> than an inconvenience. If local storage is presented to the user as  
> being cookies, then a user may delete it without understanding the  
> consequences.
> Potential result: "I was having trouble logging into FooDocs.com, so  
> my friend suggested I delete the cookies for that site. After that I  
> could log in, but now the document I was working on this morning has  
> lost all the changes I made! How do I get them back?"
> I suggest that the sub-section "Treating persistent storage as  
> cookies" of section 6.1 be removed.

I agree that the wording of the section needs great improvement and it  
is factually wrong in its current form.  That said, I don't think it  
should be removed.

I *think* Ian's intention was that in the same vein that user agents  
are "obligated" to present all of the cookies stored on the disk at  
any given time and allow manual management of them, they should be  
"obligated" to do the same for LocalStorage (and databases, too).

If I'm wrong, hopefully he can correct me.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090825/437ff338/attachment.htm>

More information about the whatwg mailing list