blob: c0021d926a83255fc434f81e702912f42d7ef10f [file] [log] [blame]
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: IDBDatabase transaction() Exception Ordering</title>
<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>
indexeddb_test(
(t, db) => {
db.createObjectStore('s');
},
(t, db) => {
db.close();
assert_throws('InvalidStateError', () => {
db.transaction('no-such-store');
}, '"Connection is closed" check (InvalidStateError) should precede ' +
'"store names" check (NotFoundError)');
t.done();
},
'IDBDatabase.transaction exception order: InvalidStateError vs. NotFoundError'
);
indexeddb_test(
(t, db) => {
db.createObjectStore('s');
},
(t, db) => {
db.close();
assert_throws('InvalidStateError', () => {
db.transaction([]);
}, '"Connection is closed" check (InvalidStateError) should precede ' +
'"stores is empty" check (InvalidAccessError)');
t.done();
},
'IDBDatabase.transaction exception order: InvalidStateError vs. InvalidAccessError'
);
indexeddb_test(
(t, db) => {
db.createObjectStore('s');
},
(t, db) => {
assert_throws('NotFoundError', () => {
db.transaction('no-such-store', 'versionchange');
}, '"No such store" check (NotFoundError) should precede ' +
'"invalid mode" check (TypeError)');
t.done();
},
'IDBDatabase.transaction exception order: NotFoundError vs. TypeError'
);
</script>