WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
213116
[IndexedDB] IDBTransaction.abort() fails to delete database on first connection open
https://bugs.webkit.org/show_bug.cgi?id=213116
Summary
[IndexedDB] IDBTransaction.abort() fails to delete database on first connecti...
charob
Reported
2020-06-12 02:06:14 PDT
There is a use case where if I call abort from within IDBOpenDBRequest's upgradeneeded event, the abort operation does not rollback all changes and fails to delete the database. An example to reproduce the issue: ``` const dBOpenRequest = window.indexedDB.open('myDatabase', 1); dBOpenRequest.onupgradeneeded = event => { const db = event.target.result; console.log(`Upgrading to version ${db.version}`); dBOpenRequest.transaction.abort(); }; ``` After running this code there should be no database created since abort was called. The behavior on Safari is not consistent with Chrome and Firefox. Reference:
https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/abort
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-06-14 19:46:27 PDT
<
rdar://problem/64348260
>
Sihui Liu
Comment 2
2020-06-15 12:08:56 PDT
(In reply to charob from
comment #0
)
> There is a use case where if I call abort from within IDBOpenDBRequest's > upgradeneeded event, the abort operation does not rollback all changes and > fails to delete the database. > > An example to reproduce the issue: > > ``` > const dBOpenRequest = window.indexedDB.open('myDatabase', 1); > > dBOpenRequest.onupgradeneeded = event => { > const db = event.target.result; > console.log(`Upgrading to version ${db.version}`); > dBOpenRequest.transaction.abort(); > }; > ``` > > After running this code there should be no database created since abort was > called. > > The behavior on Safari is not consistent with Chrome and Firefox. > > Reference: >
https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/abort
Hi, when you say no database should be created, do you mean no database file should be created? Or do you see unexpected behavior on next open, like entries are left in the database? If possible, can you attach a full test file?
charob
Comment 3
2020-06-15 13:03:20 PDT
Yea there is an unexpected behavior on the next open call. This use case is if I call abort inside the onupgradeneeded callback for the very first time before creating a Datastore. I have separate calls to indexedDB.open, and the logic to create the Datastore happens after the initial open call where I abort inside the onupgradeneeded since that class is not responsible for the datastore creation. The expected behavior is that when calling abort inside onupgradeneeded during the very first call to open, the database should not be created, as observed in Chrome and Firefox. The problem with leaving the DB created is that on the next indexedDB.open call, onupgradeneeded is never called since the database was already created. There is no API to detect if an indexedDB database exists so I can't write a test for this.
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