IndexedDB deleteDatabase doesn't always call callback
Reported by
mattlyo...@gmail.com,
Mar 17 2016
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Steps to reproduce the problem: 1. Navigate to https://jsfiddle.net/m8haL140/2/ 2. Open Console 3. Click 'Create DB' 4. Click 'Delete DB' 5. Wait until 'DB Deleted' message appears in console 6. Click 'Create DB' 7. Click 'Delete DB' 8. Notice 'Deleting..' message is shown in console, indicating click was received and deleteDatabase function was called, however 'DB Deleted' is never shown in console indicating the onsuccess callback is never called. What is the expected behavior? 'DB Deleted' should be shown in console because onsuccess should be called. What went wrong? The DB deletion is not completely processed until the page is reloaded/changed. Upon reloading the page there are no IndexedDB databases visible under the developer tools. Did this work before? N/A Chrome version: 49.0.2623.87 Channel: stable OS Version: Flash Version: Shockwave Flash 20.0 r0 Additionally in the Resources tab of the developer tools upon refreshing IndexedDB the database is still listed, however clicking on it shows no information. Other browsers tested: Firefox 45: OK Chrome-Beta 50.0.2661.37: FAIL Chromium 49.0.2623.87: FAIL
,
Mar 18 2016
Thanks for filing the issue and providing the example. Tried on Linux OS 14.04 with chrome version 51.0.2681.0. Clicking multiple times deletes the DB, no error thrown in console or seen in the Terminal. Attached screen shot for the same. Tried the same on chrome version 49.0.2623.87. when clicked remove db second time no action takes place just "Deleting.." is displayed. Still no error in console. Request you to please guide us if any thing is missed out here. Thanks.!
,
Mar 18 2016
No error is ever provided, it just does not call onsuccess the second time. Looks like it might be fixed in version 51 by your screenshot. The error in terminal shows when clicking the IndexedDB database (named test) in the developer tools after deleting the db the second time.
,
Mar 18 2016
Thank you for providing more feedback. Assigning to requester "ranjitkan@chromium.org" for another review. For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 18 2016
,
Mar 18 2016
The deleteDatabase() call is blocked until after the connection is closed. Since the sample does not close the connection, the delete will block until the connection is closed due to garbage collection.
To see this, add:
deleteDbRequest.on = function(event) {
console.log('Delete Blocked')
};
One way to address this is to watch for "versionchange" events and close the connection to unblock later work, e.g. with this addition:
openDBRequest.onsuccess = function(event) {
console.log('DB Created');
var db = openDBRequest.result;
db.onversionchange = function(e) {
console.log('version change, closing...');
db.close();
};
};
Note that "blocked" event is only sent if there are still connections open after "versionchange" events have been sent out, so if you apply both patches you won't see "blocked"
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by mattlyo...@gmail.com
, Mar 17 2016