WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
40767
DOM storage should delete databases when they are empty.
https://bugs.webkit.org/show_bug.cgi?id=40767
Summary
DOM storage should delete databases when they are empty.
Hans Wennborg
Reported
2010-06-17 02:25:48 PDT
Even if a page clears its local storage, the database file for it stays around, and there is currently no mechanism that deletes them. After doing the "final sync" of a storage area, the StorageAreaSyncMaster should see if the database is empty, and in that case delete it. This way, an empty local storage will never have a database file.
Attachments
Patch
(9.15 KB, patch)
2010-06-18 01:24 PDT
,
Hans Wennborg
no flags
Details
Formatted Diff
Diff
Patch
(9.23 KB, patch)
2010-06-18 01:37 PDT
,
Hans Wennborg
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Jeremy Orlow
Comment 1
2010-06-17 13:19:05 PDT
Sounds like a good plan.
Hans Wennborg
Comment 2
2010-06-18 01:24:40 PDT
Created
attachment 59079
[details]
Patch
WebKit Review Bot
Comment 3
2010-06-18 01:26:08 PDT
Attachment 59079
[details]
did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 WebCore/storage/StorageAreaSync.cpp:35: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Hans Wennborg
Comment 4
2010-06-18 01:37:26 PDT
(In reply to
comment #3
)
>
Attachment 59079
[details]
did not pass style-queue: > > Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 > WebCore/storage/StorageAreaSync.cpp:35: Alphabetical sorting problem. [build/include_order] [4] > Total errors found: 1 in 8 files > > > If any of these errors are false positives, please file a bug against check-webkit-style.
Sorry about that. I now realise the sort should be case sensitive (and the original file must have been in error to begin with).
Hans Wennborg
Comment 5
2010-06-18 01:37:56 PDT
Created
attachment 59081
[details]
Patch
Jeremy Orlow
Comment 6
2010-06-18 18:19:51 PDT
Comment on
attachment 59081
[details]
Patch Looks good to me....2 double-checking type questions tho... WebCore/storage/StorageAreaSync.cpp:421 + m_database.close(); Are we super extra ultra sure that there's no way the database can be used after it's closed? I almost wondr if we should make it an OwnPtr and null it out here so that if we do try to use it later we crash. WebCore/storage/StorageAreaSync.cpp:403 + if (!m_database.isOpen()) When can this happen? Only if it was never opened or something?
Hans Wennborg
Comment 7
2010-06-21 01:27:31 PDT
(In reply to
comment #6
)
> (From update of
attachment 59081
[details]
) > Looks good to me....2 double-checking type questions tho... > > > WebCore/storage/StorageAreaSync.cpp:421 > + m_database.close(); > Are we super extra ultra sure that there's no way the database can be used after it's closed? I almost wondr if we should make it an OwnPtr and null it out here so that if we do try to use it later we crash.
Pretty sure at least. The DeleteEmptyDatabase task is scheduled in scheduleFinalSync(), which is called by StorageAreaImpl::close() which is called by StorageNamespaceImpl::close() which is called by StorageNamespaceImpl's destructor. In effect, StorageAreaImpl should be destructed after deleteEmptyDatabases(). Anyway, the member functions in StorageAreaImpl that use m_database all check for it to be open first, so I don't really see any danger here.
> > WebCore/storage/StorageAreaSync.cpp:403 > + if (!m_database.isOpen()) > When can this happen? Only if it was never opened or something?
Exactly. Since
http://trac.webkit.org/changeset/61023
, if there was no previous database file, no new database file is created (thus no db opened) unless something needs to be written to it.
WebKit Commit Bot
Comment 8
2010-06-21 07:50:44 PDT
Comment on
attachment 59081
[details]
Patch Clearing flags on attachment: 59081 Committed
r61542
: <
http://trac.webkit.org/changeset/61542
>
WebKit Commit Bot
Comment 9
2010-06-21 07:50:48 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug