Invalid return type for key conversion (#39252)

`convert_value_to_key` returns a `ConversionResult` now, so keys can be
considered "Invalid" rather than throwing an exception.

Testing: WPT
Unblocks: #38288

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren 2025-09-11 05:48:18 -07:00 committed by GitHub
parent 19f70dccf6
commit 96592dce44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 23 deletions

View file

@ -211,7 +211,7 @@ impl IDBObjectStore {
let serialized_key: Option<IndexedDBKeyType>;
if !key.is_undefined() {
serialized_key = Some(convert_value_to_key(cx, key, None)?);
serialized_key = Some(convert_value_to_key(cx, key, None)?.into_result()?);
} else {
// Step 11: We should use in-line keys instead
if let Some(Ok(ExtractionResult::Key(kpk))) = self
@ -287,7 +287,7 @@ impl IDBObjectStoreMethods<crate::DomTypeHolder> for IDBObjectStore {
// Step 6
// TODO: Convert to key range instead
let serialized_query = convert_value_to_key(cx, query, None);
let serialized_query = convert_value_to_key(cx, query, None)?.into_result();
// Step 7. Let operation be an algorithm to run delete records from an object store with store and range.
// Stpe 8. Return the result (an IDBRequest) of running asynchronously execute a request with this and operation.
let (sender, receiver) = indexed_db::create_channel(self.global());