| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBDatabase deleteObjectStore() Exception Ordering</title> | 2 <title>IndexedDB: IDBDatabase deleteObjectStore() Exception Ordering</title> |
| 3 <meta charset=utf-8> | 3 <meta charset=utf-8> |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-deleteob
jectstore"> | 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-deleteob
jectstore"> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="resources/testharness-helpers.js"></script> | 7 <script src="support.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 indexeddb_test( | 10 indexeddb_test( |
| 11 (t, db, req) => { | 11 (t, db, txn) => { |
| 12 db.createObjectStore('s'); | 12 db.createObjectStore('s'); |
| 13 req.transaction.onabort = () => { | 13 txn.onabort = () => { |
| 14 setTimeout(t.step_func(() => { | 14 setTimeout(t.step_func(() => { |
| 15 assert_throws( | 15 assert_throws( |
| 16 'InvalidStateError', () => { db.deleteObjectStore('s'); }, | 16 'InvalidStateError', () => { db.deleteObjectStore('s'); }, |
| 17 '"running an upgrade transaction" check (InvalidStateError) ' + | 17 '"running an upgrade transaction" check (InvalidStateError) ' + |
| 18 'should precede "not active" check (TransactionInactiveError)'); | 18 'should precede "not active" check (TransactionInactiveError)'); |
| 19 t.done(); | 19 t.done(); |
| 20 }), 0); | 20 }), 0); |
| 21 }; | 21 }; |
| 22 req.onerror = null; | 22 txn.abort(); |
| 23 req.transaction.abort(); | |
| 24 }, | 23 }, |
| 25 (t, db) => { t.assert_unreached('open should fail'); }, | 24 (t, db) => { t.assert_unreached('open should fail'); }, |
| 26 'IDBDatabase.deleteObjectStore exception order: ' + | 25 'IDBDatabase.deleteObjectStore exception order: ' + |
| 27 'InvalidStateError vs. TransactionInactiveError' | 26 'InvalidStateError vs. TransactionInactiveError', |
| 27 { upgrade_will_abort: true } |
| 28 ); | 28 ); |
| 29 | 29 |
| 30 indexeddb_test( | 30 indexeddb_test( |
| 31 (t, db, req) => { | 31 (t, db, txn) => { |
| 32 req.onerror = null; | 32 txn.abort(); |
| 33 req.transaction.abort(); | |
| 34 assert_throws( | 33 assert_throws( |
| 35 'TransactionInactiveError', () => { db.deleteObjectStore('nope'); }, | 34 'TransactionInactiveError', () => { db.deleteObjectStore('nope'); }, |
| 36 '"not active" check (TransactionInactiveError) should precede ' + | 35 '"not active" check (TransactionInactiveError) should precede ' + |
| 37 '"name in database" check (NotFoundError)'); | 36 '"name in database" check (NotFoundError)'); |
| 38 t.done(); | 37 t.done(); |
| 39 }, | 38 }, |
| 40 (t, db) => { t.assert_unreached('open should fail'); }, | 39 (t, db) => { t.assert_unreached('open should fail'); }, |
| 41 'IDBDatabase.deleteObjectStore exception order: ' + | 40 'IDBDatabase.deleteObjectStore exception order: ' + |
| 42 'TransactionInactiveError vs. NotFoundError' | 41 'TransactionInactiveError vs. NotFoundError', |
| 42 { upgrade_will_abort: true } |
| 43 ); | 43 ); |
| 44 | 44 |
| 45 </script> | 45 </script> |
| OLD | NEW |