mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb/IDB: Abort requests in the transactions request list
This commit is contained in:
parent
a61315a68e
commit
8fcb54dada
Notes:
github-actions[bot]
2025-04-11 01:13:53 +00:00
Author: https://github.com/stelar7 Commit: https://github.com/LadybirdBrowser/ladybird/commit/8fcb54dadac Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4306 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 22 additions and 6 deletions
|
@ -547,12 +547,28 @@ void abort_a_transaction(GC::Ref<IDBTransaction> transaction, GC::Ptr<WebIDL::DO
|
|||
if (error)
|
||||
transaction->set_error(error);
|
||||
|
||||
// FIXME: 5. For each request of transaction’s request list, abort the steps to asynchronously execute a request for request,
|
||||
// set request’s processed flag to true, and queue a task to run these steps:
|
||||
// FIXME: 1. Set request’s done flag to true.
|
||||
// FIXME: 2. Set request’s result to undefined.
|
||||
// FIXME: 3. Set request’s error to a newly created "AbortError" DOMException.
|
||||
// FIXME: 4. Fire an event named error at request with its bubbles and cancelable attributes initialized to true.
|
||||
// 5. For each request of transaction’s request list,
|
||||
for (auto const& request : transaction->request_list()) {
|
||||
// FIXME: abort the steps to asynchronously execute a request for request,
|
||||
|
||||
// set request’s processed flag to true
|
||||
request->set_processed(true);
|
||||
|
||||
// and queue a task to run these steps:
|
||||
HTML::queue_a_task(HTML::Task::Source::DatabaseAccess, nullptr, nullptr, GC::create_function(transaction->realm().vm().heap(), [request]() {
|
||||
// 1. Set request’s done flag to true.
|
||||
request->set_done(true);
|
||||
|
||||
// 2. Set request’s result to undefined.
|
||||
request->set_result(JS::js_undefined());
|
||||
|
||||
// 3. Set request’s error to a newly created "AbortError" DOMException.
|
||||
request->set_error(WebIDL::AbortError::create(request->realm(), "Transaction was aborted"_string));
|
||||
|
||||
// 4. Fire an event named error at request with its bubbles and cancelable attributes initialized to true.
|
||||
request->dispatch_event(DOM::Event::create(request->realm(), HTML::EventNames::error, { .bubbles = true, .cancelable = true }));
|
||||
}));
|
||||
}
|
||||
|
||||
// 6. Queue a task to run these steps:
|
||||
HTML::queue_a_task(HTML::Task::Source::DatabaseAccess, nullptr, nullptr, GC::create_function(transaction->realm().vm().heap(), [transaction]() {
|
||||
|
|
Loading…
Add table
Reference in a new issue