blob: 166ca6bc8059da74c0b8275c2605bf72d5f06d4c [file] [log] [blame]
Test the use of identical keypaths between objectstores and indexes
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "index-duplicate-keypaths.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('collideWithIndex', {keyPath: 'foo'})
index = store.createIndex('foo', 'foo')
objectStore.put({foo: 10})
objectStore.get(10)
index.get(10)
PASS JSON.stringify(result) is "{\"foo\":10}"
PASS JSON.stringify(result) is "{\"foo\":10}"
db.close()
request = indexedDB.open(dbname, 2)
Deleted all object stores.
store = db.createObjectStore('collideWithAutoIncrement', {keyPath: 'foo', autoIncrement: true})
index = store.createIndex('foo', 'foo')
objectStore.put({foo:5})
objectStore.put({foo:6})
objectStore.put({foo:7})
objectStore.put({foo:8})
objectStore.put({foo:9})
objectStore.put({'bar': 'baz'})
PASS event.target.result is 10
objectStore.get(10)
index.get(10)
PASS JSON.stringify(result) is "{\"bar\":\"baz\",\"foo\":10}"
PASS JSON.stringify(result) is "{\"bar\":\"baz\",\"foo\":10}"
PASS successfullyParsed is true
TEST COMPLETE