axemclion/IndexedDBShim — pull request #153 by marianoguerra (2014-07-30 15:00:27+00:00)
Title: Fix createindex race condition

before this patch all createIndex calls set the ready state flag to true using the same key (createIndex), so if more than one index was created then when the first finished it seemed from the outside as if all of them finished.

the fix calls setReadyState with the indexName as key so it's different for each one.

it also makes getStoreProps to wait for the store and the index before running.

since it has to wait for everything and it's called from createIndex which sets a ready state for itself to false we have to move waitForReady from getStoreProps to it's callers (which are the ones that call deriveKey), to avoid having a transaction span more than one 'stack' (if waitForReady actually waits getStoreProps will be called later and will use a transaction created before) we make the calls to waitForReady in add and put.