idbindex_indexNames.any.js (857B)
1 // META: global=window,worker 2 // META: title=IDBObjectStore.indexNames 3 // META: script=resources/support.js 4 'use strict'; 5 6 7 async_test(t => { 8 let db; 9 const open_rq = createdb(t); 10 open_rq.onupgradeneeded = t.step_func(e => { 11 db = e.target.result; 12 const objStore = db.createObjectStore('test', {keyPath: 'key'}); 13 objStore.createIndex('index', 'data'); 14 15 assert_equals(objStore.indexNames[0], 'index', 'indexNames'); 16 assert_equals(objStore.indexNames.length, 1, 'indexNames.length'); 17 }); 18 19 open_rq.onsuccess = t.step_func(e => { 20 const objStore = db.transaction('test', 'readonly').objectStore('test'); 21 22 assert_equals(objStore.indexNames[0], 'index', 'indexNames (second)'); 23 assert_equals(objStore.indexNames.length, 1, 'indexNames.length (second)'); 24 25 t.done(); 26 }); 27 }, 'Verify IDBObjectStore.indexNames property');