LibWeb/IDB: Make close_a_database_connection take a GC::Ref

This commit is contained in:
stelar7 2025-04-09 22:53:43 +02:00 committed by Andrew Kaster
parent 7c3de67b16
commit d1dabb9039
Notes: github-actions[bot] 2025-04-11 01:14:37 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -313,18 +313,18 @@ ErrorOr<GC::Ref<Key>> convert_a_value_to_a_key(JS::Realm& realm, JS::Value input
}
// https://w3c.github.io/IndexedDB/#close-a-database-connection
void close_a_database_connection(IDBDatabase& connection, bool forced)
void close_a_database_connection(GC::Ref<IDBDatabase> connection, bool forced)
{
// 1. Set connections close pending flag to true.
connection.set_close_pending(true);
connection->set_close_pending(true);
// FIXME: 2. If the forced flag is true, then for each transaction created using connection run abort a transaction with transaction and newly created "AbortError" DOMException.
// FIXME: 3. Wait for all transactions created using connection to complete. Once they are complete, connection is closed.
connection.set_state(IDBDatabase::ConnectionState::Closed);
connection->set_state(IDBDatabase::ConnectionState::Closed);
// 4. If the forced flag is true, then fire an event named close at connection.
if (forced)
connection.dispatch_event(DOM::Event::create(connection.realm(), HTML::EventNames::close));
connection->dispatch_event(DOM::Event::create(connection->realm(), HTML::EventNames::close));
}
// https://w3c.github.io/IndexedDB/#upgrade-a-database