diff options
author | Linus Groh <mail@linusgroh.de> | 2021-11-14 01:07:10 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-11-14 15:27:46 +0000 |
commit | 878668efc9006b590e7ef6ef0c7a0d99e6a09a90 (patch) | |
tree | 62196fb3ba29b181194c20970140cd787e6f15cf /Userland/Libraries/LibJS/Runtime | |
parent | 194d90dc7287270594a6adb16547fc4d668732f7 (diff) | |
download | serenity-878668efc9006b590e7ef6ef0c7a0d99e6a09a90.zip |
LibJS: Call [[Reject]] in PromiseResolveThenableJob after abrupt then()
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp index 99d7eb1354..bad5a263d2 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp @@ -138,16 +138,15 @@ ThrowCompletionOr<Value> PromiseResolveThenableJob::call() // c. If thenCallResult is an abrupt completion, then if (then_call_result.is_error()) { - auto error = then_call_result.throw_completion().value(); vm.clear_exception(); vm.stop_unwind(); // i. Let status be Call(resolvingFunctions.[[Reject]], undefined, ยซ thenCallResult.[[Value]] ยป). - // FIXME: Actually do this... not sure why we don't? :yakfused: + dbgln_if(PROMISE_DEBUG, "[PromiseResolveThenableJob @ {}]: then_call_result is an abrupt completion, calling reject function with value {}", this, then_call_result.throw_completion().value()); + auto status = JS::call(global_object, &reject_function, js_undefined(), then_call_result.throw_completion().value()); // ii. Return Completion(status). - dbgln_if(PROMISE_DEBUG, "[PromiseResolveThenableJob @ {}]: An exception was thrown, returning error {}", this, error); - return error; + return status; } // d. Return Completion(thenCallResult). |