tor-browser

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

blob-valid-after-abort.any.js (974B)


      1 // META: title=Blob Valid After Abort
      2 // META: global=window,worker
      3 // META: script=resources/support.js
      4 'use strict';
      5 
      6 let key = "key";
      7 
      8 indexeddb_test(
      9  function upgrade(t, db) {
     10    db.createObjectStore('store');
     11    },
     12    function success(t, db) {
     13      const blobAContent = 'Blob A content';
     14      const blobA = new Blob([blobAContent], { 'type': 'text/plain' });
     15      const value = { a0: blobA };
     16 
     17      const txn = db.transaction('store', 'readwrite');
     18      const store = txn.objectStore('store');
     19 
     20      store.put(value, key);
     21      const request = store.get(key);
     22      request.onsuccess = t.step_func(function () {
     23        readBlob = request.result.a0;
     24        txn.abort();
     25      });
     26 
     27      let readBlob;
     28      txn.onabort = () => {
     29        readBlob.text().then(
     30          t.step_func_done(text => assert_equals(text, blobAContent)),
     31          t.unreached_func());
     32      };
     33    },
     34  "A blob can be read back after the transaction that added it was aborted.");