Closed kegsay closed 2 months ago
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.
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.
The IDBDatabase.webidl has:
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.