[whatwg] Something better than DOM_QUOTA_ERROR when LocalStorage is immutable?
Ian Hickson
ian at hixie.ch
Fri Jun 12 17:47:18 PDT 2009
On Wed, 3 Jun 2009, Jeremy Orlow wrote:
>
> When in "private browsing" mode, WebKit should not write any data to the
> hard drive. In addition, WebKit does not allow changes to localStorage
> that aren't going to be written to disk. Currently, it returns a
> DOM_QUOTA_ERROR on setItem when private browsing is enabled, and
> silently fails for removeItem and clear. The silent failures are
> obviously bad, but even the (ab)use of DOM_QUOTA_ERROR kind of bothers
> me.
This model is treating "private browsing" as a user-enabled emulation of a
hardware limitation (read-only storage media), and as such the behaviour
is more or less left up to the user agent. Silent failure and reusing
DOM_QUOTA_ERROR are both reasonable solutions; another would be firing a
custom exception.
> Is there an exciting exception that'd work better to tell the script
> "the change failed because localStorage is currently immutable"? If
> not, is there any chance it could be added to the spec?
This is a similar case as being out of memory, or surviving a page fault,
or having an I/O error. I suppose we could introduce exceptions for these
cases; that would be something I'd defer to Simon and the Web DOM Core
spec.
> Obviously only browser vendors that share WebKit's philosophy on
> localStorage's "guarantee" of persistence would actually use this, but I
> think it'd be far better than the current behavior.
I don't think this would be specific to localStorage.
--
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