Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14.x backport] deps: V8: cherry-pick 81814ed44574 #39743

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.81',
'v8_embedder_string': '-node.82',

##### V8 defaults for Node.js #####

Expand Down
10 changes: 9 additions & 1 deletion deps/v8/src/objects/contexts.cc
Expand Up @@ -545,7 +545,15 @@ void NativeContext::RunPromiseHook(PromiseHookType type,

Handle<Object> receiver = isolate->global_proxy();

if (Execution::Call(isolate, hook, receiver, argc, argv).is_null()) {
StackLimitCheck check(isolate);
bool failed = false;
if (check.HasOverflowed()) {
isolate->StackOverflow();
failed = true;
} else {
failed = Execution::Call(isolate, hook, receiver, argc, argv).is_null();
}
if (failed) {
DCHECK(isolate->has_pending_exception());
Handle<Object> exception(isolate->pending_exception(), isolate);

Expand Down
8 changes: 8 additions & 0 deletions deps/v8/test/mjsunit/promise-hooks.js
Expand Up @@ -273,3 +273,11 @@ exceptions();

d8.promise.setHooks();
})();

(function overflow(){
d8.promise.setHooks(() => { new Promise(()=>{}) });
// Trigger overflow from JS code:
Promise.all([Promise.resolve(1)]);
%PerformMicrotaskCheckpoint();
d8.promise.setHooks();
});