IndexedDB data stored on the file system can be lost due to factors beyond the browser's control, such as when users directly delete the files containing the data.
Total data loss of the database
or object store
is visible to the script as an absence of data, and can be appropriately handled by it.
However, since the current specification does not mandate consistent data storage, there is a chance of partial data loss where the entry for a record
exists in the object store
but the contents of the record
are lost.
For example, both Chromium and Firefox store blobs and large values in files separate from the main database, which only contains references to these files.
When those files are deleted, the references in the database become dangling and attempts to read the data fail permanently.
The specification does not cover the above scenario, and hence the DOMException
thrown varies by browser:
name
: NotFoundError
(updated recently)message
: "Failed to read large IndexedDB value"name
: UnknownError
message
: "The operation failed for reasons unrelated to the database itself and not covered by any other error code."Specifying a common DOMException
for such cases of partial data loss will help developers handle these scenarios consistently across browsers.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3