Test IndexedDB behavior when iterating backwards with and without NO_DUPLICATE
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "cursor-prev-no-duplicate.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store')
store.createIndex('index', 'sorted')
populating store...
trans = db.transaction('store', 'readwrite', {durability: 'relaxed'})
store = trans.objectStore('store');
store.put({sorted: 3, value: 111}, 1)
store.put({sorted: 2, value: 222}, 2)
store.put({sorted: 1, value: 333}, 3)
store.put({sorted: 10, value: 444}, 17)
store.put({sorted: 10, value: 555}, 16)
store.put({sorted: 10, value: 666}, 15)
testFarRangeCursor: upper bound is well out of range, results always the same, whether open or closed
storeReq = store.openCursor(IDBKeyRange.upperBound(7, false), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 333
DONE
storeReq = store.openCursor(IDBKeyRange.upperBound(7, true), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 333
DONE
storeReq = index.openCursor(IDBKeyRange.upperBound(7, false), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 111
PASS cursor.primaryKey is 1
DONE
storeReq = index.openCursor(IDBKeyRange.upperBound(7, true), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 111
PASS cursor.primaryKey is 1
DONE
storeReq = index.openKeyCursor(IDBKeyRange.upperBound(7, false), 'prev')
PASS cursor.key is 3
PASS cursor.primaryKey is 1
DONE
storeReq = index.openKeyCursor(IDBKeyRange.upperBound(7, true), 'prev')
PASS cursor.key is 3
PASS cursor.primaryKey is 1
DONE
storeReq = store.openCursor(IDBKeyRange.upperBound(3, false), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 333
DONE
storeReq = store.openCursor(IDBKeyRange.upperBound(3, true), 'prev')
PASS cursor.key is 2
PASS cursor.value.value is 222
DONE
storeReq = index.openCursor(IDBKeyRange.upperBound(3, false), 'prev')
PASS cursor.key is 3
PASS cursor.value.value is 111
PASS cursor.primaryKey is 1
DONE
storeReq = index.openCursor(IDBKeyRange.upperBound(3, true), 'prev')
PASS cursor.key is 2
PASS cursor.value.value is 222
PASS cursor.primaryKey is 2
DONE
storeReq = index.openKeyCursor(IDBKeyRange.upperBound(3, false), 'prev')
PASS cursor.key is 3
PASS cursor.primaryKey is 1
DONE
storeReq = index.openKeyCursor(IDBKeyRange.upperBound(3, true), 'prev')
PASS cursor.key is 2
PASS cursor.primaryKey is 2
DONE
testNoDuplicate: there are 3 values, but we should return always the first one
storeReq = store.openCursor(IDBKeyRange.upperBound(15, false), 'prevunique')
PASS cursor.key is 15
PASS cursor.value.value is 666
PASS cursor.primaryKey is 15
DONE
storeReq = index.openCursor(IDBKeyRange.upperBound(15, false), 'prevunique')
PASS cursor.key is 10
PASS cursor.value.value is 666
PASS cursor.primaryKey is 15
DONE
storeReq = index.openKeyCursor(IDBKeyRange.upperBound(15, false), 'prevunique')
PASS cursor.key is 10
PASS cursor.primaryKey is 15
DONE
PASS successfullyParsed is true
TEST COMPLETE