RESOLVED FIXED Bug 90822
IndexedDB: deleteDatabase fails if transaction running in other database
https://bugs.webkit.org/show_bug.cgi?id=90822
Summary IndexedDB: deleteDatabase fails if transaction running in other database
Joshua Bell
Reported 2012-07-09 14:12:04 PDT
If a transaction is running in any database when deleteDatabase() is called, an error event will be fired at the IDBVersionChangeRequest and the delete will fail. At the start of IDBLevelDBBackingStore.cpp there's a test: if (m_currentTransaction) return false; This guards against the deleteDatabase() logic which creates a transaction for the deletion itself - most of the WebKit IDB implementation is currently predicated on only one transaction running at a time. However, nothing outside of the IDBLevelDBBackingStore code treats the delete request as requiring a transaction, so it doesn't defer the delete until there are no transactions against any database. It *should* be safe to allow the IDBLevelDBBackingStore::deleteDatabase() call to run even if there is another transaction running since there will be no overlap in key ranges, as long as m_currentTransaction is either not modified or is restored afterwards.
Attachments
Patch (6.36 KB, patch)
2012-07-09 14:25 PDT, Joshua Bell
no flags
Patch (6.38 KB, patch)
2012-07-09 16:29 PDT, Joshua Bell
no flags
Patch (6.43 KB, patch)
2012-07-09 16:37 PDT, Joshua Bell
no flags
Joshua Bell
Comment 1 2012-07-09 14:25:55 PDT
Joshua Bell
Comment 2 2012-07-09 14:27:01 PDT
dgrogan@, alecflett@ - take a look?
Joshua Bell
Comment 3 2012-07-09 14:28:49 PDT
+jochen@, in case he remembers a reason it wasn't done like this in the first place.
David Grogan
Comment 4 2012-07-09 14:37:11 PDT
Comment on attachment 151319 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=151319&action=review Interested to see if Jochen remembers anything. Not like he's been busy since or anything :) > LayoutTests/storage/indexeddb/deletedatabase-transaction.html:39 > + request.onerror = unexpectedErrorCallback; Could you add request.onblocked = unexpectedBlockedCallback ?
jochen
Comment 5 2012-07-09 14:55:52 PDT
Comment on attachment 151319 [details] Patch IIRC a prior version of the patch used some methods that just used the default transaction. That patch looks good View in context: https://bugs.webkit.org/attachment.cgi?id=151319&action=review > LayoutTests/storage/indexeddb/deletedatabase-transaction.html:31 > + debug(""); nit. indent 4 spaces
Joshua Bell
Comment 6 2012-07-09 16:29:24 PDT
Joshua Bell
Comment 7 2012-07-09 16:37:17 PDT
Joshua Bell
Comment 8 2012-07-09 16:38:14 PDT
(In reply to comment #4) > Could you add request.onblocked = unexpectedBlockedCallback ? Done. (In reply to comment #5) > nit. indent 4 spaces Fixed. tony@ - r?
WebKit Review Bot
Comment 9 2012-07-09 18:46:54 PDT
Comment on attachment 151352 [details] Patch Clearing flags on attachment: 151352 Committed r122179: <http://trac.webkit.org/changeset/122179>
WebKit Review Bot
Comment 10 2012-07-09 18:46:59 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.