Skip to content

Commit

Permalink
Do not wait for events to be dispatched to IDBRequest
Browse files Browse the repository at this point in the history
The test expects event to be dispatched to IDBRequest after its execution
context is stopped, but this is not standard behavior. WebKit and Blink can stop
dispatching event as soon as iframe is detached (iframe.remove() is invoked),
which leads to test timeout. Since the goal of the test is to verify the accessor
is still valid after execution context is destroyed (no exception is thrown), we
can just check readyState without wait. We only check the type instead of value
as different engines handle the destruction differently, so the state may not be
updated right away.
  • Loading branch information
szewai committed Aug 7, 2024
1 parent 881381e commit 39c6d72
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions IndexedDB/ready-state-destroyed-execution-context.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
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');
assert_equals(typeof openRequest.readyState, 'string');
}, 'readyState accessor is valid after execution context is destroyed');

</script>

0 comments on commit 39c6d72

Please sign in to comment.