1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibWeb: Add and use a helper to reject a promise with an exception

This commit is contained in:
Sam Atkins 2024-03-08 15:37:28 +00:00 committed by Tim Flynn
parent 24951a039e
commit 4bdb7dba8c
10 changed files with 42 additions and 52 deletions

View file

@ -12,6 +12,7 @@
#include <LibJS/Runtime/Value.h>
#include <LibJS/SafeFunction.h>
#include <LibWeb/Forward.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::WebIDL {
@ -31,4 +32,7 @@ JS::NonnullGCPtr<JS::Promise> upon_rejection(Promise const&, ReactionSteps);
void mark_promise_as_handled(Promise const&);
void wait_for_all(JS::Realm&, Vector<JS::NonnullGCPtr<Promise>> const& promises, Function<void(Vector<JS::Value> const&)> success_steps, Function<void(JS::Value)> failure_steps);
// Non-spec, convenience method.
JS::NonnullGCPtr<JS::Promise> create_rejected_promise_from_exception(JS::Realm&, Exception);
}