| Test calling db.open in upgradeneeded. |
| |
| 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; |
| |
| indexedDB.deleteDatabase(dbname) |
| request = indexedDB.open(dbname, 1) |
| request.onupgradeneeded = upgradeNeeded1 |
| request.onsuccess = openSuccess1 |
| |
| upgradeNeeded1(): |
| db = event.target.result |
| PASS event.newVersion is 1 |
| transaction = event.target.transaction |
| db.createObjectStore('os') |
| db.onversionchange = onVersionChange |
| request = indexedDB.open(dbname, 3) |
| request.onupgradeneeded = upgradeNeeded2 |
| request.onsuccess = openSuccess2 |
| |
| transactionOnComplete(): |
| sawTransactionComplete = true |
| |
| openSuccess1(): |
| PASS sawTransactionComplete is true |
| db = event.target.result |
| PASS db.version is 1 |
| Start a transaction to ensure the connection is still open. |
| transaction = db.transaction('os') |
| |
| onVersionChange(): |
| db.close() |
| |
| upgradeNeeded2(): |
| db = event.target.result |
| PASS event.newVersion is 3 |
| |
| openSuccess2(): |
| db = event.target.result |
| PASS db.version is 3 |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |