| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBObjectStore delete() Exception Ordering</title> |
| 3 <meta charset=utf-8> |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-delet
e"> |
| 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 const store2 = db.createObjectStore('s2'); |
| 14 |
| 15 db.deleteObjectStore('s2'); |
| 16 |
| 17 setTimeout(t.step_func(() => { |
| 18 assert_throws( |
| 19 'InvalidStateError', () => { store2.delete('key'); }, |
| 20 '"has been deleted" check (InvalidStateError) should precede ' + |
| 21 '"not active" check (TransactionInactiveError)'); |
| 22 t.done(); |
| 23 }), 0); |
| 24 }, |
| 25 (t, db) => {}, |
| 26 'IDBObjectStore.delete exception order: ' + |
| 27 'InvalidStateError vs. TransactionInactiveError' |
| 28 ); |
| 29 |
| 30 indexeddb_test( |
| 31 (t, db) => { |
| 32 const store = db.createObjectStore('s'); |
| 33 }, |
| 34 (t, db) => { |
| 35 const tx = db.transaction('s', 'readonly'); |
| 36 const store = tx.objectStore('s'); |
| 37 |
| 38 setTimeout(t.step_func(() => { |
| 39 assert_throws( |
| 40 'TransactionInactiveError', () => { store.delete('key'); }, |
| 41 '"not active" check (TransactionInactiveError) should precede ' + |
| 42 '"read only" check (ReadOnlyError)'); |
| 43 t.done(); |
| 44 }), 0); |
| 45 }, |
| 46 'IDBObjectStore.delete exception order: ' + |
| 47 'TransactionInactiveError vs. ReadOnlyError' |
| 48 ); |
| 49 |
| 50 indexeddb_test( |
| 51 (t, db) => { |
| 52 const store = db.createObjectStore('s'); |
| 53 }, |
| 54 (t, db) => { |
| 55 const tx = db.transaction('s', 'readonly'); |
| 56 const store = tx.objectStore('s'); |
| 57 |
| 58 assert_throws( |
| 59 'ReadOnlyError', () => { store.delete({}); }, |
| 60 '"read only" check (ReadOnlyError) should precede ' + |
| 61 'key/data check (DataError)'); |
| 62 |
| 63 t.done(); |
| 64 }, |
| 65 'IDBObjectStore.delete exception order: ' + |
| 66 'ReadOnlyError vs. DataError' |
| 67 ); |
| 68 |
| 69 </script> |
| OLD | NEW |