blob: 4b49554add8556b67113902a3963722aaa5302d2 [file] [log] [blame]
Test IndexedDB keyPath with intrinsic properties
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;
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')
testKeyPaths():
transaction = db.transaction('store', 'readwrite')
store = transaction.objectStore('store')
store.put({"id":"id#0","string":"","array":[]})
store.put({"id":"id#1","string":"xx","array":["x","x","x"]})
store.put({"id":"id#2","string":"xxxx","array":["x","x","x","x","x","x"]})
store.put({"id":"id#3","string":"xxxxxx","array":["x","x","x","x","x","x","x","x","x"]})
store.put({"id":"id#4","string":"xxxxxxxx","array":["x","x","x","x","x","x","x","x","x","x","x","x"]})
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
PASS successfullyParsed is true
TEST COMPLETE