tor-browser

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

transaction-scheduling-ro-waits-for-rw.any.js (1003B)


      1 // META: script=resources/support.js
      2 'use strict';
      3 
      4 indexeddb_test(
      5  (t, db) => {
      6    const store = db.createObjectStore('store');
      7    store.put('value', 'key');
      8  },
      9 
     10  (t, db) => {
     11    const transaction1 = db.transaction('store', 'readwrite');
     12    transaction1.onabort = t.unreached_func('transaction1 should not abort');
     13 
     14    const transaction2 = db.transaction('store', 'readonly');
     15    transaction2.onabort = t.unreached_func('transaction2 should not abort');
     16 
     17    const request = transaction1.objectStore('store').put('new value', 'key');
     18    request.onerror = t.unreached_func('request should not fail');
     19 
     20    const request2 = transaction2.objectStore('store').get('key');
     21    request2.onerror = t.unreached_func('request2 should not fail');
     22    request2.onsuccess = t.step_func_done(evt => {
     23      assert_equals(request2.result, 'new value',
     24                    'Request should see new value.');
     25    });
     26  },
     27  "readonly transaction should see the result of a previous readwrite transaction");