| Test the use of identical keypaths between objectstores and indexes |
| |
| 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; |
| |
| 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 |
| |