The reason I was thinking that deleteObjectStore was async was because it 
returns an IDBRequest interface and the pattern implies that the onsuccess 
handler needs to be called for me to be sure that the operation happened 
successfully.

Regarding the createObjectStore, it returns immediately but the the actual 
object store creation could happen asynchronously in the background. At least 
there is language in the spec that alludes to that fact:

"In some implementations it's possible for the implementation to asynchronously 
run into problems creating the object store after the createObjectStore 
function has returned. . Such implementations must still create and return a 
IDBObjectStore object. Instead, once the implementation realizes that creating 
the objectStore has failed, it must abort the transaction using the steps for 
aborting a transaction."

If we believe that the actual object store creation needs to happen 
synchronously to establish a common behavior between platforms, we should 
stipulate that in the spec.  

Back to the original issue, I like your statement of ensuring that the 
deleteObjectStore removes the objectStore name from the 
IDBDatabase.objectStoreNames immediately after it executes.
If everyone else agrees, we should add some text or a note to the spec to 
capture this.

Israel

On Wed, May 4, 2011 at 9:17 PM, Jeremy Orlow wrote:
> Well, createObjectStore is synchronous, so that one's easy.  Everything 
> happens at once in terms of side effects.
>
> As for delete: why is this asynchronous again?  It seems easiest just to make 
> it sync unless there's some major problem with doing so.
>
> Either way, it seems that the change to objectStoreNames should either happen 
> immediately or when firing the onsuccess event (i.e. not just at some random 
> time in between).
>
> J
> > On Wed, May 4, 2011 at 7:13 AM, Israel Hilerio <[email protected]> 
> > wrote:
> > In looking at createObjectStore on IDBDatabase, it seems that we would have 
> > to update the IDBDatabase.objectStoreNames attribute on the client side 
> > after returning the IDBObjectStore.  Otherwise, it would be difficult > > 
> > to detect that an objectStore with the same name already exists and throw a 
> > CONSTRAINT_ERR exception.
> >
> > Following this pattern, would it make sense to update the 
> > IDBDatabase.objectStoreNames attribute on the client side after executing 
> > deleteObjectStore before the async operation is executed.  This would allow 
> > us to 
> > support scenarios like:
> >
> > var b = db.createObjectStore(B);
> > var req = db.deleteObjectStore(B);
> > b = db.createObjectStore(B);
> >
> > What do you think?
> >
> > Israel


Reply via email to