Test IndexedDB keyPath with intrinsic properties
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "keypath-intrinsic-properties.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store', {keyPath: 'id'})
store.createIndex('string length', 'string.length')
store.createIndex('array length', 'array.length')
store.createIndex('blob size', 'blob.size')
store.createIndex('blob type', 'blob.type')
testKeyPaths():
transaction = db.transaction('store', 'readwrite', {durability: 'relaxed'})
store = transaction.objectStore('store')
store.put({"id":"id#0","string":"","array":[],"blob":new Blob([""],{type:"type 0"})})
store.put({"id":"id#1","string":"xx","array":["x","x","x"],"blob":new Blob(["xxxx"],{type:"type 1"})})
store.put({"id":"id#2","string":"xxxx","array":["x","x","x","x","x","x"],"blob":new Blob(["xxxxxxxx"],{type:"type 2"})})
store.put({"id":"id#3","string":"xxxxxx","array":["x","x","x","x","x","x","x","x","x"],"blob":new Blob(["xxxxxxxxxxxx"],{type:"type 3"})})
store.put({"id":"id#4","string":"xxxxxxxx","array":["x","x","x","x","x","x","x","x","x","x","x","x"],"blob":new Blob(["xxxxxxxxxxxxxxxx"],{type:"type 4"})})
request = store.index('string length').openCursor()
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
request = store.index('array length').openCursor()
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
request = store.index('blob size').openCursor()
PASS cursor.key is cursor.value.blob.size
PASS cursor.key is cursor.value.blob.size
PASS cursor.key is cursor.value.blob.size
PASS cursor.key is cursor.value.blob.size
PASS cursor.key is cursor.value.blob.size
request = store.index('blob type').openCursor()
PASS cursor.key is cursor.value.blob.type
PASS cursor.key is cursor.value.blob.type
PASS cursor.key is cursor.value.blob.type
PASS cursor.key is cursor.value.blob.type
PASS cursor.key is cursor.value.blob.type
PASS successfullyParsed is true
TEST COMPLETE