W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: [IndexedDB] Current editor's draft

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 10 Jul 2010 09:55:19 -0700
Message-ID: <AANLkTim9e-iGvrxLMcRxL5EzBqjGb-_KvM4cWuj0AwRF@mail.gmail.com>
To: Nikunj Mehta <nikunj@o-micron.com>
Cc: Andrei Popescu <andreip@google.com>, public-webapps <public-webapps@w3.org>
On Fri, Jul 9, 2010 at 6:27 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>> I also did not hear from you about explicit commits. Did that mean that you agree with that part of my proposal? There are several examples where it makes sense to explicitly commit, although it is automatic in some cases.
>
> I haven't yet had time to analyze this. I wanted to do so before
> commenting. I don't have time right now, but will do so tomorrow.

Ok, I looked at the example functions that you supplied in the
original email in this thread.

As far as I can see, in every instance where you are calling
.commit(), if you simply removed the call to .commit() that would not
change the behavior of the code. Am I missing something?

The only exception is the following code in processShipment:

     var txnRequest = event.transaction.commit();
     // before the callback, commit the stored record
     var key = event.result;
     txnRequest.oncommit = function() {
       callback(key); // which is the key generated during storage
     }
     txnRequest.onerror = shipmentProcessingError;

where you are using the return value from .commit(). However I suspect
there is a bug in this code as .commit() in your proposal is defined
to return void. And even if it does return an IDBRequest, that object
does not have an oncommit property. I suspect you intended the code to
say:

     event.transaction.commit();
     // before the callback, commit the stored record
     var key = event.result;
     event.transaction.oncomplete = function() {
       callback(key); // which is the key generated during storage
     }
     event.transaction.onerror = shipmentProcessingError;

With this fix, here too the call to .commit() seems to be removeable
without affecting behavior.

Please let me know if I'm missing something?

/ Jonas
Received on Saturday, 10 July 2010 16:56:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:39 GMT