blob: d065043067621811b1aed89da1024c50f73f576e [file] [log] [blame]
Test lazy IndexedDB index population with various key types.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "lazy-index-types.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname, 1)
onUpgradeNeeded():
db = event.target.result
store = db.createObjectStore('store', {autoIncrement: true})
index = store.createIndex('greedy-index', 'id')
store.put({id: 0})
store.put({id: new Date(0)})
store.put({id: 'string'})
store.put({id: []})
store.put({id: [0]})
store.put({id: [new Date(0)]})
store.put({id: ['string']})
store.put({id: [[]]})
store.put({id: undefined})
store.put({id: null})
store.put({id: true})
store.put({id: false})
store.put({id: {}})
store.put({id: /(?:)/})
index = store.createIndex('lazy-index', 'id')
expectedIndexSize = 8
onSuccess():
db = event.target.result
trans = db.transaction('store')
store = trans.objectStore('store')
greedyIndex = store.index('greedy-index')
request = greedyIndex.count()
lazyIndex = store.index('lazy-index')
request = lazyIndex.count()
countSuccess():
PASS event.target.result is expectedIndexSize
gotGreedyCount = true
countSuccess():
PASS event.target.result is expectedIndexSize
gotLazyCount = true
onComplete():
PASS gotGreedyCount is true
PASS gotLazyCount is true
PASS successfullyParsed is true
TEST COMPLETE