tor-browser

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

idbdatabase-deleteObjectStore-exception-order.any.js (1498B)


      1 // META: global=window,worker
      2 // META: title=IndexedDB: IDBDatabase deleteObjectStore() Exception Ordering
      3 // META: script=resources/support.js
      4 
      5 // Spec: https://w3c.github.io/IndexedDB/#dom-idbdatabase-deleteobjectstore
      6 
      7 'use strict';
      8 
      9 indexeddb_test(
     10    (t, db, txn) => {
     11      db.createObjectStore('s');
     12      txn.onabort = () => {
     13        setTimeout(
     14            t.step_func(() => {
     15              assert_throws_dom(
     16                  'InvalidStateError', () => db.deleteObjectStore('s'),
     17                  '"running an upgrade transaction" check (InvalidStateError) ' +
     18                      'should precede "not active" check (TransactionInactiveError)');
     19              t.done();
     20            }),
     21            0);
     22      };
     23      txn.abort();
     24    },
     25    (t, db) => {
     26      t.assert_unreached('open should fail');
     27    },
     28    'IDBDatabase.deleteObjectStore exception order: ' +
     29        'InvalidStateError vs. TransactionInactiveError',
     30    {upgrade_will_abort: true});
     31 
     32 indexeddb_test(
     33    (t, db, txn) => {
     34      txn.abort();
     35      assert_throws_dom(
     36          'TransactionInactiveError', () => db.deleteObjectStore('nope'),
     37          '"not active" check (TransactionInactiveError) should precede ' +
     38              '"name in database" check (NotFoundError)');
     39      t.done();
     40    },
     41    (t, db) => {
     42      t.assert_unreached('open should fail');
     43    },
     44    'IDBDatabase.deleteObjectStore exception order: ' +
     45        'TransactionInactiveError vs. NotFoundError',
     46    {upgrade_will_abort: true});