[IndexedDB] Adhere better to the specification for idb object store related operations (#37682)

Many object store related operations require the transaction to be
checked: to ensure it is still active, and, if the operation is a write,
that the transaction is not read-only. I've added the
`check_transaction` method to perform these checks.

Additionally `Clear` was still half-implemented, so I went ahead and
implemented that.

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren 2025-07-15 19:11:06 -07:00 committed by GitHub
parent 2e3c280f46
commit 71e7019d45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 94 additions and 35 deletions

View file

@ -262,6 +262,16 @@ impl KvsEngine for HeedEngine {
.expect("Could not get store");
// FIXME:(arihant2math) Return count with sender
},
AsyncOperation::ReadWrite(AsyncReadWriteOperation::Clear) => {
let stores = stores
.write()
.expect("Could not acquire write lock on stores");
let store = stores
.get(&request.store_name)
.expect("Could not get store");
// FIXME:(arihant2math) Error handling
let _ = store.inner.clear(&mut wtxn);
},
}
}