<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 26, 2009, at 4:01 PM, Linus Upson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Baskerville; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>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.</div></span></blockquote><br></div><div>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.</div><div><br></div><div>Also, you're not counting files that you <i>create</i> 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.</div><div><br></div><div>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, <i>the local storage represents the only copy of the data</i>. 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.</div><div><br></div><div><blockquote type="cite"><div>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?"</div></blockquote><div><br></div><div>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/.)</div><div><br></div><div>First, this is what quotas are for. The TV web-app would have a limited quota of space to cache stuff.</div><div>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".</div><div><br></div><div><blockquote type="cite"><div>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.</div></blockquote><div><br></div><div>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.</div><div><br></div><div>To repeat what I said up above: <b>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.</b></div><div><br></div><div>—Jens</div></div></div></body></html>