Test IndexedDB's IDBObjectStore auto-increment feature. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". dbname = "objectstore-autoincrement.html" indexedDB.deleteDatabase(dbname) indexedDB.open(dbname) createObjectStore(): store = db.createObjectStore('StoreWithKeyPath', {keyPath: 'id', autoIncrement: true}) db.createObjectStore('StoreWithAutoIncrement', {autoIncrement: true}) db.createObjectStore('PlainOldStore', {autoIncrement: false}) db.createObjectStore('StoreWithLongKeyPath', {keyPath: 'a.b.c.id', autoIncrement: true}) storeNames = db.objectStoreNames PASS store.name is "StoreWithKeyPath" PASS store.keyPath is "id" PASS storeNames.contains('StoreWithKeyPath') is true PASS storeNames.contains('StoreWithAutoIncrement') is true PASS storeNames.contains('PlainOldStore') is true PASS storeNames.length is 4 setVersionCompleted(): trans = db.transaction(['StoreWithKeyPath', 'StoreWithAutoIncrement', 'PlainOldStore'], 'readwrite') store = trans.objectStore('StoreWithKeyPath') Insert into object store with auto increment and key path, with key in the object. store.add({name: 'Jeffersson', number: '7010', id: 3}) addJefferssonSuccess(): PASS event.target.result is 3 Insert into object store with auto increment and key path, without key in the object. store.add({name: 'Lincoln', number: '7012'}) addLincolnWithInjectKeySuccess(): PASS event.target.result is 4 store.get(4) getLincolnAfterInjectedKeySuccess(): PASS event.target.result.name is "Lincoln" PASS event.target.result.number is "7012" PASS event.target.result.id is 4 store = trans.objectStore('StoreWithAutoIncrement') Insert into object store with key gen using explicit key store.add({name: 'Lincoln', number: '7012'}, 5) addLincolnWithExplicitKeySuccess(): PASS event.target.result is 5 store.get(5) getLincolnSuccess(): PASS event.target.result.name is "Lincoln" PASS event.target.result.number is "7012" store.put({name: 'Abraham', number: '2107'}) putAbrahamSuccess(): PASS event.target.result is 6 store.get(6) getAbrahamSuccess(): PASS event.target.result.name is "Abraham" PASS event.target.result.number is "2107" store = trans.objectStore('PlainOldStore') Try adding with no key to object store without auto increment. Expecting exception from store.add({name: 'Adam'}) PASS Exception was thrown. PASS code is 0 PASS ename is 'DataError' Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store uses out-of-line keys and has no key generator and the key parameter was not provided. store.add({name: 'Adam'}, 1) addAdamSuccess(): PASS event.target.result is 1 testLongKeyPath(): trans = db.transaction('StoreWithLongKeyPath', 'readwrite') store = trans.objectStore('StoreWithLongKeyPath') store.add({foo: 'bar'}) store.add({foo: 'bar', a: {}}) store.add({foo: 'bar', a: {b: {}}}) store.add({foo: 'bar', a: {b: {c: {}}}}) store.openCursor() expected = null count = 0 expected = cursor.value.a.b.c.id + 1 PASS cursor.value.foo is "bar" PASS cursor.value.a.b.c.id is expected expected = cursor.value.a.b.c.id + 1 PASS cursor.value.foo is "bar" PASS cursor.value.a.b.c.id is expected expected = cursor.value.a.b.c.id + 1 PASS cursor.value.foo is "bar" PASS cursor.value.a.b.c.id is expected expected = cursor.value.a.b.c.id + 1 PASS count is 4 PASS successfullyParsed is true TEST COMPLETE