tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

idbindex_getAllRecords.any.js (4038B)


      1 // META: title=IndexedDB: Test IDBIndex.getAllRecords
      2 // META: global=window,worker
      3 // META: script=resources/nested-cloning-common.js
      4 // META: script=resources/support.js
      5 // META: script=resources/support-get-all.js
      6 // META: script=resources/support-promises.js
      7 // META: timeout=long
      8 'use strict';
      9 
     10 
     11 index_get_all_records_test(
     12    /*storeName=*/ 'out-of-line', /*options=*/ {query: /*key=*/ 'C'},
     13    'Single item');
     14 
     15 index_get_all_records_test(
     16    /*storeName=*/ 'empty', /*options=*/ undefined, 'Empty index');
     17 
     18 index_get_all_records_test(
     19    /*storeName=*/ 'out-of-line',
     20    /*options=*/ undefined, 'Get all records');
     21 
     22 index_get_all_records_test(
     23    /*storeName=*/ 'out-of-line',
     24    /*options=*/ {}, 'Get all records with empty options');
     25 
     26 
     27 index_get_all_records_test(
     28    /*storeName=*/ 'large-values',
     29    /*options=*/ undefined, 'Get all records with large value');
     30 
     31 index_get_all_records_test(
     32    /*storeName=*/ 'out-of-line', /*options=*/ {count: 10}, 'Count');
     33 
     34 index_get_all_records_test(
     35    /*storeName=*/ 'out-of-line',
     36    /*options=*/ {query: IDBKeyRange.bound('G', 'M')},
     37    'Query with bound range');
     38 
     39 index_get_all_records_test(
     40    /*storeName=*/ 'out-of-line',
     41    /*options=*/ {query: IDBKeyRange.bound('G', 'M'), count: 3},
     42    'Query with bound range and count');
     43 
     44 index_get_all_records_test(
     45    /*storeName=*/ 'out-of-line',
     46    /*options=*/ {
     47      query:
     48          IDBKeyRange.bound('G', 'M', /*lowerOpen=*/ false, /*upperOpen=*/ true)
     49    },
     50    'Query with upper excluded bound range');
     51 
     52 index_get_all_records_test(
     53    /*storeName=*/ 'out-of-line',
     54    /*options=*/ {
     55      query:
     56          IDBKeyRange.bound('G', 'M', /*lowerOpen=*/ true, /*upperOpen=*/ false)
     57    },
     58    'Query with lower excluded bound range');
     59 
     60 index_get_all_records_test(
     61    /*storeName=*/ 'generated',
     62    /*options=*/ {query: IDBKeyRange.bound(4, 15), count: 3},
     63    'Query with bound range and count for generated keys');
     64 
     65 index_get_all_records_test(
     66    /*storeName=*/ 'out-of-line', /*options=*/ {query: 'Doesn\'t exist'},
     67    'Query with Nonexistent key');
     68 
     69 index_get_all_records_test(
     70    /*storeName=*/ 'out-of-line', /*options=*/ {count: 0}, 'Zero count');
     71 
     72 index_get_all_records_test(
     73    /*storeName=*/ 'out-of-line', /*options=*/ {count: 4294967295},
     74    'Max value count');
     75 
     76 index_get_all_records_test(
     77    /*storeName=*/ 'out-of-line',
     78    /*options=*/ {query: IDBKeyRange.upperBound('0')},
     79    'Query with empty range where first key < upperBound');
     80 
     81 index_get_all_records_test(
     82    /*storeName=*/ 'out-of-line',
     83    /*options=*/ {query: IDBKeyRange.lowerBound('ZZ')},
     84    'Query with empty range where lowerBound < last key');
     85 
     86 index_get_all_records_test(
     87    /*storeName=*/ 'out-of-line-not-unique', /*options=*/ {query: 'first'},
     88    'Query index key that matches multiple records');
     89 
     90 index_get_all_records_test(
     91    /*storeName=*/ 'out-of-line-multi', /*options=*/ {query: 'vowel'},
     92    'Query with multiEntry index');
     93 
     94 index_get_all_records_test(
     95    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'next'},
     96    'Direction: next');
     97 
     98 index_get_all_records_test(
     99    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'prev'},
    100    'Direction: prev');
    101 
    102 index_get_all_records_test(
    103    /*storeName=*/ 'out-of-line-not-unique',
    104    /*options=*/ {direction: 'nextunique'}, 'Direction: nextunique');
    105 
    106 index_get_all_records_test(
    107    /*storeName=*/ 'out-of-line-not-unique',
    108    /*options=*/ {direction: 'prevunique'}, 'Direction: prevunique');
    109 
    110 index_get_all_records_test(
    111    /*storeName=*/ 'out-of-line',
    112    /*options=*/ {direction: 'prev', query: IDBKeyRange.bound('B', 'X')},
    113    'Direction and query');
    114 
    115 index_get_all_records_test(
    116    /*storeName=*/ 'out-of-line', /*options=*/ {
    117      direction: 'prev',
    118      query: IDBKeyRange.bound('B', 'X'),
    119      count: 4
    120    },
    121    'Direction, query and count');
    122 
    123 get_all_with_invalid_keys_test(
    124    'getAllRecords', /*storeName=*/ 'out-of-line', /*indexName=*/ 'test_idx',
    125    /*shouldUseDictionary=*/ true, 'Get all records with invalid query keys');