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 webidl is incomplete #3959

Closed
kegsay opened this issue May 13, 2024 · 2 comments · Fixed by #4028
Closed

IDBDatabase webidl is incomplete #3959

kegsay opened this issue May 13, 2024 · 2 comments · Fixed by #4028
Labels

Comments

@kegsay
Copy link

kegsay commented May 13, 2024

The IDBDatabase.webidl has:

    IDBTransaction transaction ((DOMString or sequence<DOMString>) storeNames,
                                optional IDBTransactionMode mode = "readonly");

However, this is missing the options field as detailed on MDN. The main (only?) option this presents is a critical one however: https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/transaction#options as it provides the only way to actually make IndexedDB durable.

Is there any reason why this field is missing, and if not, can it be added? Otherwise it makes creating robust WASM code via Rust effectively impossible as you can't be sure your writes are tolerant to power failures / OS crashes.

@Liamolucko
Copy link
Collaborator

wasm-bindgen's WebIDL files were all copied from Firefox several years ago, and have been manually updated to add new APIs over the years. Firefox only seems to have implemented options recently, meaning that it wasn't in their WebIDL file back when we copied it and we still don't have it because nobody's added it since.

Feel free to make a PR adding it! There are instructions at https://rustwasm.github.io/wasm-bindgen/contributing/web-sys/supporting-more-web-apis.html. The WebIDL function definition should be the same as the one provided by the spec at https://w3c.github.io/IndexedDB/#idl-index.

In the long term, #2983 is the solution for how to stop things getting outdated like this in the first place.

@kegsay
Copy link
Author

kegsay commented May 14, 2024

Firefox's support was only adding the durability property to the IDBTransaction. It's supported the option when creating the transaction much longer I thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants