mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb/IDB: Abort transaction in database upgrade if needed
This commit is contained in:
parent
923927564d
commit
e8b7447c36
Notes:
github-actions[bot]
2025-03-25 10:51:12 +00:00
Author: https://github.com/stelar7
Commit: e8b7447c36
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4033
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 4 additions and 2 deletions
|
@ -349,12 +349,14 @@ void upgrade_a_database(JS::Realm& realm, GC::Ref<IDBDatabase> connection, u64 v
|
||||||
transaction->set_state(IDBTransaction::TransactionState::Active);
|
transaction->set_state(IDBTransaction::TransactionState::Active);
|
||||||
|
|
||||||
// 5. Let didThrow be the result of firing a version change event named upgradeneeded at request with old version and version.
|
// 5. Let didThrow be the result of firing a version change event named upgradeneeded at request with old version and version.
|
||||||
[[maybe_unused]] auto did_throw = fire_a_version_change_event(realm, HTML::EventNames::upgradeneeded, request, old_version, version);
|
auto did_throw = fire_a_version_change_event(realm, HTML::EventNames::upgradeneeded, request, old_version, version);
|
||||||
|
|
||||||
// 6. Set transaction’s state to inactive.
|
// 6. Set transaction’s state to inactive.
|
||||||
transaction->set_state(IDBTransaction::TransactionState::Inactive);
|
transaction->set_state(IDBTransaction::TransactionState::Inactive);
|
||||||
|
|
||||||
// FIXME: 7. If didThrow is true, run abort a transaction with transaction and a newly created "AbortError" DOMException.
|
// 7. If didThrow is true, run abort a transaction with transaction and a newly created "AbortError" DOMException.
|
||||||
|
if (did_throw)
|
||||||
|
abort_a_transaction(*transaction, WebIDL::AbortError::create(realm, "Version change event threw an exception"_string));
|
||||||
|
|
||||||
wait_for_transaction = false;
|
wait_for_transaction = false;
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue