idbindex-getAll-enforcerange.any.js (874B)
1 // META: title=IndexedDB: IDBIndex getAll() uses [EnforceRange] 2 // META: global=window,worker 3 // META: script=resources/support.js 4 // Spec: "https://w3c.github.io/IndexedDB/#index-interface" 5 'use strict'; 6 7 indexeddb_test( 8 (t, db) => { 9 const store = db.createObjectStore('store'); 10 const index = store.createIndex('index', 'keyPath'); 11 }, 12 (t, db) => { 13 const tx = db.transaction('store', 'readonly'); 14 const store = tx.objectStore('store'); 15 const index = store.index('index'); 16 [NaN, Infinity, -Infinity, -1, -Number.MAX_SAFE_INTEGER].forEach( 17 count => { 18 assert_throws_js(TypeError, () => { 19 index.getAll(null, count); 20 }, `getAll with count ${count} count should throw TypeError`); 21 }); 22 t.done(); 23 }, 24 'IDBIndex.getAll() should enforce valid range constraints.');