summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/idbrequest_result.html
blob: 69c48532463effcac6dcc7d82a7904b76259e890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<meta charset=utf-8>
<title>IDBRequest.result</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=resources/support.js></script>

<script>
async_test(t => {
  var open = createdb(t);
  open.onupgradeneeded = t.step_func(e => {
    var db = e.target.result;
    db.createObjectStore('store');
  });
  open.onsuccess = t.step_func(e => {
    var db = e.target.result;
    var request = db.transaction('store', 'readonly', {durability: 'relaxed'}).objectStore('store').get(0);

    assert_equals(request.readyState, 'pending');
    assert_throws_dom('InvalidStateError', () => request.result,
                      'IDBRequest.result should throw if request is pending');
    t.done();
  });
}, 'IDBRequest.result throws if ready state is pending');
</script>