This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26492 - IndexedDB: add/put/update operations should define ordering of clone vs. keypath evaluation
Summary: IndexedDB: add/put/update operations should define ordering of clone vs. keyp...
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2014-07-31 23:45 UTC by Joshua Bell
Modified: 2015-05-19 22:15 UTC (History)
4 users (show)

See Also:


Description Joshua Bell 2014-07-31 23:45:19 UTC
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.openCursor().onsuccess = function(e) {
  console.log('key is: ' +;
  console.log('value has: ' + JSON.stringify(;

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.
Comment 1 Jonas Sicking (Not reading bugmail) 2014-08-01 00:26:25 UTC
I agree that the spec should call for first cloning, then evaluating the keypath on the clone.
Comment 2 Kyle Huey 2014-08-02 03:21:19 UTC
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.
Comment 3 Joshua Bell 2015-05-19 22:15:03 UTC
This has been "fixed" in the V2 spec, although it may not match reality exactly.