Commit 8ab4f278 authored by Romain Courteaud's avatar Romain Courteaud

[indexedDBStorage] handle transaction event

Open database is now wrapped into a promise which ensure that the database will be closed as soon as the promise is resolved.
This will allow to open multiple transactions if needed.

Transaction creation is now manage by a promise, which will abort the transaction if cancel is called.

The transaction will also be aborted if an error occurs during its callback function.

As transaction abort will reject all accesses, it is safe to use .then method inside the transaction callback.

Check the transaction error event to detect some browser internal errors (like QuotaExceededError).
Previously, such error was silently ignored, and the jIO client was not aware that the data were not correctly written.

All deletions are now correctly checked, and the method will wait for all deletion to be successfull before returning.

Improve putAttachment algorithm to make it update the previous value and delete only the useless blob chunks.

Reduce the usage of openCursor to not fetch the table content if not needed (like if the index key is enough for example).
parent 1da27f36
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment