idbobjectstore-index-finished.any.js (738B)
1 // META: global=window,worker 2 // META: title=IndexedDB: IDBObjectStore index() when transaction is finished 3 // META: script=resources/support.js 4 5 // Spec: https://w3c.github.io/IndexedDB/#dom-idbobjectstore-index 6 7 'use strict'; 8 9 indexeddb_test( 10 (t, db) => { 11 const store = db.createObjectStore('store'); 12 store.createIndex('index', 'key_path'); 13 }, 14 (t, db) => { 15 const tx = db.transaction('store', 'readonly'); 16 const store = tx.objectStore('store'); 17 tx.abort(); 18 assert_throws_dom( 19 'InvalidStateError', () => store.index('index'), 20 'index() should throw if transaction is finished'); 21 t.done(); 22 }, 23 'IDBObjectStore index() behavior when transaction is finished');