Bug 29991

Summary: Implement per-storage-area quotas for LocalStorage
Product: WebKit Reporter: Jeremy Orlow <jorlow>
Component: New BugsAssignee: Jeremy Orlow <jorlow>
Status: RESOLVED FIXED    
Severity: Normal CC: fishd, yael, zwarich
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch v1 dglazkov: review+, jorlow: commit-queue-

Jeremy Orlow
Reported 2009-10-01 18:38:06 PDT
Implement per-storage-area quotas for LocalStorage There are two previous bugs for this that attempted to solve this in different ways but were eventually abandoned: https://bugs.webkit.org/show_bug.cgi?id=26155 and https://bugs.webkit.org/show_bug.cgi?id=22765 I've cc'ed their owners on this one. I put 90% of the code in StorageMap since the decision to allow an update is closely tied to quota tracking. The quota is set via a page's Settings class. Like with the local storage path and whether it's enabled, it's assumed that all pages in the same group will have the same settings. The setting defaults to 5mb which is what the spec suggests, but it can easily be changed to anything else--including StorageMap::noQuota. Any values in LocalStorage are grandfathered in regarudless of quota, so importItem only tracks (and will never block) imports. I believe this change is a good transition to more complex quota management. For example, if we wanted to track quotas in the SQLite DB, then we'd just add a function to the StorageMap that sets the quota. This would be fine since all use of LocalStorage is blocked on the import completing, so you'd never hit a quota error in the mean time. Also, if embedders wanted to ask the user whether to expand the quota whenever it's hit (before deciding whether or not to raise an exception), a callback via the chrome client should be fairly easy. That said, I think it's best to add these features in steps rather than one huge patch. (Both of these are on my TODO list, btw.) Included is a layout test that verifies the behavior. It assumes the default quota is 5mb (since that's what Settings defaults to). I'll post the patch in a moment.
Attachments
Patch v1 (25.21 KB, patch)
2009-10-01 18:40 PDT, Jeremy Orlow
dglazkov: review+
jorlow: commit-queue-
Jeremy Orlow
Comment 1 2009-10-01 18:40:29 PDT
Created attachment 40489 [details] Patch v1
Dimitri Glazkov (Google)
Comment 2 2009-10-02 11:53:40 PDT
Comment on attachment 40489 [details] Patch v1 r=me.
Yael
Comment 3 2009-10-05 13:39:21 PDT
*** Bug 22765 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.