summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-12-28 14:48:32 +0100
committerLinus Groh <mail@linusgroh.de>2021-12-28 14:48:32 +0100
commit1c05d39abc003bca16a7a56fdb131fc01dccc059 (patch)
tree733a518b8915b10565abfb078d40021afc46f21f /Userland
parent416b0374fb59827db45dfac2d67e7e637b2d5fff (diff)
downloadserenity-1c05d39abc003bca16a7a56fdb131fc01dccc059.zip
LibJS: Also throw exception when returning throw completion from await
...for now - the reason being that the AST breaks 'completion bubbling' and returns a plain Value, and code at the call site relies on the VM having an exception set when converting the plain value back into a completion. Fixes #11301.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Completion.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.cpp b/Userland/Libraries/LibJS/Runtime/Completion.cpp
index 0376b5a481..d1187dec34 100644
--- a/Userland/Libraries/LibJS/Runtime/Completion.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Completion.cpp
@@ -115,6 +115,10 @@ ThrowCompletionOr<Value> await(GlobalObject& global_object, Value value)
if (success.value())
return result;
+ // NOTE: This is temporary until we remove VM::exception(). It's required as callers of
+ // AwaitExpression still need to check for an exception rather than a completion
+ // type as long as ASTNode::execute() returns a plain Value.
+ vm.throw_exception(global_object, result);
return throw_completion(result);
}