[promises] Correctly run before/after hooks for await.
This fixes a bug where we didn't run before/after hooks for await when the debugger is not active, as reported downstream in https://github.com/nodejs/node/issues/20274 Change-Id: I1948d1884c591418d87ffd1d0ccb2bebf4e908f1 Reviewed-on: https://chromium-review.googlesource.com/1039386 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#52909}
This commit is contained in:
parent
a9db2c74b5
commit
ca7639239f
@ -44,7 +44,7 @@ void AsyncBuiltinsAssembler::Await(Node* context, Node* generator, Node* value,
|
||||
// When debugging, we need to link from the {generator} to the
|
||||
// {outer_promise} of the async function/generator.
|
||||
Label done(this);
|
||||
GotoIfNot(IsDebugActive(), &done);
|
||||
GotoIfNot(IsPromiseHookEnabledOrDebugIsActive(), &done);
|
||||
CallRuntime(Runtime::kSetProperty, native_context, generator,
|
||||
LoadRoot(Heap::kgenerator_outer_promise_symbolRootIndex),
|
||||
outer_promise, SmiConstant(LanguageMode::kStrict));
|
||||
|
@ -18309,6 +18309,12 @@ TEST(PromiseHook) {
|
||||
CHECK_EQ(v8::Promise::kFulfilled, GetPromise("p")->State());
|
||||
CHECK_EQ(9, promise_hook_data->promise_hook_count);
|
||||
|
||||
promise_hook_data->Reset();
|
||||
source = "(async() => await p)();\n";
|
||||
|
||||
CompileRun(source);
|
||||
CHECK_EQ(11, promise_hook_data->promise_hook_count);
|
||||
|
||||
delete promise_hook_data;
|
||||
isolate->SetPromiseHook(nullptr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user