mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Implement cleanup_indexed_database_transactions
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
fa1e02e5d7
commit
3815a7c1eb
Notes:
github-actions[bot]
2025-06-18 07:06:49 +00:00
Author: https://github.com/stelar7
Commit: 3815a7c1eb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5103
Reviewed-by: https://github.com/shannonbooth
6 changed files with 44 additions and 1 deletions
|
@ -2051,4 +2051,32 @@ void queue_a_database_task(GC::Ref<GC::Function<void()>> steps)
|
|||
HTML::queue_a_task(HTML::Task::Source::DatabaseAccess, nullptr, nullptr, steps);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#cleanup-indexed-database-transactions
|
||||
bool cleanup_indexed_database_transactions(GC::Ref<HTML::EventLoop> event_loop)
|
||||
{
|
||||
bool has_matching_event_loop = false;
|
||||
|
||||
Database::for_each_database([&has_matching_event_loop, event_loop](GC::Root<Database> const& database) {
|
||||
for (auto const& connection : database->associated_connections()) {
|
||||
for (auto const& transaction : connection->transactions()) {
|
||||
|
||||
// 2. For each transaction transaction with cleanup event loop matching the current event loop:
|
||||
if (transaction->cleanup_event_loop() == event_loop) {
|
||||
has_matching_event_loop = true;
|
||||
|
||||
// 1. Set transaction’s state to inactive.
|
||||
transaction->set_state(IDBTransaction::TransactionState::Inactive);
|
||||
|
||||
// 2. Clear transaction’s cleanup event loop.
|
||||
transaction->set_cleanup_event_loop(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 1. If there are no transactions with cleanup event loop matching the current event loop, return false.
|
||||
// 3. Return true.
|
||||
return has_matching_event_loop;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue