This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
We recently fixed a bug in Chromium, but it looks like it affects Firefox as well and is implicit in the web-platform-tests suite (key_invalid.htm) var store = db.createObjectStore('store', {keyPath: 'keypath'}); var values = ['string1', 'string2']; var obj = { get keypath() { return values.shift(); } }; store.put(obj); store.openCursor().onsuccess = function(e) { console.log('key is: ' + e.target.result.key); console.log('value has: ' + JSON.stringify(e.target.result.value.keypath)); }; In FF33 the key is 'string1' and the value has 'string2'. Having these out of sync seems like a violation of the intent of the spec, although the letter of the spec does imply tests before cloning. In Chromium (circa 38) we clone, then evaluate the keypaths, so the result is 'string1' / 'string1'. This manifests in the key_invalid.htm test since it provides invalid key values such as function(){}. In Chromium we return DataCloneError since we clone before evaluating, whereas the test looks for DataError since it assumes evaluation before cloning.
I agree that the spec should call for first cloning, then evaluating the keypath on the clone.
Yeah we discussed this at Mozilla a year or two ago and came to a similar conclusion. Fixing it hasn't been a priority for us yet though.
This has been "fixed" in the V2 spec, although it may not match reality exactly. https://w3c.github.io/IndexedDB/