- From: Nolan Lawson <notifications@github.com>
- Date: Sun, 12 Oct 2025 13:00:56 -0700
- To: w3c/IndexedDB <IndexedDB@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/IndexedDB/issues/476@github.com>
nolanlawson created an issue (w3c/IndexedDB#476) Chromium ([bug](https://issues.chromium.org/issues/40050469)), Gecko ([bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1598164)), and WebKit ([bug](https://bugs.webkit.org/show_bug.cgi?id=227773)) all make transactions inactive during structured serialization of object values. The spec addresses this in the ["clone a value"](https://w3c.github.io/IndexedDB/#clone) algorithm (see also [`structured-clone-transaction-state.any.js`](https://github.com/web-platform-tests/wpt/blob/4ae2deda519dba8c9a13df34a710b66e03446f57/IndexedDB/structured-clone-transaction-state.any.js)). However, the spec does not consider _keys_, which can be arbitrarily set using the second argument to `put()`/`add()`: ```js const array = [0] Object.defineProperty(array, '0', { get() { // can continue to call `store.put` here return 0 } }) store.put({}, array) ``` This unfortunately leads to a discrepancy in browser behavior, as demonstrated by this minimal repro: ```html <!doctype html> <script> const request = indexedDB.open(Math.random(), 1) request.onupgradeneeded = (e) => { const db = e.target.result db.createObjectStore('store') } request.onsuccess = (e) => { const db = e.target.result const store = db.transaction('store', 'readwrite') .objectStore('store') const makeWeirdArray = (depth = 0) => { const array = [0] Object.defineProperty(array, '0', { get() { store.put({}, [1]) return 0 }}) return array } try { store.put({}, makeWeirdArray()) } catch (err) { console.log('Error', err) } } </script> ``` Results: - Chromium 140: `put`s succeed - GNOME Web 46.5 (WebKit 605.1.15): `puts` succeed - Firefox 143: throws `DOMException: A request was placed against a transaction which is currently not active, or which is finished.` (Note that recursive calls result in a `Maximum call stack size exceeded` error in both Chromium and WebKit.) My intuition is that the spec should probably match Firefox's behavior. It seems sensible for both values and keys to throw because the transaction is not currently active. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/IndexedDB/issues/476 You are receiving this because you are subscribed to this thread. Message ID: <w3c/IndexedDB/issues/476@github.com>
Received on Sunday, 12 October 2025 20:01:00 UTC