tor-browser

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

idbobjectstore_getAll-options.any.js (4245B)


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