You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inconsistency between spec and tests for detached arraybuffers; spec for keys says don't throw, test for keys says throw, spec for values says throw
#417
Open
asutherland opened this issue
Mar 26, 2024
· 4 comments
Arguably the current test behavior (which Blink implements) is the most consistent and developer-friendly behavior. It would be weird for a detached arraybuffer to fail as a value but succeed with a potentially incorrect result as a key.
I would propose we:
Modify the IDB spec to explicitly return invalid if "IsDetachedBuffer".
Note this will throw a DataError rather than the TypeError expected by the test. I'm not opposed to retaining TypeError, but it would be good to have some rationale for choosing that given that we otherwise just seem to return DataError and structured serialization returns DataCloneError.
Update the existing test to expect DataError
Add a case for a key that is a JS array that contains a detached arraybuffer.
The text was updated successfully, but these errors were encountered:
Addressed an issue where detached ArrayBuffers were not handled
correctly during IndexedDB key conversion. According to the consensus
arrived in w3c/IndexedDB#417, detached buffers
should result in a DataError. This change ensures that a DataError is
thrown, aligning with the test expectation.
Bug: 40282817
Change-Id: If38cc2effe003f7f4340144a6704e20fae78c543
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5759605
Reviewed-by: Kentaro Hara <[email protected]>
Auto-Submit: Garima Chadha <[email protected]>
Reviewed-by: Rahul Singh <[email protected]>
Reviewed-by: Evan Stade <[email protected]>
Commit-Queue: Kentaro Hara <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1338786}
While addressing a Firefox test failure in idb-binary-key-detached.htm in https://phabricator.services.mozilla.com/D202947 we became aware of a chromium issue https://issues.chromium.org/issues/40282817 which correctly points out that the IDB invocation of getting a copy of the bytes held by the buffer source in convert a value to a key means we shouldn't throw because webidl says to "return the empty byte sequence".
However, StructuredSerializeInternal step 13.2.1 says:
Arguably the current test behavior (which Blink implements) is the most consistent and developer-friendly behavior. It would be weird for a detached arraybuffer to fail as a value but succeed with a potentially incorrect result as a key.
I would propose we:
The text was updated successfully, but these errors were encountered: