From 665ee150a6edbd070b85141fb6ac08103e96af06 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Mon, 1 Sep 2025 18:22:19 -0700 Subject: [PATCH] indexeddb: Return error instead of panicking on structured clone failure (#39078) Related to failures in #38847 Testing: WPT --------- Signed-off-by: Ashwin Naren --- components/script/indexed_db.rs | 2 +- tests/wpt/meta/IndexedDB/crashtests/create-index.any.js.ini | 2 +- tests/wpt/meta/IndexedDB/idb-binary-key-detached.any.js.ini | 2 -- tests/wpt/meta/IndexedDB/idbfactory_open.any.js.ini | 6 +++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/components/script/indexed_db.rs b/components/script/indexed_db.rs index 3725475a182..fc022b71bce 100644 --- a/components/script/indexed_db.rs +++ b/components/script/indexed_db.rs @@ -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())); } diff --git a/tests/wpt/meta/IndexedDB/crashtests/create-index.any.js.ini b/tests/wpt/meta/IndexedDB/crashtests/create-index.any.js.ini index ffe92f91853..1732fc6bad3 100644 --- a/tests/wpt/meta/IndexedDB/crashtests/create-index.any.js.ini +++ b/tests/wpt/meta/IndexedDB/crashtests/create-index.any.js.ini @@ -5,7 +5,7 @@ [create-index.any.worker.html] - expected: TIMEOUT + expected: CRASH [Assure no crash when populating index] expected: TIMEOUT diff --git a/tests/wpt/meta/IndexedDB/idb-binary-key-detached.any.js.ini b/tests/wpt/meta/IndexedDB/idb-binary-key-detached.any.js.ini index 1515fbb8207..ae7683b63b4 100644 --- a/tests/wpt/meta/IndexedDB/idb-binary-key-detached.any.js.ini +++ b/tests/wpt/meta/IndexedDB/idb-binary-key-detached.any.js.ini @@ -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 diff --git a/tests/wpt/meta/IndexedDB/idbfactory_open.any.js.ini b/tests/wpt/meta/IndexedDB/idbfactory_open.any.js.ini index 61c12060734..8c9c0fd484e 100644 --- a/tests/wpt/meta/IndexedDB/idbfactory_open.any.js.ini +++ b/tests/wpt/meta/IndexedDB/idbfactory_open.any.js.ini @@ -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