Test interleaved open/close/setVersion calls in various permutations

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
PASS Boolean(indexedDB && IDBCursor && IDBDatabase && IDBDatabaseError && IDBDatabaseException && IDBFactory && IDBIndex && IDBKeyRange && IDBObjectStore && IDBRequest && IDBTransaction) is true


TEST: setVersion blocked on open handles
self.dbname = 'test1'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h2.open'
'h2.open.onsuccess'
'h1.setVersion'
'h2.onversionchange'
    h2 closing, but not immediately
'h1.setVersion.onblocked'
'h2.close'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
PASS self.steps.toString() is "h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h2.onversionchange,h1.setVersion.onblocked,h2.close,h1.setVersion.onsuccess,h1.setVersion.transaction-complete"

TEST: setVersion not blocked if handle closed immediately
self.dbname = 'test2'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h2.open'
'h2.open.onsuccess'
'h1.setVersion'
'h2.onversionchange'
    h2 closing immediately
'h2.close'
'h1.setVersion.onblocked'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
NOTE: Will FAIL with extra bogus h1.setVersion.onblocked step; https://bugs.webkit.org/show_bug.cgi?id=71130
FAIL self.steps.toString() should be h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h2.onversionchange,h2.close,h1.setVersion.onsuccess,h1.setVersion.transaction-complete. Was h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h2.onversionchange,h2.close,h1.setVersion.onblocked,h1.setVersion.onsuccess,h1.setVersion.transaction-complete.

TEST: open and setVersion blocked if a VERSION_CHANGE transaction is running - close when blocked
self.dbname = 'test3'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h2.open'
'h2.open.onsuccess'
'h1.setVersion'
'h2.setVersion'
'h2.onversionchange'
'h1.setVersion.onblocked'
'h1.onversionchange'
'h2.setVersion.onblocked'
    h2 blocked so closing
'h2.close'
'h3.open'
'h2.setVersion.onerror'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
'h3.open.onsuccess'
PASS self.steps.toString() is "h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h2.setVersion,h2.onversionchange,h1.setVersion.onblocked,h1.onversionchange,h2.setVersion.onblocked,h2.close,h3.open,h2.setVersion.onerror,h1.setVersion.onsuccess,h1.setVersion.transaction-complete,h3.open.onsuccess"

TEST: open and setVersion blocked if a VERSION_CHANGE transaction is running - just close
self.dbname = 'test4'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h2.open'
'h2.open.onsuccess'
'h1.setVersion'
'h3.open'
'h2.close'
'h1.setVersion.onblocked'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
'h3.open.onsuccess'
NOTE: Will FAIL with extra bogus h1.setVersion.onblocked step; https://bugs.webkit.org/show_bug.cgi?id=71130
FAIL self.steps.toString() should be h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h3.open,h2.close,h1.setVersion.onsuccess,h1.setVersion.transaction-complete,h3.open.onsuccess. Was h1.open,h1.open.onsuccess,h2.open,h2.open.onsuccess,h1.setVersion,h3.open,h2.close,h1.setVersion.onblocked,h1.setVersion.onsuccess,h1.setVersion.transaction-complete,h3.open.onsuccess.

TEST: open blocked if a VERSION_CHANGE transaction is running
self.dbname = 'test5'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h1.setVersion'
'h2.open'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
'h2.open.onsuccess'
PASS self.steps.toString() is "h1.open,h1.open.onsuccess,h1.setVersion,h2.open,h1.setVersion.onsuccess,h1.setVersion.transaction-complete,h2.open.onsuccess"

TEST: two setVersions from the same connection
self.dbname = 'test6'; self.ver = 1; self.steps = []
'h1.open'
'h1.open.onsuccess'
'h1.setVersion'
'h1.setVersion'
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
half done
'h1.setVersion.onsuccess'
'h1.setVersion.transaction-complete'
PASS self.steps.toString() is "h1.open,h1.open.onsuccess,h1.setVersion,h1.setVersion,h1.setVersion.onsuccess,h1.setVersion.transaction-complete,h1.setVersion.onsuccess,h1.setVersion.transaction-complete"
PASS successfullyParsed is true

TEST COMPLETE

