summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html
blob: 8194052391a7795b9310fd43cbef74571bfdd4cf (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
26
27
<!DOCTYPE html>
<meta charset=utf-8>
<title>readyState is valid when the execution context is destroyed</title>
<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbrequest-readystate">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=resources/support.js></script>
<script>

function load_iframe() {
    return new Promise(resolve => {
        const iframe = document.createElement('iframe');
        iframe.onload = () => { resolve(iframe); };
        document.documentElement.appendChild(iframe);
    });
}

promise_test(async t => {
    const iframe = await load_iframe();
    const dbname = location + '-' + t.name;
    const openRequest = iframe.contentWindow.indexedDB.open(dbname);
    assert_equals(openRequest.readyState, 'pending');
    iframe.remove();
    assert_equals(openRequest.readyState, 'done');
}, 'readyState accessor is valid after execution context is destroyed');

</script>