IndexedDB: passing empty array to database.transaction considered an error

95 views
Skip to first unread message

Hans Wennborg

unread,
Oct 26, 2011, 5:47:02 AM10/26/11
to Chromium HTML5, David Grogan, jsb...@chromium.org
Hi all,

Chrome's IndexedDB implementation has been deviating from the spec
when it comes to opening transactions. When opening a transaction, one
must pass in a list of object stores which will be the scope of the
transaction. The empty list was interpreted as meaning "all object
stores", but the spec does not actually support this.

In recent discussions [1], it was decided that this was not the
desired behavior and that specifying an empty array for scope should
instead be treated as an error.

This is about to be implemented in Chrome very soon (will be part of
Chrome 17), so please update any code that's relying on the
non-standard behavior.

The preferred thing to do is to actually specify which object stores
should be the scope of the transaction. For example:

var t = db.transaction(['store1', 'store2'], READ_ONLY);

or, if you really want all object stores, you can do:

var t = db.transaction(db.objectStoreNames, READ_ONLY);

Thanks,
Hans

Reply all
Reply to author
Forward
0 new messages