3 <title>IndexedDB: IDBDatabase transaction() Exception Ordering
</title>
4 <link rel=
"help" href=
"https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction">
5 <script src=
"/resources/testharness.js"></script>
6 <script src=
"/resources/testharnessreport.js"></script>
7 <script src=
"resources/support.js"></script>
12 db
.createObjectStore('s');
16 assert_throws_dom('InvalidStateError', () => {
17 db
.transaction('no-such-store');
18 }, '"Connection is closed" check (InvalidStateError) should precede ' +
19 '"store names" check (NotFoundError)');
22 'IDBDatabase.transaction exception order: InvalidStateError vs. NotFoundError'
27 db
.createObjectStore('s');
31 assert_throws_dom('InvalidStateError', () => {
33 }, '"Connection is closed" check (InvalidStateError) should precede ' +
34 '"stores is empty" check (InvalidAccessError)');
37 'IDBDatabase.transaction exception order: InvalidStateError vs. InvalidAccessError'
40 // Verify that the invalid mode check actually throws an exception
43 db
.createObjectStore('s');
46 assert_throws_js(TypeError
, () => {
47 db
.transaction('s', 'versionchange');
48 }, '"invalid mode" check should throw TypeError');
51 'IDBDatabase.transaction throws exception on invalid mode'
56 db
.createObjectStore('s');
59 assert_throws_dom('NotFoundError', () => {
60 db
.transaction('no-such-store', 'versionchange');
61 }, '"No such store" check (NotFoundError) should precede ' +
62 '"invalid mode" check (TypeError)');
65 'IDBDatabase.transaction exception order: NotFoundError vs. TypeError'