Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDBDatabase.transaction() has non standard FF option readwriteflush #23010

Merged
merged 1 commit into from
May 11, 2024

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented May 6, 2024

As part of cleaning up docs in mdn/content#33429 I found some very old FF40 notes. One is still valid - a behind a preference option called readwriteflush, which I have added to BCD. Removed notes are:

Note: In Firefox, if you wish to ensure durability for some reason (e.g. you're storing critical data that cannot be recomputed later) you can force a transaction to flush to disk before delivering the complete event by creating a transaction using the experimental (non-standard) readwriteflush mode (see {{domxref("IDBDatabase.transaction")}}.)
> This is currently experimental, and can only be used if the dom.indexedDB.experimental pref is set to true in about:config.

Related docs work can be found in mdn/content#33220

FYI Only I also remove an additional note for FF40 that the transaction default changed to relaxed to match the spec and other browsers. Given that is so long ago, I have not bothered to capture the point at which this compatibility happened. Shown below just for record keeping.

As of Firefox 40, IndexedDB transactions have relaxed durability guarantees to increase performance (see Firefox bug 1112702), which is the same behavior as other IndexedDB-supporting browsers.
Previously in a readwrite transaction, a {{domxref("IDBTransaction.complete_event", "complete")}} event was fired only when all data was guaranteed to have been flushed to disk.
In Firefox 40+ the complete event is fired after the OS has been told to write the data but potentially before that data has actually been flushed to disk.
The complete event may thus be delivered quicker than before, however, there exists a small chance that the entire transaction will be lost if the OS crashes or there is a loss of system power before the data is flushed to disk.
Since such catastrophic events are rare most consumers should not need to concern themselves further.

@github-actions github-actions bot added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label May 6, 2024
@hamishwillee
Copy link
Collaborator Author

@Elchi3 or @queengooborg Can I please get a review on this.

@queengooborg queengooborg merged commit 591a9f5 into mdn:main May 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants