My code is like the following:
...
var f1 = function(trans) {
var store = trans.objectStore('ObjectStore');
store.clear();
};
var f2 = function(trans) {
var store = trans.objectStore('ObjectStore');
store.add({id: 1, data: 'text'});
};
...
var trans = DB.connection.transaction(['ObjectStore'], IDBTransaction.READ_WRITE);
trans.onerror = function() { alert('ERROR'); };
trans.oncomplete = function() { alert('DONE'); };
...
The problem us that i get the DONE alert right after clear
and on the second request exception appears.
Is it possible to "reuse" the transaction in IndexedDB?
UPD: I've found that the code above works as I expect in the latest Chromium nightly build.