indexeddb: Return error instead of panicking on structured clone failure (#39078)

Related to failures in #38847

Testing: WPT

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren 2025-09-01 18:22:19 -07:00 committed by GitHub
parent ce8b05738c
commit 665ee150a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 7 deletions

View file

@ -145,7 +145,7 @@ pub fn convert_value_to_key(
if IsArrayBufferObject(*object) || JS_IsArrayBufferViewObject(*object) {
// FIXME:(arihant2math) implement it the correct way (is this correct?)
let key = structuredclone::write(cx, input, None).expect("Could not serialize key");
let key = structuredclone::write(cx, input, None)?;
return Ok(IndexedDBKeyType::Binary(key.serialized.clone()));
}

View file

@ -5,7 +5,7 @@
[create-index.any.worker.html]
expected: TIMEOUT
expected: CRASH
[Assure no crash when populating index]
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[idb-binary-key-detached.any.html]
expected: CRASH
[Detached ArrayBuffers must throw DataError when used as a key]
expected: FAIL
@ -8,7 +7,6 @@
[idb-binary-key-detached.any.worker.html]
expected: CRASH
[Detached ArrayBuffers must throw DataError when used as a key]
expected: FAIL

View file

@ -2,9 +2,6 @@
[IDBFactory.open() - error in version change transaction aborts open]
expected: FAIL
[Calling open() with version argument 1.5 should not throw.]
expected: FAIL
[Calling open() with version argument undefined should not throw.]
expected: FAIL
@ -39,3 +36,6 @@
[Calling open() with version argument 9007199254740991 should not throw.]
expected: FAIL
[Calling open() with version argument 1.5 should not throw.]
expected: FAIL