tor-browser

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

error-attributes.any.js (1036B)


      1 // META: title=IndexedDB
      2 // META: global=window,worker
      3 // META: script=resources/support.js
      4 
      5 'use strict';
      6 
      7 indexeddb_test(
      8    function(t, db) {
      9      db.createObjectStore('store');
     10    },
     11    function(t, db) {
     12      let tx = db.transaction('store', 'readwrite');
     13      let store = tx.objectStore('store');
     14      let r1 = store.add('value', 'key');
     15      r1.onerror = t.unreached_func('first add should succeed');
     16 
     17      let r2 = store.add('value', 'key');
     18      r2.onsuccess = t.unreached_func('second add should fail');
     19 
     20      r2.onerror = t.step_func(function() {
     21        assert_true(r2.error instanceof DOMException);
     22        assert_equals(r2.error.name, 'ConstraintError');
     23      });
     24 
     25      tx.oncomplete = t.unreached_func('transaction should not complete');
     26      tx.onabort = t.step_func(function() {
     27        assert_true(tx.error instanceof DOMException);
     28        assert_equals(tx.error.name, 'ConstraintError');
     29        t.done();
     30      });
     31    },
     32    'IDBRequest and IDBTransaction error properties should be DOMExceptions');