blob: 6b2677fae799bf296e7ee992d36eed1a5668fc84 (
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
28
29
30
31
|
<!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();
await new Promise(resolve => {
openRequest.onerror = resolve;
openRequest.onsuccess = resolve;
});
assert_equals(openRequest.readyState, 'done');
}, 'readyState accessor is valid after execution context is destroyed');
</script>
|