tor-browser

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

idbindex-request-source.any.js (973B)


      1 // META: title=IndexedDB: The source of requests made against indexes
      2 // META: global=window,worker
      3 // META: script=resources/support.js
      4 
      5 // Spec: https://w3c.github.io/IndexedDB/#dom-idbrequest-source
      6 
      7 'use strict';
      8 
      9 [
     10    index => index.get(0),
     11    index => index.getKey(0),
     12    index => index.getAll(),
     13    index => index.getAllKeys(),
     14    index => index.count(),
     15    index => index.openCursor(),
     16    index => index.openKeyCursor()
     17 ].forEach(func => indexeddb_test(
     18    (t, db) => {
     19        const store =
     20            db.createObjectStore('store', {autoIncrement: true});
     21        store.createIndex('index', 'kp');
     22    },
     23    (t, db) => {
     24        const tx = db.transaction('store', 'readwrite');
     25        const index = tx.objectStore('store').index('index');
     26        assert_equals(
     27            func(index).source, index,
     28            `${func}.source should be the index itself`);
     29        t.done();
     30    },
     31    `The source of the request from ${func} is the index itself`
     32 ));