| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBDatabase createObjectStore() Exception Ordering</title> | 2 <title>IndexedDB: IDBDatabase createObjectStore() 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-createob
jectstore"> | 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-createob
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="resources/testharness-helpers.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 indexeddb_test( | 10 indexeddb_test( |
| 11 (t, db, req) => { | 11 (t, db, req) => { |
| 12 db.createObjectStore('s'); | 12 db.createObjectStore('s'); |
| 13 | 13 |
| 14 req.transaction.onabort = () => { |
| 15 setTimeout(t.step_func(() => { |
| 16 assert_throws( |
| 17 'InvalidStateError', () => { db.createObjectStore('s2'); }, |
| 18 '"running an upgrade transaction" check (InvalidStateError) ' + |
| 19 'should precede "not active" check (TransactionInactiveError)'); |
| 20 |
| 21 t.done(); |
| 22 }), 0); |
| 23 }; |
| 24 req.onerror = null; |
| 14 req.transaction.abort(); | 25 req.transaction.abort(); |
| 15 req.onerror = null; | |
| 16 | |
| 17 setTimeout(t.step_func(() => { | |
| 18 assert_throws( | |
| 19 'InvalidStateError', () => { db.createObjectStore('s2'); }, | |
| 20 '"running an upgrade transaction" check (InvalidStateError) ' + | |
| 21 'should precede "not active" check (TransactionInactiveError)'); | |
| 22 | |
| 23 t.done(); | |
| 24 }), 0); | |
| 25 }, | 26 }, |
| 26 (t, db) => { t.assert_unreached('open should fail'); }, | 27 (t, db) => { t.assert_unreached('open should fail'); }, |
| 27 'IDBDatabase.createObjectStore exception order: ' + | 28 'IDBDatabase.createObjectStore exception order: ' + |
| 28 'InvalidStateError vs. TransactionInactiveError' | 29 'InvalidStateError vs. TransactionInactiveError' |
| 29 ); | 30 ); |
| 30 | 31 |
| 31 indexeddb_test( | 32 indexeddb_test( |
| 32 (t, db, req) => { | 33 (t, db, req) => { |
| 33 const store = db.createObjectStore('s'); | 34 const store = db.createObjectStore('s'); |
| 34 | 35 |
| 36 req.onerror = null; |
| 35 req.transaction.abort(); | 37 req.transaction.abort(); |
| 36 req.onerror = null; | |
| 37 | 38 |
| 38 assert_throws( | 39 assert_throws( |
| 39 'TransactionInactiveError', | 40 'TransactionInactiveError', |
| 40 () => { db.createObjectStore('s2', {keyPath: '-invalid-'}); }, | 41 () => { db.createObjectStore('s2', {keyPath: '-invalid-'}); }, |
| 41 '"not active" check (TransactionInactiveError) should precede ' + | 42 '"not active" check (TransactionInactiveError) should precede ' + |
| 42 '"valid key path" check (SyntaxError)'); | 43 '"valid key path" check (SyntaxError)'); |
| 43 | 44 |
| 44 t.done(); | 45 t.done(); |
| 45 }, | 46 }, |
| 46 (t, db) => { t.assert_unreached('open should fail'); }, | 47 (t, db) => { t.assert_unreached('open should fail'); }, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 }, '"already exists" check (ConstraintError) should precede ' + | 72 }, '"already exists" check (ConstraintError) should precede ' + |
| 72 '"autoIncrement vs. keyPath" check (InvalidAccessError)'); | 73 '"autoIncrement vs. keyPath" check (InvalidAccessError)'); |
| 73 t.done(); | 74 t.done(); |
| 74 }, | 75 }, |
| 75 (t, db) => {}, | 76 (t, db) => {}, |
| 76 'IDBDatabase.createObjectStore exception order: ' + | 77 'IDBDatabase.createObjectStore exception order: ' + |
| 77 'ConstraintError vs. InvalidAccessError' | 78 'ConstraintError vs. InvalidAccessError' |
| 78 ); | 79 ); |
| 79 | 80 |
| 80 </script> | 81 </script> |
| OLD | NEW |