| Test consistency of IndexedDB's cursor objects. |
| |
| 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) |
| indexedDB.open(dbname) |
| setVersionSuccess(): |
| trans = event.target.transaction |
| PASS trans is non-null. |
| objectStore = db.createObjectStore('basicStore') |
| objectStore.add('someValue1', 'someKey1').onerror = unexpectedErrorCallback |
| objectStore.add('someValue2', 'someKey2').onerror = unexpectedErrorCallback |
| objectStore.add('someValue3', 'someKey3').onerror = unexpectedErrorCallback |
| objectStore.add('someValue4', 'someKey4').onerror = unexpectedErrorCallback |
| openBasicCursor() |
| trans = db.transaction(['basicStore'], 'readwrite') |
| trans.objectStore('basicStore') |
| objectStore.openCursor(keyRange) |
| |
| checkCursor() |
| storedCursor = event.target.result |
| PASS storedCursor is event.target.result |
| PASS storedCursor.key is "someKey1" |
| PASS event.target.result.key is "someKey1" |
| PASS storedCursor.value is "someValue1" |
| PASS event.target.result.value is "someValue1" |
| event.target.result.continue() |
| |
| checkCursor() |
| PASS storedCursor is event.target.result |
| PASS storedCursor.key is "someKey2" |
| PASS event.target.result.key is "someKey2" |
| PASS storedCursor.value is "someValue2" |
| PASS event.target.result.value is "someValue2" |
| event.target.result.continue() |
| |
| checkCursor() |
| PASS storedCursor is event.target.result |
| PASS storedCursor.key is "someKey3" |
| PASS event.target.result.key is "someKey3" |
| PASS storedCursor.value is "someValue3" |
| PASS event.target.result.value is "someValue3" |
| event.target.result.continue() |
| |
| checkCursor() |
| PASS storedCursor is event.target.result |
| PASS storedCursor.key is "someKey4" |
| PASS event.target.result.key is "someKey4" |
| PASS storedCursor.value is "someValue4" |
| PASS event.target.result.value is "someValue4" |
| event.target.result.continue() |
| |
| checkCursor() |
| PASS counter is 5 |
| transactionComplete() |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |