| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBObjectStore deleteIndex() Exception Ordering</title> |
| 3 <meta charset=utf-8> |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-delet
eindex"> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="resources/testharness-helpers.js"></script> |
| 8 <script> |
| 9 |
| 10 indexeddb_test( |
| 11 (t, db) => { |
| 12 const store = db.createObjectStore('s'); |
| 13 store.createIndex('i', 'keyPath'); |
| 14 }, |
| 15 (t, db) => { |
| 16 const tx = db.transaction('s'); |
| 17 const store = tx.objectStore('s'); |
| 18 |
| 19 setTimeout(t.step_func(() => { |
| 20 assert_throws( |
| 21 'InvalidStateError', () => { store.deleteIndex('i'); }, |
| 22 '"running an upgrade transaction" check (InvalidStateError) ' + |
| 23 'should precede "not active" check (TransactionInactiveError)'); |
| 24 t.done(); |
| 25 }), 0); |
| 26 }, |
| 27 'IDBObjectStore.deleteIndex exception order: ' + |
| 28 'InvalidStateError #1 vs. TransactionInactiveError' |
| 29 ); |
| 30 |
| 31 indexeddb_test( |
| 32 (t, db) => { |
| 33 const store = db.createObjectStore('s'); |
| 34 const index = store.createIndex('i', 'keyPath'); |
| 35 |
| 36 db.deleteObjectStore('s'); |
| 37 |
| 38 setTimeout(t.step_func(() => { |
| 39 assert_throws( |
| 40 'InvalidStateError', () => { store.deleteIndex('i'); }, |
| 41 '"deleted" check (InvalidStateError) ' + |
| 42 'should precede "not active" check (TransactionInactiveError)'); |
| 43 t.done(); |
| 44 }), 0); |
| 45 }, |
| 46 (t, db) => {}, |
| 47 'IDBObjectStore.deleteIndex exception order: ' + |
| 48 'InvalidStateError #2 vs. TransactionInactiveError' |
| 49 ); |
| 50 |
| 51 indexeddb_test( |
| 52 (t, db) => { |
| 53 const store = db.createObjectStore('s'); |
| 54 |
| 55 setTimeout(t.step_func(() => { |
| 56 assert_throws( |
| 57 'TransactionInactiveError', () => { store.deleteIndex('nope'); }, |
| 58 '"not active" check (TransactionInactiveError) should precede ' + |
| 59 '"name in store" check (NotFoundError)'); |
| 60 t.done(); |
| 61 }), 0); |
| 62 }, |
| 63 (t, db) => {}, |
| 64 'IDBObjectStore.deleteIndex exception order: ' + |
| 65 'TransactionInactiveError vs. NotFoundError' |
| 66 ); |
| 67 |
| 68 </script> |
| OLD | NEW |