tor-browser

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

idbindex_getAllKeys-options.any.js (4190B)


      1 // META: title=IndexedDB: Test IDBIndex.getAllKeys with options dictionary.
      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_keys_with_options_test(
     12    /*storeName=*/ 'out-of-line', /*options=*/ {query: 'C'}, 'Single item get');
     13 
     14 index_get_all_keys_with_options_test(
     15    /*storeName=*/ 'empty', /*options=*/ {}, 'Empty object store');
     16 
     17 index_get_all_keys_with_options_test(
     18    /*storeName=*/ 'out-of-line', /*options=*/ {}, 'Get all keys');
     19 
     20 index_get_all_keys_with_options_test(
     21    /*storeName=*/ 'generated', /*options=*/ {}, 'Get all generated keys');
     22 
     23 index_get_all_keys_with_options_test(
     24    /*storeName=*/ 'out-of-line', /*options=*/ {count: 10}, 'maxCount=10');
     25 
     26 index_get_all_keys_with_options_test(
     27    /*storeName=*/ 'out-of-line',
     28    /*options=*/ {query: IDBKeyRange.bound('G', 'M')}, 'Get bound range');
     29 
     30 index_get_all_keys_with_options_test(
     31    /*storeName=*/ 'out-of-line',
     32    /*options=*/ {query: IDBKeyRange.bound('G', 'M'), count: 3},
     33    'Get bound range with maxCount');
     34 
     35 index_get_all_keys_with_options_test(
     36    /*storeName=*/ 'out-of-line',
     37    /*options=*/ {
     38      query:
     39          IDBKeyRange.bound('G', 'K', /*lowerOpen=*/ false, /*upperOpen=*/ true)
     40    },
     41    'Get upper excluded');
     42 
     43 index_get_all_keys_with_options_test(
     44    /*storeName=*/ 'out-of-line',
     45    /*options=*/ {
     46      query:
     47          IDBKeyRange.bound('G', 'K', /*lowerOpen=*/ true, /*upperOpen=*/ false)
     48    },
     49    'Get lower excluded');
     50 
     51 index_get_all_keys_with_options_test(
     52    /*storeName=*/ 'generated',
     53    /*options=*/ {query: IDBKeyRange.bound(4, 15), count: 3},
     54    'Get bound range (generated) with maxCount');
     55 
     56 index_get_all_keys_with_options_test(
     57    /*storeName=*/ 'out-of-line',
     58    /*options=*/ {query: 'Doesn\'t exist'}, 'Non existent key');
     59 
     60 index_get_all_keys_with_options_test(
     61    /*storeName=*/ 'out-of-line',
     62    /*options=*/ {count: 0}, 'maxCount=0');
     63 
     64 index_get_all_keys_with_options_test(
     65    /*storeName=*/ 'out-of-line',
     66    /*options=*/ {query: 4294967295}, 'Max value count');
     67 
     68 index_get_all_keys_with_options_test(
     69    /*storeName=*/ 'out-of-line',
     70    /*options=*/ {query: IDBKeyRange.upperBound('0')},
     71    'Query with empty range where  first key < upperBound');
     72 
     73 index_get_all_keys_with_options_test(
     74    /*storeName=*/ 'out-of-line',
     75    /*options=*/ {query: IDBKeyRange.lowerBound('ZZ')},
     76    'Query with empty range where lowerBound < last key');
     77 
     78 index_get_all_keys_with_options_test(
     79    /*storeName=*/ 'out-of-line-not-unique', /*options=*/ {query: 'first'},
     80    'Retrieve multiEntry key');
     81 
     82 index_get_all_keys_with_options_test(
     83    /*storeName=*/ 'out-of-line-multi',
     84    /*options=*/ {query: 'vowel'}, 'Retrieve one key multiple values');
     85 
     86 index_get_all_keys_with_options_test(
     87    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'next'},
     88    'Direction: next');
     89 
     90 index_get_all_keys_with_options_test(
     91    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'prev'},
     92    'Direction: prev');
     93 
     94 index_get_all_keys_with_options_test(
     95    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'nextunique'},
     96    'Direction: nextunique');
     97 
     98 index_get_all_keys_with_options_test(
     99    /*storeName=*/ 'out-of-line', /*options=*/ {direction: 'prevunique'},
    100    'Direction: prevunique');
    101 
    102 index_get_all_keys_with_options_test(
    103    /*storeName=*/ 'out-of-line', /*options=*/ {
    104      direction: 'prev',
    105      query: IDBKeyRange.bound('b', 'x'),
    106    },
    107    'Direction and query');
    108 
    109 index_get_all_keys_with_options_test(
    110    /*storeName=*/ 'out-of-line', /*options=*/ {
    111      direction: 'prev',
    112      query: IDBKeyRange.bound('b', 'x'),
    113      count: 4
    114    },
    115    'Direction, query and count');
    116 
    117 get_all_with_options_and_count_test(
    118    'getAllKeys', /*storeName=*/ 'out-of-line', /*indexName=*/ 'test_idx',
    119    'Get all keys with both options and count');
    120 
    121 get_all_with_invalid_keys_test(
    122    'getAllKeys', /*storeName=*/ 'out-of-line', /*indexName=*/ 'test_idx',
    123    /*shouldUseDictionary=*/ true, 'Get all keys with invalid query keys');