LibJS: Remove now-redundant TemporaryClearException from Promise methods
IteratorClose now handles exceptions itself before invoking VM::call(), so outside callers doubling that work isn't helpful.
This commit is contained in:
parent
28e0aa59a8
commit
4e4db65e26
Notes:
sideshowbarker
2024-07-18 02:05:57 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/4e4db65e26d Pull-request: https://github.com/SerenityOS/serenity/pull/10554
1 changed files with 5 additions and 13 deletions
|
@ -272,10 +272,8 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::all)
|
||||||
|
|
||||||
auto result = perform_promise_all(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
auto result = perform_promise_all(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
if (!iterator_record_is_complete(global_object, *iterator_record)) {
|
if (!iterator_record_is_complete(global_object, *iterator_record))
|
||||||
TemporaryClearException clear_exception(vm); // iterator_close() may invoke vm.call(), which VERIFYs no exception.
|
|
||||||
result = iterator_close(*iterator_record, result.release_error());
|
result = iterator_close(*iterator_record, result.release_error());
|
||||||
}
|
|
||||||
|
|
||||||
TRY_OR_REJECT(vm, promise_capability, result);
|
TRY_OR_REJECT(vm, promise_capability, result);
|
||||||
}
|
}
|
||||||
|
@ -297,10 +295,8 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::all_settled)
|
||||||
|
|
||||||
auto result = perform_promise_all_settled(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
auto result = perform_promise_all_settled(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
if (!iterator_record_is_complete(global_object, *iterator_record)) {
|
if (!iterator_record_is_complete(global_object, *iterator_record))
|
||||||
TemporaryClearException clear_exception(vm); // iterator_close() may invoke vm.call(), which VERIFYs no exception.
|
|
||||||
result = iterator_close(*iterator_record, result.release_error());
|
result = iterator_close(*iterator_record, result.release_error());
|
||||||
}
|
|
||||||
|
|
||||||
TRY_OR_REJECT(vm, promise_capability, result);
|
TRY_OR_REJECT(vm, promise_capability, result);
|
||||||
}
|
}
|
||||||
|
@ -322,10 +318,8 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::any)
|
||||||
|
|
||||||
auto result = perform_promise_any(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
auto result = perform_promise_any(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
if (!iterator_record_is_complete(global_object, *iterator_record)) {
|
if (!iterator_record_is_complete(global_object, *iterator_record))
|
||||||
TemporaryClearException clear_exception(vm); // iterator_close() may invoke vm.call(), which VERIFYs no exception.
|
|
||||||
result = iterator_close(*iterator_record, result.release_error());
|
result = iterator_close(*iterator_record, result.release_error());
|
||||||
}
|
|
||||||
|
|
||||||
TRY_OR_REJECT(vm, promise_capability, result);
|
TRY_OR_REJECT(vm, promise_capability, result);
|
||||||
}
|
}
|
||||||
|
@ -347,10 +341,8 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(PromiseConstructor::race)
|
||||||
|
|
||||||
auto result = perform_promise_race(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
auto result = perform_promise_race(global_object, *iterator_record, constructor, promise_capability, promise_resolve);
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
if (!iterator_record_is_complete(global_object, *iterator_record)) {
|
if (!iterator_record_is_complete(global_object, *iterator_record))
|
||||||
TemporaryClearException clear_exception(vm);
|
result = iterator_close(*iterator_record, result.release_error());
|
||||||
result = iterator_close(*iterator_record, result.release_error()); // iterator_close() may invoke vm.call(), which VERIFYs no exception.
|
|
||||||
}
|
|
||||||
|
|
||||||
TRY_OR_REJECT(vm, promise_capability, result);
|
TRY_OR_REJECT(vm, promise_capability, result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue