Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>IndexedDB: IDBObjectStore clear() Exception Ordering</title> | |
| 3 <meta charset=utf-8> | |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-clear "> | |
| 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 const finish = pin_transaction(store); | |
| 15 | |
| 16 db.deleteObjectStore('s2'); | |
| 17 | |
| 18 setTimeout(t.step_func(() => { | |
| 19 assert_throws( | |
| 20 'InvalidStateError', () => { store2.clear(); }, | |
| 21 '"has been deleted" check (InvalidStateError) should precede ' + | |
| 22 '"not active" check (TransactionInactiveError)'); | |
| 23 | |
| 24 finish(); | |
| 25 t.done(); | |
| 26 }), 0); | |
| 27 }, | |
| 28 (t, db) => {}, | |
| 29 'IDBObjectStore.clear exception order: ' + | |
| 30 'InvalidStateError vs. TransactionInactiveError' | |
| 31 ); | |
| 32 | |
| 33 indexeddb_test( | |
| 34 (t, db) => { | |
| 35 const store = db.createObjectStore('s'); | |
| 36 }, | |
| 37 (t, db) => { | |
| 38 const tx = db.transaction('s'); | |
|
pwnall
2016/10/14 07:57:05
Consider adding 'readonly' to emphasize the transa
jsbell
2016/10/17 19:42:03
Done.
| |
| 39 const store = tx.objectStore('s'); | |
| 40 const finish = pin_transaction(store); | |
| 41 | |
| 42 setTimeout(t.step_func(() => { | |
| 43 assert_throws( | |
| 44 'TransactionInactiveError', () => { store.clear(); }, | |
| 45 '"not active" check (TransactionInactiveError) should precede ' + | |
| 46 '"read only" check (ReadOnlyError)'); | |
| 47 | |
| 48 finish(); | |
| 49 t.done(); | |
| 50 }), 0); | |
| 51 }, | |
| 52 | |
| 53 'IDBObjectStore.clear exception order: ' + | |
| 54 'TransactionInactiveError vs. ReadOnlyError' | |
| 55 ); | |
| 56 | |
| 57 </script> | |
| OLD | NEW |