Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>IndexedDB: IDBIndex query method Ordering</title> | |
| 3 <meta charset=utf-8> | |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-get"> | |
| 5 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-getall"> | |
| 6 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-getallkeys" > | |
| 7 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-count"> | |
| 8 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-opencursor" > | |
| 9 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-openkeycurs or"> | |
| 10 <script src="../../resources/testharness.js"></script> | |
| 11 <script src="../../resources/testharnessreport.js"></script> | |
| 12 <script src="resources/testharness-helpers.js"></script> | |
| 13 <script> | |
| 14 | |
| 15 ['get', | |
| 16 'getAll', | |
| 17 'getAllKeys', | |
| 18 'count', | |
| 19 'openCursor', | |
| 20 'openKeyCursor' | |
| 21 ].forEach(method => { | |
| 22 | |
| 23 indexeddb_test( | |
| 24 (t, db) => { | |
| 25 const store = db.createObjectStore('s'); | |
| 26 const store2 = db.createObjectStore('s2'); | |
| 27 const index = store2.createIndex('i', 'keyPath'); | |
| 28 const finish = pin_transaction(store); | |
|
pwnall
2016/10/14 07:57:05
I also don't understand why pinning is necessary.
jsbell
2016/10/17 19:42:03
Done.
| |
| 29 | |
| 30 store2.deleteIndex('i'); | |
| 31 | |
| 32 setTimeout(t.step_func(() => { | |
| 33 assert_throws( | |
| 34 'InvalidStateError', () => { index[method]('key'); }, | |
| 35 '"has been deleted" check (InvalidStateError) should precede ' + | |
| 36 '"not active" check (TransactionInactiveError)'); | |
| 37 | |
| 38 finish(); | |
| 39 t.done(); | |
| 40 }), 0); | |
| 41 }, | |
| 42 (t, db) => {}, | |
| 43 `IDBIndex.${method} exception order: ` + | |
| 44 'InvalidStateError vs. TransactionInactiveError' | |
| 45 ); | |
| 46 | |
| 47 indexeddb_test( | |
| 48 (t, db) => { | |
| 49 const store = db.createObjectStore('s'); | |
| 50 const index = store.createIndex('i', 'keyPath'); | |
| 51 }, | |
| 52 (t, db) => { | |
| 53 const tx = db.transaction('s'); | |
| 54 const store = tx.objectStore('s'); | |
| 55 const index = store.index('i'); | |
| 56 const finish = pin_transaction(store); | |
|
pwnall
2016/10/14 07:57:05
Same comment as above, except this time I commente
jsbell
2016/10/17 19:42:03
Done.
| |
| 57 | |
| 58 setTimeout(t.step_func(() => { | |
| 59 assert_throws( | |
| 60 'TransactionInactiveError', () => { index[method]({}); }, | |
| 61 '"not active" check (TransactionInactiveError) should precede ' + | |
| 62 'query check (DataError)'); | |
| 63 | |
| 64 finish(); | |
| 65 t.done(); | |
| 66 }), 0); | |
| 67 }, | |
| 68 `IDBIndex.${method} exception order: ` + | |
| 69 'TransactionInactiveError vs. DataError' | |
| 70 ); | |
| 71 }); | |
| 72 | |
| 73 </script> | |
| OLD | NEW |