tor-browser

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

idbindex_getAll-options.any.js (4343B)


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