mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibWeb/IDB: Make close_a_database_connection take a GC::Ref
This commit is contained in:
Notes:
github-actions[bot]
2025-04-11 01:14:37 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/d1dabb90397 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4306 Reviewed-by: https://github.com/ADKaster ✅
@@ -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 connection’s 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
|
||||
|
||||
Reference in New Issue
Block a user