Chromium Code Reviews| 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 const finish = pin_transaction(store); | |
| 15 | |
| 16 db.deleteObjectStore('s2'); | |
| 17 | |
| 18 setTimeout(t.step_func(() => { | |
| 19 assert_throws( | |
| 20 'InvalidStateError', () => { store2.delete('key'); }, | |
| 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.delete 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
'readonly'?
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.delete('key'); }, | |
| 45 '"not active" check (TransactionInactiveError) should precede ' + | |
| 46 '"read only" check (ReadOnlyError)'); | |
| 47 | |
| 48 finish(); | |
| 49 t.done(); | |
| 50 }), 0); | |
| 51 }, | |
| 52 'IDBObjectStore.delete exception order: ' + | |
| 53 'TransactionInactiveError vs. ReadOnlyError' | |
| 54 ); | |
| 55 | |
| 56 indexeddb_test( | |
| 57 (t, db) => { | |
| 58 const store = db.createObjectStore('s'); | |
| 59 }, | |
| 60 (t, db) => { | |
| 61 const tx = db.transaction('s'); | |
|
pwnall
2016/10/14 07:57:05
'readonly'?
jsbell
2016/10/17 19:42:03
Done.
| |
| 62 const store = tx.objectStore('s'); | |
| 63 | |
| 64 assert_throws( | |
| 65 'ReadOnlyError', () => { store.delete({}); }, | |
| 66 '"read only" check (ReadOnlyError) should precede ' + | |
| 67 'key/data check (DataError)'); | |
| 68 | |
| 69 t.done(); | |
| 70 }, | |
| 71 'IDBObjectStore.delete exception order: ' + | |
| 72 'ReadOnlyError vs. DataError' | |
| 73 ); | |
| 74 | |
| 75 </script> | |
| OLD | NEW |