mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb/IDB: Make close_a_database_connection take a GC::Ref
This commit is contained in:
parent
7c3de67b16
commit
d1dabb9039
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 ✅
2 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -20,7 +20,7 @@ using KeyPath = Variant<String, Vector<String>>;
|
|||
WebIDL::ExceptionOr<GC::Ref<IDBDatabase>> open_a_database_connection(JS::Realm&, StorageAPI::StorageKey, String, Optional<u64>, GC::Ref<IDBRequest>);
|
||||
bool fire_a_version_change_event(JS::Realm&, FlyString const&, GC::Ref<DOM::EventTarget>, u64, Optional<u64>);
|
||||
ErrorOr<GC::Ref<Key>> convert_a_value_to_a_key(JS::Realm&, JS::Value, Vector<JS::Value> = {});
|
||||
void close_a_database_connection(IDBDatabase&, bool forced = false);
|
||||
void close_a_database_connection(GC::Ref<IDBDatabase>, bool forced = false);
|
||||
GC::Ref<IDBTransaction> upgrade_a_database(JS::Realm&, GC::Ref<IDBDatabase>, u64, GC::Ref<IDBRequest>);
|
||||
WebIDL::ExceptionOr<u64> delete_a_database(JS::Realm&, StorageAPI::StorageKey, String, GC::Ref<IDBRequest>);
|
||||
void abort_a_transaction(GC::Ref<IDBTransaction>, GC::Ptr<WebIDL::DOMException>);
|
||||
|
|
Loading…
Add table
Reference in a new issue